From: Baokun Li <libaokun1@huawei.com>
To: Jan Kara <jack@suse.cz>
Cc: <linux-ext4@vger.kernel.org>, <tytso@mit.edu>,
<adilger.kernel@dilger.ca>, <linux-kernel@vger.kernel.org>,
<yi.zhang@huawei.com>, <yangerkun@huawei.com>,
Baokun Li <libaokun1@huawei.com>,
Baokun Li <libaokun@huaweicloud.com>
Subject: Re: [PATCH v2 4/8] ext4: extract ext4_check_nojournal_options() from __ext4_fill_super()
Date: Tue, 21 Jan 2025 19:22:45 +0800 [thread overview]
Message-ID: <d04d3ab5-84d9-4c15-a774-d9cf631e5b37@huawei.com> (raw)
In-Reply-To: <nv5selt2rw3rn2f2hfk7doejpjj2tir4mho4i4fnwrj5mqqwru@bqmdwvefw4lh>
On 2025/1/21 19:04, Jan Kara wrote:
> On Tue 21-01-25 15:10:46, libaokun@huaweicloud.com wrote:
>> From: Baokun Li <libaokun1@huawei.com>
>>
>> Extract the ext4_check_nojournal_options() helper function to reduce code
>> duplication. No functional changes.
>>
>> Signed-off-by: Baokun Li <libaokun1@huawei.com>
>> Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
> Looks good. Just a small naming suggestion:
>
>> +static const char *ext4_check_nojournal_options(struct super_block *sb)
> I'd call this ext4_has_journal_option() to make it somewhat more obvious
> what we are checking. Otherwise feel free to add:
>
> Reviewed-by: Jan Kara <jack@suse.cz>
>
> Honza
Awesome, this function name is much better and makes more sense.
I'll use it in the next version. Naming is really hard! 😅
Thanks a lot for the review!
Cheers,
Baokun
>
>> +{
>> + struct ext4_sb_info *sbi = EXT4_SB(sb);
>> +
>> + if (test_opt(sb, JOURNAL_ASYNC_COMMIT))
>> + return "journal_async_commit";
>> + if (test_opt2(sb, EXPLICIT_JOURNAL_CHECKSUM))
>> + return "journal_checksum";
>> + if (sbi->s_commit_interval != JBD2_DEFAULT_MAX_COMMIT_AGE*HZ)
>> + return "commit=";
>> + if (EXT4_MOUNT_DATA_FLAGS &
>> + (sbi->s_mount_opt ^ sbi->s_def_mount_opt))
>> + return "data=";
>> + if (test_opt(sb, DATA_ERR_ABORT))
>> + return "data_err=abort";
>> + return NULL;
>> +}
>> +
>> static int ext4_load_super(struct super_block *sb, ext4_fsblk_t *lsb,
>> int silent)
>> {
>> @@ -5411,35 +5429,17 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
>> "suppressed and not mounted read-only");
>> goto failed_mount3a;
>> } else {
>> - /* Nojournal mode, all journal mount options are illegal */
>> - if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) {
>> - ext4_msg(sb, KERN_ERR, "can't mount with "
>> - "journal_async_commit, fs mounted w/o journal");
>> - goto failed_mount3a;
>> - }
>> + const char *journal_option;
>>
>> - if (test_opt2(sb, EXPLICIT_JOURNAL_CHECKSUM)) {
>> - ext4_msg(sb, KERN_ERR, "can't mount with "
>> - "journal_checksum, fs mounted w/o journal");
>> - goto failed_mount3a;
>> - }
>> - if (sbi->s_commit_interval != JBD2_DEFAULT_MAX_COMMIT_AGE*HZ) {
>> - ext4_msg(sb, KERN_ERR, "can't mount with "
>> - "commit=%lu, fs mounted w/o journal",
>> - sbi->s_commit_interval / HZ);
>> - goto failed_mount3a;
>> - }
>> - if (EXT4_MOUNT_DATA_FLAGS &
>> - (sbi->s_mount_opt ^ sbi->s_def_mount_opt)) {
>> - ext4_msg(sb, KERN_ERR, "can't mount with "
>> - "data=, fs mounted w/o journal");
>> - goto failed_mount3a;
>> - }
>> - if (test_opt(sb, DATA_ERR_ABORT)) {
>> + /* Nojournal mode, all journal mount options are illegal */
>> + journal_option = ext4_check_nojournal_options(sb);
>> + if (journal_option != NULL) {
>> ext4_msg(sb, KERN_ERR,
>> - "can't mount with data_err=abort, fs mounted w/o journal");
>> + "can't mount with %s, fs mounted w/o journal",
>> + journal_option);
>> goto failed_mount3a;
>> }
>> +
>> sbi->s_def_mount_opt &= ~EXT4_MOUNT_JOURNAL_CHECKSUM;
>> clear_opt(sb, JOURNAL_CHECKSUM);
>> clear_opt(sb, DATA_FLAGS);
>> --
>> 2.39.2
>>
next prev parent reply other threads:[~2025-01-21 11:22 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-21 7:10 [PATCH v2 0/8] ext4: fix issues caused by data write-back failures libaokun
2025-01-21 7:10 ` [PATCH v2 1/8] ext4: replace opencoded ext4_end_io_end() in ext4_put_io_end() libaokun
2025-01-21 7:10 ` [PATCH v2 2/8] ext4: do not convert the unwritten extents if data writeback fails libaokun
2025-01-21 7:10 ` [PATCH v2 3/8] ext4: reject the 'data_err=abort' option in nojournal mode libaokun
2025-01-21 11:37 ` Jan Kara
2025-01-21 12:11 ` Baokun Li
2025-01-21 7:10 ` [PATCH v2 4/8] ext4: extract ext4_check_nojournal_options() from __ext4_fill_super() libaokun
2025-01-21 11:04 ` Jan Kara
2025-01-21 11:22 ` Baokun Li [this message]
2025-01-21 7:10 ` [PATCH v2 5/8] ext4: abort journal on data writeback failure if in data_err=abort mode libaokun
2025-01-21 11:13 ` Jan Kara
2025-01-21 11:43 ` Baokun Li
2025-01-21 7:10 ` [PATCH v2 6/8] ext4: update the descriptions of data_err=abort and data_err=ignore libaokun
2025-01-21 11:14 ` Jan Kara
2025-01-21 7:10 ` [PATCH v2 7/8] ext4: remove unused member 'i_unwritten' from 'ext4_inode_info' libaokun
2025-01-21 7:10 ` [PATCH v2 8/8] ext4: pack holes in ext4_inode_info libaokun
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=d04d3ab5-84d9-4c15-a774-d9cf631e5b37@huawei.com \
--to=libaokun1@huawei.com \
--cc=adilger.kernel@dilger.ca \
--cc=jack@suse.cz \
--cc=libaokun@huaweicloud.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
/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®