Skip to content

Commit 1ceecb5

Browse files
harshadjstytso
authored andcommitted
ext4: fix inode dirty check in case of fast commits
In case of fast commits, determine if the inode is dirty by checking if the inode is on fast commit list. This also helps us get rid of ext4_inode_info.i_fc_committed_subtid field. Reported-by: Andrea Righi <andrea.righi@canonical.com> Tested-by: Andrea Righi <andrea.righi@canonical.com> Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com> Link: https://lore.kernel.org/r/20201106035911.1942128-18-harshadshirwadkar@gmail.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
1 parent a3114fe commit 1ceecb5

3 files changed

Lines changed: 1 addition & 8 deletions

File tree

fs/ext4/ext4.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,9 +1028,6 @@ struct ext4_inode_info {
10281028
* protected by sbi->s_fc_lock.
10291029
*/
10301030

1031-
/* Fast commit subtid when this inode was committed */
1032-
unsigned int i_fc_committed_subtid;
1033-
10341031
/* Start of lblk range that needs to be committed in this fast commit */
10351032
ext4_lblk_t i_fc_lblk_start;
10361033

fs/ext4/fast_commit.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ void ext4_fc_init_inode(struct inode *inode)
152152
INIT_LIST_HEAD(&ei->i_fc_list);
153153
init_waitqueue_head(&ei->i_fc_wait);
154154
atomic_set(&ei->i_fc_updates, 0);
155-
ei->i_fc_committed_subtid = 0;
156155
}
157156

158157
/* This function must be called with sbi->s_fc_lock held. */
@@ -1037,8 +1036,6 @@ static int ext4_fc_perform_commit(journal_t *journal)
10371036
if (ret)
10381037
goto out;
10391038
spin_lock(&sbi->s_fc_lock);
1040-
EXT4_I(inode)->i_fc_committed_subtid =
1041-
atomic_read(&sbi->s_fc_subtid);
10421039
}
10431040
spin_unlock(&sbi->s_fc_lock);
10441041

fs/ext4/inode.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3312,8 +3312,7 @@ static bool ext4_inode_datasync_dirty(struct inode *inode)
33123312
EXT4_I(inode)->i_datasync_tid))
33133313
return false;
33143314
if (test_opt2(inode->i_sb, JOURNAL_FAST_COMMIT))
3315-
return atomic_read(&EXT4_SB(inode->i_sb)->s_fc_subtid) <
3316-
EXT4_I(inode)->i_fc_committed_subtid;
3315+
return !list_empty(&EXT4_I(inode)->i_fc_list);
33173316
return true;
33183317
}
33193318

0 commit comments

Comments
 (0)