diff options
author | Yongqiang Yang <xiaoqiangnk@gmail.com> | 2011-12-28 13:55:51 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-12-28 13:55:51 -0500 |
commit | 5872ddaaf05bf25e3ab90580295ebc946405928c (patch) | |
tree | 6dacee8fbc61ae67e9853edfdcddc8b9bc788b00 /fs/ext4 | |
parent | 2aff57b0c052344e8401a8b4a33c2a1ecb0f627c (diff) |
ext4: flush journal when switching from data=journal mode
It's necessary to flush the journal when switching away from
data=journal mode. This is because there are no revoke records when
data blocks are journalled, but revoke records are required in the
other journal modes.
However, it is not necessary to flush the journal when switching into
data=journal mode, and flushing the journal is expensive. So let's
avoid it in that case.
Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/inode.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index cb0ba9d77a8e..1254934de693 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -4660,7 +4660,6 @@ int ext4_change_inode_journal_flag(struct inode *inode, int val) | |||
4660 | } | 4660 | } |
4661 | 4661 | ||
4662 | jbd2_journal_lock_updates(journal); | 4662 | jbd2_journal_lock_updates(journal); |
4663 | jbd2_journal_flush(journal); | ||
4664 | 4663 | ||
4665 | /* | 4664 | /* |
4666 | * OK, there are no updates running now, and all cached data is | 4665 | * OK, there are no updates running now, and all cached data is |
@@ -4672,8 +4671,10 @@ int ext4_change_inode_journal_flag(struct inode *inode, int val) | |||
4672 | 4671 | ||
4673 | if (val) | 4672 | if (val) |
4674 | ext4_set_inode_flag(inode, EXT4_INODE_JOURNAL_DATA); | 4673 | ext4_set_inode_flag(inode, EXT4_INODE_JOURNAL_DATA); |
4675 | else | 4674 | else { |
4675 | jbd2_journal_flush(journal); | ||
4676 | ext4_clear_inode_flag(inode, EXT4_INODE_JOURNAL_DATA); | 4676 | ext4_clear_inode_flag(inode, EXT4_INODE_JOURNAL_DATA); |
4677 | } | ||
4677 | ext4_set_aops(inode); | 4678 | ext4_set_aops(inode); |
4678 | 4679 | ||
4679 | jbd2_journal_unlock_updates(journal); | 4680 | jbd2_journal_unlock_updates(journal); |