All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: remove no longer needed full sync flag check at inode_logged()
@ 2021-07-29 14:29 fdmanana
  2021-07-29 17:30 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: fdmanana @ 2021-07-29 14:29 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

Now that we are checking if the inode's logged_trans is 0 to detect the
possibility of the inode having been evicted and reloaded, the test for
the full sync flag (BTRFS_INODE_NEEDS_FULL_SYNC) is no longer needed at
tree-log.c:inode_logged(). Its purpose was to detect the possibility
of a previous eviction as well, since when an inode is loaded the full
sync flag is always set on it (and only cleared after the inode is
logged).

So just remove the check and update the comment. The check for the inode's
logged_trans being 0 was added recently by the patch with the subject
"btrfs: eliminate some false positives when checking if inode was logged".

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/tree-log.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 4de3f78c579b..d2039743ecf2 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3435,16 +3435,14 @@ static bool inode_logged(struct btrfs_trans_handle *trans,
 	/*
 	 * The inode's logged_trans is always 0 when we load it (because it is
 	 * not persisted in the inode item or elsewhere). So if it is 0, the
-	 * inode was last modified in the current transaction and has the
-	 * full_sync flag set, then the inode may have been logged before in
-	 * the current transaction, then evicted and loaded again in the current
-	 * transaction - or may have never been logged in the current transaction,
-	 * but since we can not be sure, we have to assume it was, otherwise our
-	 * callers can leave an inconsistent log.
+	 * inode was last modified in the current transaction then the inode may
+	 * have been logged before in the current transaction, then evicted and
+	 * loaded again in the current transaction - or may have never been logged
+	 * in the current transaction, but since we can not be sure, we have to
+	 * assume it was, otherwise our callers can leave an inconsistent log.
 	 */
 	if (inode->logged_trans == 0 &&
 	    inode->last_trans == trans->transid &&
-	    test_bit(BTRFS_INODE_NEEDS_FULL_SYNC, &inode->runtime_flags) &&
 	    !test_bit(BTRFS_FS_LOG_RECOVERING, &trans->fs_info->flags))
 		return true;
 
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] btrfs: remove no longer needed full sync flag check at inode_logged()
  2021-07-29 14:29 [PATCH] btrfs: remove no longer needed full sync flag check at inode_logged() fdmanana
@ 2021-07-29 17:30 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2021-07-29 17:30 UTC (permalink / raw)
  To: fdmanana; +Cc: linux-btrfs

On Thu, Jul 29, 2021 at 03:29:01PM +0100, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> Now that we are checking if the inode's logged_trans is 0 to detect the
> possibility of the inode having been evicted and reloaded, the test for
> the full sync flag (BTRFS_INODE_NEEDS_FULL_SYNC) is no longer needed at
> tree-log.c:inode_logged(). Its purpose was to detect the possibility
> of a previous eviction as well, since when an inode is loaded the full
> sync flag is always set on it (and only cleared after the inode is
> logged).
> 
> So just remove the check and update the comment. The check for the inode's
> logged_trans being 0 was added recently by the patch with the subject
> "btrfs: eliminate some false positives when checking if inode was logged".
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Added to misc-next, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-29 17:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-29 14:29 [PATCH] btrfs: remove no longer needed full sync flag check at inode_logged() fdmanana
2021-07-29 17:30 ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.