Skip to content

Commit 56c2a0e

Browse files
jankaratytso
authored andcommitted
ext4: Drop special handling of journalled data from ext4_evict_inode()
Now that ext4_writepages() makes sure journalled data is on stable storage, write_inode_now() call in iput_final() is enough to make pagecache pages with journalled data really clean (data committed and checkpointed). So we can drop special handling of journalled data in ext4_evict_inode(). Signed-off-by: Jan Kara <jack@suse.cz> Link: https://lore.kernel.org/r/20230329154950.19720-9-jack@suse.cz Signed-off-by: Theodore Ts'o <tytso@mit.edu>
1 parent 783ae44 commit 56c2a0e

1 file changed

Lines changed: 0 additions & 27 deletions

File tree

fs/ext4/inode.c

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -179,33 +179,6 @@ void ext4_evict_inode(struct inode *inode)
179179
if (EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)
180180
ext4_evict_ea_inode(inode);
181181
if (inode->i_nlink) {
182-
/*
183-
* When journalling data dirty buffers are tracked only in the
184-
* journal. So although mm thinks everything is clean and
185-
* ready for reaping the inode might still have some pages to
186-
* write in the running transaction or waiting to be
187-
* checkpointed. Thus calling jbd2_journal_invalidate_folio()
188-
* (via truncate_inode_pages()) to discard these buffers can
189-
* cause data loss. Also even if we did not discard these
190-
* buffers, we would have no way to find them after the inode
191-
* is reaped and thus user could see stale data if he tries to
192-
* read them before the transaction is checkpointed. So be
193-
* careful and force everything to disk here... We use
194-
* ei->i_datasync_tid to store the newest transaction
195-
* containing inode's data.
196-
*
197-
* Note that directories do not have this problem because they
198-
* don't use page cache.
199-
*/
200-
if (inode->i_ino != EXT4_JOURNAL_INO &&
201-
ext4_should_journal_data(inode) &&
202-
S_ISREG(inode->i_mode) && inode->i_data.nrpages) {
203-
journal_t *journal = EXT4_SB(inode->i_sb)->s_journal;
204-
tid_t commit_tid = EXT4_I(inode)->i_datasync_tid;
205-
206-
jbd2_complete_transaction(journal, commit_tid);
207-
filemap_write_and_wait(&inode->i_data);
208-
}
209182
truncate_inode_pages_final(&inode->i_data);
210183

211184
goto no_delete;

0 commit comments

Comments
 (0)