Andreas Dilger <[EMAIL PROTECTED]> writes:
>  [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?

Yes, this might well be more aggressive than it needs to be.

I haven't read the 2.4 buffer cache code thoroughly, but it looks like
buffers are evicted when their containing page is evicted, and getblk
sets the referenced flag on that containing page (through
tuch_buffer).

So attempting a readahead when the block group is 1/2 full, 3/4 full,
7/8 full, 15/16 full, etc., should make it steadily more likely that
the next block group bitmap will have been read in *and* it won't have
been evicted.  Which is along the lines of what I wanted -- the
chances that the next block bitmap is cached improves as we run out of
blocks in the current group.

But I wouldn't be surprised if there are better ways to achieve the
same or similar effect.

> 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.

The problem with a single threshold is if it is too high, then a new
file on a mostly full block group might not get the readahead it would
like.  If it is too low, then it might delay the readhahead too long
so that the bitmap read is not done by the time it is needed.  So I
chickened out of choosing a threshold at all ;-)


David


-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [EMAIL PROTECTED]

Reply via email to