From: Ritesh Harjani <riteshh@linux.ibm.com>
To: Jan Kara <jack@suse.cz>
Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org,
"Theodore Ts'o" <tytso@mit.edu>,
Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Subject: Re: [RFC 2/6] ext4: Implement ext4_group_block_valid() as common function
Date: Fri, 4 Feb 2022 15:38:44 +0530 [thread overview]
Message-ID: <20220204100844.ty23mdc5mfjbgiwj@riteshh-domain> (raw)
In-Reply-To: <20220201113453.exaikdfsc3vubqel@quack3.lan>
On 22/02/01 12:34PM, Jan Kara wrote:
> On Mon 31-01-22 20:46:51, Ritesh Harjani wrote:
> > This patch implements ext4_group_block_valid() check functionality,
> > and refactors all the callers to use this common function instead.
> >
> > Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
> ...
>
> > diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> > index 8d23108cf9d7..60d32d3d8dc4 100644
> > --- a/fs/ext4/mballoc.c
> > +++ b/fs/ext4/mballoc.c
> > @@ -6001,13 +6001,7 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode,
> > goto error_return;
> > }
> >
> > - if (in_range(ext4_block_bitmap(sb, gdp), block, count) ||
> > - in_range(ext4_inode_bitmap(sb, gdp), block, count) ||
> > - in_range(block, ext4_inode_table(sb, gdp),
> > - sbi->s_itb_per_group) ||
> > - in_range(block + count - 1, ext4_inode_table(sb, gdp),
> > - sbi->s_itb_per_group)) {
> > -
> > + if (!ext4_group_block_valid(sb, block_group, block, count)) {
> > ext4_error(sb, "Freeing blocks in system zone - "
> > "Block = %llu, count = %lu", block, count);
> > /* err = 0. ext4_std_error should be a no op */
>
> When doing this, why not rather directly use ext4_inode_block_valid() here?
This is because while freeing these blocks we have their's corresponding block
group too. So there is little point in checking FS Metadata of all block groups
v/s FS Metadata of just this block group, no?
Also, I am not sure if we changing this to check against system-zone's blocks
(which has FS Metadata blocks from all block groups), can add any additional
penalty?
-riteshh
>
> > @@ -6194,11 +6188,7 @@ int ext4_group_add_blocks(handle_t *handle, struct super_block *sb,
> > goto error_return;
> > }
> >
> > - if (in_range(ext4_block_bitmap(sb, desc), block, count) ||
> > - in_range(ext4_inode_bitmap(sb, desc), block, count) ||
> > - in_range(block, ext4_inode_table(sb, desc), sbi->s_itb_per_group) ||
> > - in_range(block + count - 1, ext4_inode_table(sb, desc),
> > - sbi->s_itb_per_group)) {
> > + if (!ext4_group_block_valid(sb, block_group, block, count)) {
> > ext4_error(sb, "Adding blocks in system zones - "
> > "Block = %llu, count = %lu",
> > block, count);
>
> And here I'd rather refactor ext4_inode_block_valid() a bit to provide a
> more generic helper not requiring an inode and use it here...
>
> Honza
> --
> Jan Kara <jack@suse.com>
> SUSE Labs, CR
next prev parent reply other threads:[~2022-02-04 10:08 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1643642105.git.riteshh@linux.ibm.com>
2022-01-31 15:16 ` [RFC 1/6] ext4: Fixes ext4_mb_mark_bb() with flex_bg with fast_commit Ritesh Harjani
2022-02-01 11:21 ` Jan Kara
2022-02-04 10:12 ` Ritesh Harjani
2022-01-31 15:16 ` [RFC 2/6] ext4: Implement ext4_group_block_valid() as common function Ritesh Harjani
2022-02-01 11:34 ` Jan Kara
2022-02-04 10:08 ` Ritesh Harjani [this message]
2022-02-04 11:49 ` Jan Kara
2022-02-05 10:43 ` Ritesh Harjani
2022-01-31 15:16 ` [RFC 3/6] ext4: Use in_range() for range checking in ext4_fc_replay_check_excluded Ritesh Harjani
2022-02-01 11:35 ` Jan Kara
2022-01-31 15:16 ` [RFC 4/6] ext4: No need to test for block bitmap bits in ext4_mb_mark_bb() Ritesh Harjani
2022-02-01 11:38 ` Jan Kara
2022-02-04 10:10 ` Ritesh Harjani
2022-01-31 15:16 ` [RFC 5/6] ext4: Refactor ext4_free_blocks() to pull out ext4_mb_clear_bb() Ritesh Harjani
2022-02-01 11:40 ` Jan Kara
2022-01-31 15:16 ` [RFC 6/6] ext4: Add extra check in ext4_mb_mark_bb() to prevent against possible corruption Ritesh Harjani
2022-02-01 11:47 ` Jan Kara
2022-02-04 10:11 ` Ritesh Harjani
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=20220204100844.ty23mdc5mfjbgiwj@riteshh-domain \
--to=riteshh@linux.ibm.com \
--cc=harshadshirwadkar@gmail.com \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@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;
as well as URLs for NNTP newsgroup(s).