Re: [RFC][PATCH] ext4: Convert uninitialized extent to initialized extent in case of file system full

Andreas Dilger
2008-03-02T18:51:59Z

On Mar 01, 2008 23:00 +0530, Aneesh Kumar K.V wrote:
> +/* FIXME!! we need to try to merge to left or right after zerout */
> +static int ext4_ext_zeroout(struct inode *inode, struct ext4_extent *ex)
> +{
> + done = 0;
> + while(done < len) {
> + ret = bio_add_page(bio, ZERO_PAGE(0), blocksize, 0);

Don't we need to set the page offset here?

> Converting it to an API like above doesn't help much. How about
>
> int bio_zero_blocks(struct block_device *bdev, sector_t start, unsigned
> long bytes);
>
> Here it implies that we would like to wait for zero out to finish.
>
> Since we don't have another user now i didn't add the helper. But that
> should be easy.

Yes, this is probably fine too, though at that point you don't need to
have "bio" in the name since it is an internal implementation detail.

> > A related optimization is to determine the size of the remaining split
> > extents. I propose that if either of the remaining extents are < 7
> > blocks long (or whatever, possibly 15 blocks to get a nice 64kB write) we
> > should just zero out those blocks and create a single initialized extent.
> > This would avoid the "write every alternate block" problem that could
> > grow the number of extents dramatically.
>
> Why 64KB ?. Also while inserting the extent we try to merge with left or
> right so the problem may not be that bad. But I agree with you it
> would be nice to zero out if the split extent have very small size.

I pick 64kB since this is a good size for underlying IDE disks for track
merging and such. Smaller IO sizes probably cause internal read-modify-
write, and if we make it too large it may cause extra overhead.

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.