public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Ted Tso <tytso@mit.edu>
Cc: <linux-ext4@vger.kernel.org>, Jan Kara <jack@suse.cz>
Subject: [PATCH 09/13] ext4: Drop special handling of journalled data from ext4_evict_inode()
Date: Wed, 29 Mar 2023 17:49:40 +0200	[thread overview]
Message-ID: <20230329154950.19720-9-jack@suse.cz> (raw)
In-Reply-To: <20230329125740.4127-1-jack@suse.cz>

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>
---
 fs/ext4/inode.c | 27 ---------------------------
 1 file changed, 27 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 3ab2d56b6840..94bfb12aaa9e 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -179,33 +179,6 @@ void ext4_evict_inode(struct inode *inode)
 	if (EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)
 		ext4_evict_ea_inode(inode);
 	if (inode->i_nlink) {
-		/*
-		 * When journalling data dirty buffers are tracked only in the
-		 * journal. So although mm thinks everything is clean and
-		 * ready for reaping the inode might still have some pages to
-		 * write in the running transaction or waiting to be
-		 * checkpointed. Thus calling jbd2_journal_invalidate_folio()
-		 * (via truncate_inode_pages()) to discard these buffers can
-		 * cause data loss. Also even if we did not discard these
-		 * buffers, we would have no way to find them after the inode
-		 * is reaped and thus user could see stale data if he tries to
-		 * read them before the transaction is checkpointed. So be
-		 * careful and force everything to disk here... We use
-		 * ei->i_datasync_tid to store the newest transaction
-		 * containing inode's data.
-		 *
-		 * Note that directories do not have this problem because they
-		 * don't use page cache.
-		 */
-		if (inode->i_ino != EXT4_JOURNAL_INO &&
-		    ext4_should_journal_data(inode) &&
-		    S_ISREG(inode->i_mode) && inode->i_data.nrpages) {
-			journal_t *journal = EXT4_SB(inode->i_sb)->s_journal;
-			tid_t commit_tid = EXT4_I(inode)->i_datasync_tid;
-
-			jbd2_complete_transaction(journal, commit_tid);
-			filemap_write_and_wait(&inode->i_data);
-		}
 		truncate_inode_pages_final(&inode->i_data);
 
 		goto no_delete;
-- 
2.35.3


  parent reply	other threads:[~2023-03-29 15:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-29 15:49 [PATCH 0/13 v1] ext4: Make ext4_writepages() write all journalled data Jan Kara
2023-03-29 15:49 ` [PATCH 01/13] jdb2: Don't refuse invalidation of already invalidated buffers Jan Kara
2023-03-29 15:49 ` [PATCH 02/13] ext4: Mark pages with journalled data dirty Jan Kara
2023-03-29 15:49 ` [PATCH 03/13] ext4: Keep " Jan Kara
2023-03-29 15:49 ` [PATCH 04/13] ext4: Clear dirty bit from pages without data to write Jan Kara
2023-03-29 15:49 ` [PATCH 05/13] ext4: Commit transaction before writing back pages in data=journal mode Jan Kara
2023-03-29 15:49 ` [PATCH 06/13] ext4: Drop special handling of journalled data from ext4_sync_file() Jan Kara
2023-03-30  0:05   ` Christoph Hellwig
2023-03-30  8:21     ` Jan Kara
2023-03-29 15:49 ` [PATCH 07/13] ext4: Drop special handling of journalled data from extent shifting operations Jan Kara
2023-03-29 15:49 ` [PATCH 08/13] ext4: Fix special handling of journalled data from extent zeroing Jan Kara
2023-03-29 15:49 ` Jan Kara [this message]
2023-03-29 15:49 ` [PATCH 10/13] ext4: Drop special handling of journalled data from ext4_quota_on() Jan Kara
2023-03-29 15:49 ` [PATCH 11/13] ext4: Simplify handling of journalled data in ext4_bmap() Jan Kara
2023-03-29 15:49 ` [PATCH 12/13] ext4: Update comment in mpage_prepare_extent_to_map() Jan Kara
2023-03-29 15:49 ` [PATCH 13/13] Revert "ext4: Fix warnings when freezing filesystem with journaled data" Jan Kara
2023-04-15  3:07 ` [PATCH 0/13 v1] ext4: Make ext4_writepages() write all journalled data Theodore Ts'o

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=20230329154950.19720-9-jack@suse.cz \
    --to=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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