patch-1.3.2 linux/fs/ext2/balloc.c
Next file: linux/fs/proc/inode.c
Previous file: linux/fs/exec.c
Back to the patch index
Back to the overall index
- Lines: 40
- Date:
Fri Jun 16 20:03:02 1995
- Orig file:
v1.3.1/linux/fs/ext2/balloc.c
- Orig date:
Wed Mar 22 10:33:59 1995
diff -u --recursive --new-file v1.3.1/linux/fs/ext2/balloc.c linux/fs/ext2/balloc.c
@@ -257,7 +257,6 @@
struct buffer_head * bh2;
char * p, * r;
int i, j, k, tmp;
- unsigned long lmap;
int bitmap_nr;
struct ext2_group_desc * gdp;
struct ext2_super_block * es;
@@ -310,22 +309,16 @@
if (j) {
/*
* The goal was occupied; search forward for a free
- * block within the next 32 blocks
+ * block within the next XX blocks.
+ *
+ * end_goal is more or less random, but it has to be
+ * less than EXT2_BLOCKS_PER_GROUP. Aligning up to the
+ * next 64-bit boundary is simple..
*/
- lmap = ((((unsigned long *) bh->b_data)[j >> 5]) >>
- ((j & 31) + 1));
- if (j < EXT2_BLOCKS_PER_GROUP(sb) - 32)
- lmap |= (((unsigned long *) bh->b_data)[(j >> 5) + 1]) <<
- (31 - (j & 31));
- else
- lmap |= 0xffffffff << (31 - (j & 31));
- if (lmap != 0xffffffffl) {
- k = ffz(lmap) + 1;
- if ((j + k) < EXT2_BLOCKS_PER_GROUP(sb)) {
- j += k;
- goto got_block;
- }
- }
+ int end_goal = (j + 63) & ~63;
+ j = find_next_zero_bit(bh->b_data, end_goal, j);
+ if (j < end_goal)
+ goto got_block;
}
ext2_debug ("Bit not found near goal\n");
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov
with Sam's (original) version of this