[Ocfs2-tools-devel] [PATCH 5/6] fsck.ocfs2: Use the I/O cache.
Tao Ma
tao.ma at oracle.com
Thu May 21 20:43:11 PDT 2009
Hi Joel,
The patch set looks good to me. Just one qs.
Joel Becker wrote:
> +static void o2fsck_init_cache(o2fsck_state *ost, enum o2fsck_cache_hint hint)
> +{
> + errcode_t ret;
> + uint64_t blocks_wanted;
> + int leave_room;
> + ocfs2_filesys *fs = ost->ost_fs;
> + int max_slots = OCFS2_RAW_SB(fs->fs_super)->s_max_slots;
> +
> + switch (hint) {
> + case O2FSCK_CACHE_MODE_FULL:
> + leave_room = 1;
> + blocks_wanted = fs->fs_blocks;
> + break;
> + case O2FSCK_CACHE_MODE_JOURNAL:
> + /*
> + * We need enough blocks for all the journal
> + * data. Let's guess at 256M journals.
> + */
> + leave_room = 0;
> + blocks_wanted = ocfs2_blocks_in_bytes(fs,
> + max_slots * 1024 * 1024 * 256);
> + break;
> + case O2FSCK_CACHE_MODE_NONE:
> + return;
> + default:
> + assert(0);
> + }
why we need max_slot * 256MB cache for the journal check?
I just went through the code and can't see we will use these journal
files in the same time.
o2fsck_check_journals only check the journal header(it doesn't read the
file content here, so the cache isn't filled) and make_journal if it is
corrupted(well, here we may fill the cache in write_block, but they will
never be used in replay since they are empty).
maybe_replay_journals will iterate the journal file one by one.
btw, I also think of wether we can add some flag in write_block saying
that "don't fill in cache please. It will never be used again." For
make_journal case, it is very useful.
Regards,
Tao
More information about the Ocfs2-tools-devel
mailing list