From: Zhang Yi <yi.zhang@huawei.com>
To: Jan Kara <jack@suse.cz>, Zhihao Cheng <chengzhihao1@huawei.com>
Cc: <tytso@mit.edu>, <adilger.kernel@dilger.ca>, <jack@suse.com>,
<linux-ext4@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 4/5] jbd2: factor out journal initialization from journal_get_superblock()
Date: Mon, 13 Mar 2023 20:48:11 +0800 [thread overview]
Message-ID: <a1aef56e-652e-793c-3913-c083119d4b45@huawei.com> (raw)
In-Reply-To: <20230313111253.2eoplgfhcgbaqri2@quack3>
On 2023/3/13 19:12, Jan Kara wrote:
> On Fri 10-03-23 20:52:05, Zhihao Cheng wrote:
>> From: Zhang Yi <yi.zhang@huawei.com>
>>
>> Current journal_get_superblock() couple journal superblock checking and
>> partial journal initialization, factor out initialization part from it
>> to make things clear.
>>
>> Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
>> Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
>> ---
>> fs/jbd2/journal.c | 52 ++++++++++++++++++++---------------------------
>> 1 file changed, 22 insertions(+), 30 deletions(-)
>
> The patch looks mostly good. Just one style nit below.
>
>> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
>> index b991d5c21d16..cd94d068b4e6 100644
>> --- a/fs/jbd2/journal.c
>> +++ b/fs/jbd2/journal.c
>> @@ -1921,26 +1921,15 @@ static int journal_get_superblock(journal_t *journal)
>> printk(KERN_WARNING "JBD2: no valid journal superblock found\n");
>> goto out;
>> }
>> -
>> - switch(be32_to_cpu(sb->s_header.h_blocktype)) {
>> - case JBD2_SUPERBLOCK_V1:
>> - journal->j_format_version = 1;
>> - break;
>> - case JBD2_SUPERBLOCK_V2:
>> - journal->j_format_version = 2;
>> - break;
>> - default:
>> + if (be32_to_cpu(sb->s_header.h_blocktype) != JBD2_SUPERBLOCK_V1 &&
>> + be32_to_cpu(sb->s_header.h_blocktype) != JBD2_SUPERBLOCK_V2) {
>> printk(KERN_WARNING "JBD2: unrecognised superblock format ID\n");
>> goto out;
>> }
>> -
>> - if (be32_to_cpu(sb->s_maxlen) < journal->j_total_len)
>> - journal->j_total_len = be32_to_cpu(sb->s_maxlen);
>> - else if (be32_to_cpu(sb->s_maxlen) > journal->j_total_len) {
>> + if (be32_to_cpu(sb->s_maxlen) > journal->j_total_len) {
>> printk(KERN_WARNING "JBD2: journal file too short\n");
>> goto out;
>> }
>> -
>
> Please keep this empty line here. It actually makes the code more readable,
> separating logically different checks. Same with three empty lines below...
Thanks for the comments, I will add them back.
Yi.
next prev parent reply other threads:[~2023-03-13 12:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-10 12:52 [PATCH 0/5] ext4: Fix stale buffer loading from last failed Zhihao Cheng
2023-03-10 12:52 ` [PATCH 1/5] ext4: Fix reusing stale buffer heads from last failed mounting Zhihao Cheng
2023-03-13 10:51 ` Jan Kara
2023-03-13 12:43 ` Tudor Ambarus
2023-03-10 12:52 ` [PATCH 2/5] jbd2: remove unused feature macros Zhihao Cheng
2023-03-13 10:52 ` Jan Kara
2023-03-10 12:52 ` [PATCH 3/5] jbd2: switch to check format version in superblock directly Zhihao Cheng
2023-03-13 10:57 ` Jan Kara
2023-03-10 12:52 ` [PATCH 4/5] jbd2: factor out journal initialization from journal_get_superblock() Zhihao Cheng
2023-03-13 11:12 ` Jan Kara
2023-03-13 12:48 ` Zhang Yi [this message]
2023-03-10 12:52 ` [PATCH 5/5] jbd2: remove j_format_version Zhihao Cheng
2023-03-13 11:13 ` 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=a1aef56e-652e-793c-3913-c083119d4b45@huawei.com \
--to=yi.zhang@huawei.com \
--cc=adilger.kernel@dilger.ca \
--cc=chengzhihao1@huawei.com \
--cc=jack@suse.com \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®