[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <0E88D038-7509-435F-BBAF-6A8416749785@dilger.ca>
Date: Mon, 3 Feb 2014 14:32:45 -0700
From: Andreas Dilger <adilger@...ger.ca>
To: "Darrick J. Wong" <darrick.wong@...cle.com>
Cc: Theodore Ts'o <tytso@....edu>,
linux-ext4 <linux-ext4@...r.kernel.org>
Subject: Re: [PATCH 2/3] libext2fs: allow clients to read-ahead metadata
On Feb 1, 2014, at 3:37 AM, Darrick J. Wong <darrick.wong@...cle.com> 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));
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.
Cheers, Andreas
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists