David Wragg writes:
> ... I came up
> with the patch below.  It reads-ahead the next block bitmap when the
> current block bitmap seems to be getting full (based on a simple
> heuristic).  For my application, at least, it works very nicely.  The
> seek to do the bitmap read still takes place, but with the patch it
> happens long before the dependent writes so that they do not get
> stalled.

 [snip]

> +
> +                     if ((fbc & (fbc - 1)) == 0)
> +                             readahead_block_bitmap(sb, i);

I'm not sure why you picked this as a readahead heuristic...  For a 4kB
ext2 filesystem (which you _definitely_ should be using if you want
throughput), you can have up to 32k blocks in a group.  So with your
heuristic, we would prefetch the next block bitmap when there are 16k
free blocks left in the current group?

A better test would (IMHO) be simply to determine the number of remaining
free blocks in the group (assuming you have a relatively linear access
pattern).  Since the initial goal for a new file is the first block in the
group the inode was allocated in, chances are that you have searched the
entire bitmap for free blocks when you start running low.

An even better heuristic would be if the allocated blocks are approaching
the end of current group (i.e. EXT2_BLOCKS_PER_GROUP(sb) - j < threshold)
because once you hit the end of the group, you will start searching in
the next group's block bitmap.

Cheers, Andreas
-- 
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
                 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/               -- Dogbert
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [EMAIL PROTECTED]

Reply via email to