From: Jan Kara <jack@suse.cz>
To: Chengguang Xu <cgxu519@mykernel.net>
Cc: Jan Kara <jack@suse.cz>, jack <jack@suse.com>,
linux-ext4 <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH 2/5] ext2: code cleanup by calling ext2_group_last_block_no()
Date: Thu, 7 Nov 2019 10:21:17 +0100 [thread overview]
Message-ID: <20191107092117.GA11400@quack2.suse.cz> (raw)
In-Reply-To: <16e43c91b4e.12c0f5d17918.413402503051848643@mykernel.net>
On Thu 07-11-19 10:54:43, Chengguang Xu wrote:
> ---- 在 星期三, 2019-11-06 23:42:36 Jan Kara <jack@suse.cz> 撰写 ----
> > On Mon 04-11-19 19:40:33, Chengguang Xu wrote:
> > > Call common helper ext2_group_last_block_no() to
> > > calculate group last block number.
> > >
> > > Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
> >
> > Thanks for the patch! I've applied it (as well as 1/5) and added attached
> > simplification on top.
> >
>
> In ext2_try_to_allocate()
>
> + if (my_rsv->_rsv_end < group_last_block)
> + end = my_rsv->_rsv_end - group_first_block + 1;
> + if (grp_goal < start || grp_goal > end)
>
> Based on original code, shouldn't it be if (grp_goal < start || grp_goal
> >=end) ?
Hum, that's a good point. The original code actually had an off-by-one bug
because 'end' is really the last block that can be used so grp_goal == end
still makes sense. And my cleanup fixed it. Now looking at the code in
ext2_try_to_allocate() we also have a similar bug in the loop allocating
blocks. There we can also go upto 'end' inclusive. Added a patch to fix
that. Thanks for pointing me to this!
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2019-11-07 9:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-04 11:40 [PATCH 1/5] ext2: introduce new helper ext2_group_last_block_no() Chengguang Xu
2019-11-04 11:40 ` [PATCH 2/5] ext2: code cleanup by calling ext2_group_last_block_no() Chengguang Xu
2019-11-06 15:42 ` Jan Kara
2019-11-07 2:54 ` Chengguang Xu
2019-11-07 9:21 ` Jan Kara [this message]
2019-11-07 9:44 ` Chengguang Xu
2019-11-07 11:36 ` Jan Kara
2019-11-04 11:40 ` [PATCH 3/5] ext2: skip unnecessary operations in ext2_try_to_allocate() Chengguang Xu
2019-11-04 11:40 ` [PATCH 4/5] ext2: code cleanup for ext2_try_to_allocate() Chengguang Xu
2019-11-06 15:59 ` Jan Kara
2019-11-07 2:58 ` Chengguang Xu
2019-11-04 11:40 ` [PATCH 5/5] ext2: fix improper function comment Chengguang Xu
2019-11-06 16:01 ` Jan Kara
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=20191107092117.GA11400@quack2.suse.cz \
--to=jack@suse.cz \
--cc=cgxu519@mykernel.net \
--cc=jack@suse.com \
--cc=linux-ext4@vger.kernel.org \
/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).