On Mon, Feb 03, 2014 at 02:32:45PM -0700, Andreas Dilger wrote: > On Feb 1, 2014, at 3:37 AM, Darrick J. Wong <darrick.wong@xxxxxxxxxx> wrote: > > This patch adds to libext2fs the ability to pre-fetch metadata > > into the page cache in the hopes of speeding up libext2fs' clients. > > There are two new library functions -- the first allows a client to > > readahead a list of blocks, and the second is a helper function that > > uses that first mechanism to load group data (bitmaps, inode tables). > > > > e2fsck will employ both of these methods to speed itself up. > > > > diff --git a/lib/ext2fs/readahead.c b/lib/ext2fs/readahead.c > > new file mode 100644 > > index 0000000..05f6135 > > --- /dev/null > > +++ b/lib/ext2fs/readahead.c > > +errcode_t ext2fs_readahead(ext2_filsys fs, int flags, dgrp_t start, > > + dgrp_t ngroups) > > +{ > > + > > + for (i = start; i < end; i++) { > > + if ((flags & EXT2FS_READ_ITABLE) && > > + ext2fs_bg_free_inodes_count(fs, i) < > > + fs->super->s_inodes_per_group) { > > + super = ext2fs_inode_table_loc(fs, i); > > + err = ext2fs_add_dir_block2(dblist, 0, super, > > + fs->inode_blocks_per_group); > > This prefetches all of the inode table blocks, when it could instead > just prefetch the in-use blocks using: > > if ((flags & EXT2FS_READ_ITABLE) && > ext2fs_bg_itable_unused(fs, i) < > fs->inode_blocks_per_group)) > err = ext2fs_add_dir_block2(dblist, 0, super, > fs->inode_blocks_per_group - > ext2fs_bg_itable_unused(fs, i)); I think you need to convert ext2fs_bg_itable_unused() to blocks there, but point taken. Actually, the first insane-o patch had this, but I forgot it when writing up the second version. > If there is corruption in the filesystem and the "unused" blocks need > to be read later it is probably more than offset by not reading those > actually unused blocks for the rest of the time. <shrug> I'm not particularly concerned about less than optimal IO throughput on broken filesystems. --D > > > Cheers, Andreas > > > > > -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html