* [PATCH -next 0/2] some refactor of ext4_fc_track_inode
@ 2022-09-15 13:56 Ye Bin
2022-09-15 13:56 ` [PATCH -next 1/2] ext4: factor out ext4_fc_disabled() Ye Bin
2022-09-15 13:56 ` [PATCH -next 2/2] ext4: adjust fast commit disable judgement order in ext4_fc_track_inode Ye Bin
0 siblings, 2 replies; 7+ messages in thread
From: Ye Bin @ 2022-09-15 13:56 UTC (permalink / raw)
To: tytso, adilger.kernel, linux-ext4; +Cc: linux-kernel, jack, Ye Bin
Ye Bin (2):
ext4: factor out ext4_fc_disabled()
ext4: adjust fast commit disable judgement order in
ext4_fc_track_inode
fs/ext4/fast_commit.c | 42 +++++++++++++++++-------------------------
1 file changed, 17 insertions(+), 25 deletions(-)
--
2.31.1
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH -next 1/2] ext4: factor out ext4_fc_disabled() 2022-09-15 13:56 [PATCH -next 0/2] some refactor of ext4_fc_track_inode Ye Bin @ 2022-09-15 13:56 ` Ye Bin 2022-09-15 14:29 ` Jan Kara 2022-09-15 13:56 ` [PATCH -next 2/2] ext4: adjust fast commit disable judgement order in ext4_fc_track_inode Ye Bin 1 sibling, 1 reply; 7+ messages in thread From: Ye Bin @ 2022-09-15 13:56 UTC (permalink / raw) To: tytso, adilger.kernel, linux-ext4; +Cc: linux-kernel, jack, Ye Bin Factor out ext4_fc_disabled(). No functional change. Signed-off-by: Ye Bin <yebin10@huawei.com> --- fs/ext4/fast_commit.c | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c index b7414a5812f6..eadab945b856 100644 --- a/fs/ext4/fast_commit.c +++ b/fs/ext4/fast_commit.c @@ -229,6 +229,12 @@ __releases(&EXT4_SB(inode->i_sb)->s_fc_lock) finish_wait(wq, &wait.wq_entry); } +static bool ext4_fc_disabled(struct super_block *sb) +{ + return (!test_opt2(sb, JOURNAL_FAST_COMMIT) || + (EXT4_SB(sb)->s_mount_state & EXT4_FC_REPLAY)); +} + /* * Inform Ext4's fast about start of an inode update * @@ -240,8 +246,7 @@ void ext4_fc_start_update(struct inode *inode) { struct ext4_inode_info *ei = EXT4_I(inode); - if (!test_opt2(inode->i_sb, JOURNAL_FAST_COMMIT) || - (EXT4_SB(inode->i_sb)->s_mount_state & EXT4_FC_REPLAY)) + if (ext4_fc_disabled(inode->i_sb)) return; restart: @@ -265,8 +270,7 @@ void ext4_fc_stop_update(struct inode *inode) { struct ext4_inode_info *ei = EXT4_I(inode); - if (!test_opt2(inode->i_sb, JOURNAL_FAST_COMMIT) || - (EXT4_SB(inode->i_sb)->s_mount_state & EXT4_FC_REPLAY)) + if (ext4_fc_disabled(inode->i_sb)) return; if (atomic_dec_and_test(&ei->i_fc_updates)) @@ -283,8 +287,7 @@ void ext4_fc_del(struct inode *inode) struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); struct ext4_fc_dentry_update *fc_dentry; - if (!test_opt2(inode->i_sb, JOURNAL_FAST_COMMIT) || - (EXT4_SB(inode->i_sb)->s_mount_state & EXT4_FC_REPLAY)) + if (ext4_fc_disabled(inode->i_sb)) return; restart: @@ -337,8 +340,7 @@ void ext4_fc_mark_ineligible(struct super_block *sb, int reason, handle_t *handl struct ext4_sb_info *sbi = EXT4_SB(sb); tid_t tid; - if (!test_opt2(sb, JOURNAL_FAST_COMMIT) || - (EXT4_SB(sb)->s_mount_state & EXT4_FC_REPLAY)) + if (ext4_fc_disabled(sb)) return; ext4_set_mount_flag(sb, EXT4_MF_FC_INELIGIBLE); @@ -493,10 +495,8 @@ void __ext4_fc_track_unlink(handle_t *handle, void ext4_fc_track_unlink(handle_t *handle, struct dentry *dentry) { struct inode *inode = d_inode(dentry); - struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); - if (!test_opt2(inode->i_sb, JOURNAL_FAST_COMMIT) || - (sbi->s_mount_state & EXT4_FC_REPLAY)) + if (ext4_fc_disabled(inode->i_sb)) return; if (ext4_test_mount_flag(inode->i_sb, EXT4_MF_FC_INELIGIBLE)) @@ -522,10 +522,8 @@ void __ext4_fc_track_link(handle_t *handle, void ext4_fc_track_link(handle_t *handle, struct dentry *dentry) { struct inode *inode = d_inode(dentry); - struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); - if (!test_opt2(inode->i_sb, JOURNAL_FAST_COMMIT) || - (sbi->s_mount_state & EXT4_FC_REPLAY)) + if (ext4_fc_disabled(inode->i_sb)) return; if (ext4_test_mount_flag(inode->i_sb, EXT4_MF_FC_INELIGIBLE)) @@ -551,10 +549,8 @@ void __ext4_fc_track_create(handle_t *handle, struct inode *inode, void ext4_fc_track_create(handle_t *handle, struct dentry *dentry) { struct inode *inode = d_inode(dentry); - struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); - if (!test_opt2(inode->i_sb, JOURNAL_FAST_COMMIT) || - (sbi->s_mount_state & EXT4_FC_REPLAY)) + if (ext4_fc_disabled(inode->i_sb)) return; if (ext4_test_mount_flag(inode->i_sb, EXT4_MF_FC_INELIGIBLE)) @@ -576,7 +572,6 @@ static int __track_inode(struct inode *inode, void *arg, bool update) void ext4_fc_track_inode(handle_t *handle, struct inode *inode) { - struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); int ret; if (S_ISDIR(inode->i_mode)) @@ -588,8 +583,7 @@ void ext4_fc_track_inode(handle_t *handle, struct inode *inode) return; } - if (!test_opt2(inode->i_sb, JOURNAL_FAST_COMMIT) || - (sbi->s_mount_state & EXT4_FC_REPLAY)) + if (ext4_fc_disabled(inode->i_sb)) return; if (ext4_test_mount_flag(inode->i_sb, EXT4_MF_FC_INELIGIBLE)) @@ -634,15 +628,13 @@ static int __track_range(struct inode *inode, void *arg, bool update) void ext4_fc_track_range(handle_t *handle, struct inode *inode, ext4_lblk_t start, ext4_lblk_t end) { - struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); struct __track_range_args args; int ret; if (S_ISDIR(inode->i_mode)) return; - if (!test_opt2(inode->i_sb, JOURNAL_FAST_COMMIT) || - (sbi->s_mount_state & EXT4_FC_REPLAY)) + if (ext4_fc_disabled(inode->i_sb)) return; if (ext4_test_mount_flag(inode->i_sb, EXT4_MF_FC_INELIGIBLE)) -- 2.31.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH -next 1/2] ext4: factor out ext4_fc_disabled() 2022-09-15 13:56 ` [PATCH -next 1/2] ext4: factor out ext4_fc_disabled() Ye Bin @ 2022-09-15 14:29 ` Jan Kara 0 siblings, 0 replies; 7+ messages in thread From: Jan Kara @ 2022-09-15 14:29 UTC (permalink / raw) To: Ye Bin; +Cc: tytso, adilger.kernel, linux-ext4, linux-kernel, jack On Thu 15-09-22 21:56:10, Ye Bin wrote: > Factor out ext4_fc_disabled(). No functional change. > > Signed-off-by: Ye Bin <yebin10@huawei.com> > --- > fs/ext4/fast_commit.c | 38 +++++++++++++++----------------------- > 1 file changed, 15 insertions(+), 23 deletions(-) Nice. Feel free to add: Reviewed-by: Jan Kara <jack@suse.cz> Honza > > diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c > index b7414a5812f6..eadab945b856 100644 > --- a/fs/ext4/fast_commit.c > +++ b/fs/ext4/fast_commit.c > @@ -229,6 +229,12 @@ __releases(&EXT4_SB(inode->i_sb)->s_fc_lock) > finish_wait(wq, &wait.wq_entry); > } > > +static bool ext4_fc_disabled(struct super_block *sb) > +{ > + return (!test_opt2(sb, JOURNAL_FAST_COMMIT) || > + (EXT4_SB(sb)->s_mount_state & EXT4_FC_REPLAY)); > +} > + > /* > * Inform Ext4's fast about start of an inode update > * > @@ -240,8 +246,7 @@ void ext4_fc_start_update(struct inode *inode) > { > struct ext4_inode_info *ei = EXT4_I(inode); > > - if (!test_opt2(inode->i_sb, JOURNAL_FAST_COMMIT) || > - (EXT4_SB(inode->i_sb)->s_mount_state & EXT4_FC_REPLAY)) > + if (ext4_fc_disabled(inode->i_sb)) > return; > > restart: > @@ -265,8 +270,7 @@ void ext4_fc_stop_update(struct inode *inode) > { > struct ext4_inode_info *ei = EXT4_I(inode); > > - if (!test_opt2(inode->i_sb, JOURNAL_FAST_COMMIT) || > - (EXT4_SB(inode->i_sb)->s_mount_state & EXT4_FC_REPLAY)) > + if (ext4_fc_disabled(inode->i_sb)) > return; > > if (atomic_dec_and_test(&ei->i_fc_updates)) > @@ -283,8 +287,7 @@ void ext4_fc_del(struct inode *inode) > struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); > struct ext4_fc_dentry_update *fc_dentry; > > - if (!test_opt2(inode->i_sb, JOURNAL_FAST_COMMIT) || > - (EXT4_SB(inode->i_sb)->s_mount_state & EXT4_FC_REPLAY)) > + if (ext4_fc_disabled(inode->i_sb)) > return; > > restart: > @@ -337,8 +340,7 @@ void ext4_fc_mark_ineligible(struct super_block *sb, int reason, handle_t *handl > struct ext4_sb_info *sbi = EXT4_SB(sb); > tid_t tid; > > - if (!test_opt2(sb, JOURNAL_FAST_COMMIT) || > - (EXT4_SB(sb)->s_mount_state & EXT4_FC_REPLAY)) > + if (ext4_fc_disabled(sb)) > return; > > ext4_set_mount_flag(sb, EXT4_MF_FC_INELIGIBLE); > @@ -493,10 +495,8 @@ void __ext4_fc_track_unlink(handle_t *handle, > void ext4_fc_track_unlink(handle_t *handle, struct dentry *dentry) > { > struct inode *inode = d_inode(dentry); > - struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); > > - if (!test_opt2(inode->i_sb, JOURNAL_FAST_COMMIT) || > - (sbi->s_mount_state & EXT4_FC_REPLAY)) > + if (ext4_fc_disabled(inode->i_sb)) > return; > > if (ext4_test_mount_flag(inode->i_sb, EXT4_MF_FC_INELIGIBLE)) > @@ -522,10 +522,8 @@ void __ext4_fc_track_link(handle_t *handle, > void ext4_fc_track_link(handle_t *handle, struct dentry *dentry) > { > struct inode *inode = d_inode(dentry); > - struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); > > - if (!test_opt2(inode->i_sb, JOURNAL_FAST_COMMIT) || > - (sbi->s_mount_state & EXT4_FC_REPLAY)) > + if (ext4_fc_disabled(inode->i_sb)) > return; > > if (ext4_test_mount_flag(inode->i_sb, EXT4_MF_FC_INELIGIBLE)) > @@ -551,10 +549,8 @@ void __ext4_fc_track_create(handle_t *handle, struct inode *inode, > void ext4_fc_track_create(handle_t *handle, struct dentry *dentry) > { > struct inode *inode = d_inode(dentry); > - struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); > > - if (!test_opt2(inode->i_sb, JOURNAL_FAST_COMMIT) || > - (sbi->s_mount_state & EXT4_FC_REPLAY)) > + if (ext4_fc_disabled(inode->i_sb)) > return; > > if (ext4_test_mount_flag(inode->i_sb, EXT4_MF_FC_INELIGIBLE)) > @@ -576,7 +572,6 @@ static int __track_inode(struct inode *inode, void *arg, bool update) > > void ext4_fc_track_inode(handle_t *handle, struct inode *inode) > { > - struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); > int ret; > > if (S_ISDIR(inode->i_mode)) > @@ -588,8 +583,7 @@ void ext4_fc_track_inode(handle_t *handle, struct inode *inode) > return; > } > > - if (!test_opt2(inode->i_sb, JOURNAL_FAST_COMMIT) || > - (sbi->s_mount_state & EXT4_FC_REPLAY)) > + if (ext4_fc_disabled(inode->i_sb)) > return; > > if (ext4_test_mount_flag(inode->i_sb, EXT4_MF_FC_INELIGIBLE)) > @@ -634,15 +628,13 @@ static int __track_range(struct inode *inode, void *arg, bool update) > void ext4_fc_track_range(handle_t *handle, struct inode *inode, ext4_lblk_t start, > ext4_lblk_t end) > { > - struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); > struct __track_range_args args; > int ret; > > if (S_ISDIR(inode->i_mode)) > return; > > - if (!test_opt2(inode->i_sb, JOURNAL_FAST_COMMIT) || > - (sbi->s_mount_state & EXT4_FC_REPLAY)) > + if (ext4_fc_disabled(inode->i_sb)) > return; > > if (ext4_test_mount_flag(inode->i_sb, EXT4_MF_FC_INELIGIBLE)) > -- > 2.31.1 > -- Jan Kara <jack@suse.com> SUSE Labs, CR ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH -next 2/2] ext4: adjust fast commit disable judgement order in ext4_fc_track_inode 2022-09-15 13:56 [PATCH -next 0/2] some refactor of ext4_fc_track_inode Ye Bin 2022-09-15 13:56 ` [PATCH -next 1/2] ext4: factor out ext4_fc_disabled() Ye Bin @ 2022-09-15 13:56 ` Ye Bin 2022-09-15 14:30 ` Jan Kara 1 sibling, 1 reply; 7+ messages in thread From: Ye Bin @ 2022-09-15 13:56 UTC (permalink / raw) To: tytso, adilger.kernel, linux-ext4; +Cc: linux-kernel, jack, Ye Bin Judge filesystem if fast commit disabled before test inode's journal mode. Signed-off-by: Ye Bin <yebin10@huawei.com> --- fs/ext4/fast_commit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c index eadab945b856..9217a588afd1 100644 --- a/fs/ext4/fast_commit.c +++ b/fs/ext4/fast_commit.c @@ -577,15 +577,15 @@ void ext4_fc_track_inode(handle_t *handle, struct inode *inode) if (S_ISDIR(inode->i_mode)) return; + if (ext4_fc_disabled(inode->i_sb)) + return; + if (ext4_should_journal_data(inode)) { ext4_fc_mark_ineligible(inode->i_sb, EXT4_FC_REASON_INODE_JOURNAL_DATA, handle); return; } - if (ext4_fc_disabled(inode->i_sb)) - return; - if (ext4_test_mount_flag(inode->i_sb, EXT4_MF_FC_INELIGIBLE)) return; -- 2.31.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH -next 2/2] ext4: adjust fast commit disable judgement order in ext4_fc_track_inode 2022-09-15 13:56 ` [PATCH -next 2/2] ext4: adjust fast commit disable judgement order in ext4_fc_track_inode Ye Bin @ 2022-09-15 14:30 ` Jan Kara 2022-09-15 14:42 ` yebin 0 siblings, 1 reply; 7+ messages in thread From: Jan Kara @ 2022-09-15 14:30 UTC (permalink / raw) To: Ye Bin; +Cc: tytso, adilger.kernel, linux-ext4, linux-kernel, jack On Thu 15-09-22 21:56:11, Ye Bin wrote: > Judge filesystem if fast commit disabled before test inode's journal mode. > > Signed-off-by: Ye Bin <yebin10@huawei.com> Probably makes sense but is there any particular reason why you do this? Honza > --- > fs/ext4/fast_commit.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c > index eadab945b856..9217a588afd1 100644 > --- a/fs/ext4/fast_commit.c > +++ b/fs/ext4/fast_commit.c > @@ -577,15 +577,15 @@ void ext4_fc_track_inode(handle_t *handle, struct inode *inode) > if (S_ISDIR(inode->i_mode)) > return; > > + if (ext4_fc_disabled(inode->i_sb)) > + return; > + > if (ext4_should_journal_data(inode)) { > ext4_fc_mark_ineligible(inode->i_sb, > EXT4_FC_REASON_INODE_JOURNAL_DATA, handle); > return; > } > > - if (ext4_fc_disabled(inode->i_sb)) > - return; > - > if (ext4_test_mount_flag(inode->i_sb, EXT4_MF_FC_INELIGIBLE)) > return; > > -- > 2.31.1 > -- Jan Kara <jack@suse.com> SUSE Labs, CR ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH -next 2/2] ext4: adjust fast commit disable judgement order in ext4_fc_track_inode 2022-09-15 14:30 ` Jan Kara @ 2022-09-15 14:42 ` yebin 2022-09-15 14:51 ` Jan Kara 0 siblings, 1 reply; 7+ messages in thread From: yebin @ 2022-09-15 14:42 UTC (permalink / raw) To: Jan Kara; +Cc: tytso, adilger.kernel, linux-ext4, linux-kernel On 2022/9/15 22:30, Jan Kara wrote: > On Thu 15-09-22 21:56:11, Ye Bin wrote: >> Judge filesystem if fast commit disabled before test inode's journal mode. >> >> Signed-off-by: Ye Bin <yebin10@huawei.com> > Probably makes sense but is there any particular reason why you do this? > > Honza I think the impact of fast commit on normal processes should be minimized. > >> --- >> fs/ext4/fast_commit.c | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c >> index eadab945b856..9217a588afd1 100644 >> --- a/fs/ext4/fast_commit.c >> +++ b/fs/ext4/fast_commit.c >> @@ -577,15 +577,15 @@ void ext4_fc_track_inode(handle_t *handle, struct inode *inode) >> if (S_ISDIR(inode->i_mode)) >> return; >> >> + if (ext4_fc_disabled(inode->i_sb)) >> + return; >> + >> if (ext4_should_journal_data(inode)) { >> ext4_fc_mark_ineligible(inode->i_sb, >> EXT4_FC_REASON_INODE_JOURNAL_DATA, handle); >> return; >> } >> >> - if (ext4_fc_disabled(inode->i_sb)) >> - return; >> - >> if (ext4_test_mount_flag(inode->i_sb, EXT4_MF_FC_INELIGIBLE)) >> return; >> >> -- >> 2.31.1 >> ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH -next 2/2] ext4: adjust fast commit disable judgement order in ext4_fc_track_inode 2022-09-15 14:42 ` yebin @ 2022-09-15 14:51 ` Jan Kara 0 siblings, 0 replies; 7+ messages in thread From: Jan Kara @ 2022-09-15 14:51 UTC (permalink / raw) To: yebin; +Cc: Jan Kara, tytso, adilger.kernel, linux-ext4, linux-kernel On Thu 15-09-22 22:42:58, yebin wrote: > > > On 2022/9/15 22:30, Jan Kara wrote: > > On Thu 15-09-22 21:56:11, Ye Bin wrote: > > > Judge filesystem if fast commit disabled before test inode's journal mode. > > > > > > Signed-off-by: Ye Bin <yebin10@huawei.com> > > Probably makes sense but is there any particular reason why you do this? > > > > Honza > > I think the impact of fast commit on normal processes should be minimized. Yeah, I guess you mean when fastcommit is actually disabled. Makes sense but please add it to the changelog. With that feel free to add: Reviewed-by: Jan Kara <jack@suse.cz> Honza > > > > > > --- > > > fs/ext4/fast_commit.c | 6 +++--- > > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > > > diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c > > > index eadab945b856..9217a588afd1 100644 > > > --- a/fs/ext4/fast_commit.c > > > +++ b/fs/ext4/fast_commit.c > > > @@ -577,15 +577,15 @@ void ext4_fc_track_inode(handle_t *handle, struct inode *inode) > > > if (S_ISDIR(inode->i_mode)) > > > return; > > > + if (ext4_fc_disabled(inode->i_sb)) > > > + return; > > > + > > > if (ext4_should_journal_data(inode)) { > > > ext4_fc_mark_ineligible(inode->i_sb, > > > EXT4_FC_REASON_INODE_JOURNAL_DATA, handle); > > > return; > > > } > > > - if (ext4_fc_disabled(inode->i_sb)) > > > - return; > > > - > > > if (ext4_test_mount_flag(inode->i_sb, EXT4_MF_FC_INELIGIBLE)) > > > return; > > > -- > > > 2.31.1 > > > > -- Jan Kara <jack@suse.com> SUSE Labs, CR ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-09-15 14:51 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-09-15 13:56 [PATCH -next 0/2] some refactor of ext4_fc_track_inode Ye Bin 2022-09-15 13:56 ` [PATCH -next 1/2] ext4: factor out ext4_fc_disabled() Ye Bin 2022-09-15 14:29 ` Jan Kara 2022-09-15 13:56 ` [PATCH -next 2/2] ext4: adjust fast commit disable judgement order in ext4_fc_track_inode Ye Bin 2022-09-15 14:30 ` Jan Kara 2022-09-15 14:42 ` yebin 2022-09-15 14:51 ` Jan Kara
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox