From: Ric Wheeler <rwheeler@redhat.com>
To: Theodore Tso <tytso@mit.edu>
Cc: "Frédéric Bohé" <frederic.bohe@bull.net>, linux-ext4@vger.kernel.org
Subject: Re: [PATCH 2/4] Create the journal in the middle of the filesystem
Date: Thu, 28 Aug 2008 09:40:30 -0400 [thread overview]
Message-ID: <48B6AACE.6060103@redhat.com> (raw)
In-Reply-To: <20080828133449.GG26987@mit.edu>
Theodore Tso wrote:
> On Thu, Aug 28, 2008 at 11:55:21AM +0200, Frédéric Bohé wrote:
>
>> With 512 groups by flex group, meta-datas for a single flex-group are 8
>> groups long ! If we have no luck and there are a bunch of groups
>> occupied by meta-datas at the middle of the filesystem, we should
>> slightly increase the number of groups scanned to find a completely free
>> group.
>>
>
> I'm not sure it ever makes sense to use such a huge -G setting, but
> yes, you're right. It actually wasn't a major tragedy, since this
> just specifies the goal block, and so the block allocator would just
> search forward to find the first free block. But it is better to move
> forward to the next free block group, so we leave space for interior
> nodes of the extent tree to be allocated.
>
> The following patch takes into account the flex_bg size, and will
> stash the journal in the first free block group after metadata; we do
> by starting at a flex_bg boundary, and then searching forward until
> bg_free_blocks_count is non-zero. However, if the number of block
> groups is less than half of the flex_bg size, we'll just give up and
> throw it at the mid-point of the filesystem, since that (plus using
> extents instead of indirect blocks) is really the major optimization
> here.
>
> One or two discontinuities in the journal file really isn't a big
> deal, since we're normally seaking back and forth between the rest of
> the filesystem data blocks and the journal anyway. The best benchmark
> to see a problem isn't going to be bonnie, but something that which is
> extremely fsync-intensive.
>
> - Ted
>
I can try and test this with my fsync() heavy fs_mark run...
Ric
> diff --git a/lib/ext2fs/mkjournal.c b/lib/ext2fs/mkjournal.c
> index 96b574e..f5a9dba 100644
> --- a/lib/ext2fs/mkjournal.c
> +++ b/lib/ext2fs/mkjournal.c
> @@ -275,7 +275,7 @@ static errcode_t write_journal_inode(ext2_filsys fs, ext2_ino_t journal_ino,
> blk_t size, int flags)
> {
> char *buf;
> - dgrp_t group, start, end, i;
> + dgrp_t group, start, end, i, log_flex;
> errcode_t retval;
> struct ext2_inode inode;
> struct mkjournal_struct es;
> @@ -311,7 +311,17 @@ static errcode_t write_journal_inode(ext2_filsys fs, ext2_ino_t journal_ino,
> */
> group = ext2fs_group_of_blk(fs, (fs->super->s_blocks_count -
> fs->super->s_first_data_block) / 2);
> - start = (group > 0) ? group-1 : group;
> + log_flex = 1 << fs->super->s_log_groups_per_flex;
> + if (fs->super->s_log_groups_per_flex && (group > log_flex)) {
> + group = group & ~(log_flex - 1);
> + while ((group < fs->group_desc_count) &&
> + fs->group_desc[group].bg_free_blocks_count == 0)
> + group++;
> + if (group == fs->group_desc_count)
> + group = 0;
> + start = group;
> + } else
> + start = (group > 0) ? group-1 : group;
> end = ((group+1) < fs->group_desc_count) ? group+1 : group;
> group = start;
> for (i=start+1; i <= end; i++)
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2008-08-28 13:43 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-27 17:36 Journal file fragmentation Frédéric Bohé
2008-08-27 20:12 ` Jose R. Santos
2008-08-27 21:06 ` Theodore Tso
2008-08-27 21:14 ` [PATCH 1/4] ext2fs_mkjournal(): Don't allocate an extra block to the journal Theodore Ts'o
2008-08-27 21:14 ` [PATCH 2/4] Create the journal in the middle of the filesystem Theodore Ts'o
2008-08-27 21:14 ` [PATCH 3/4] ext2fs_block_iterate2: Add BLOCK_FLAG_APPEND support for extent-based files Theodore Ts'o
2008-08-27 21:14 ` [PATCH 4/4] If the filesystem supports extents create an extent-based journal inode Theodore Ts'o
2008-08-28 9:55 ` [PATCH 2/4] Create the journal in the middle of the filesystem Frédéric Bohé
2008-08-28 13:34 ` Theodore Tso
2008-08-28 13:40 ` Ric Wheeler [this message]
2008-08-28 14:36 ` Theodore Tso
2008-08-28 14:38 ` Ric Wheeler
2008-09-03 14:08 ` Ric Wheeler
2008-08-28 16:16 ` Frédéric Bohé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48B6AACE.6060103@redhat.com \
--to=rwheeler@redhat.com \
--cc=frederic.bohe@bull.net \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox