mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zeng Heng <zengheng4@huawei.com>
To: <djwong@kernel.org>, <dchinner@redhat.com>
Cc: <chandan.babu@oracle.com>, <linux-xfs@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <zengheng4@huawei.com>,
	<weiyongjun1@huawei.com>, <guoxuenan@huawei.com>
Subject: [PATCH -next] xfs: rmap: only XFS_DATA_FORK field would be set shared
Date: Tue, 6 Sep 2022 17:35:54 +0800	[thread overview]
Message-ID: <20220906093554.899222-1-zengheng4@huawei.com> (raw)

whichfork could be one of the following 3 types:
XFS_DATA_FORK
XFS_ATTR_FORK
XFS_COW_FORK

XFS_COW_FORK is in-memory field instead of on-disk
field, which doesn't need to update in rmap_btree
(already preclude by `xfs_rmap_update_is_needed` ahead).

XFS_ATTR_FORK field doesn't support reflink share.

So here propose to set "whichfork == XFS_DATA_FORK"
as condition.

Signed-off-by: Zeng Heng <zengheng4@huawei.com>
---
 fs/xfs/libxfs/xfs_rmap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/xfs/libxfs/xfs_rmap.c b/fs/xfs/libxfs/xfs_rmap.c
index 094dfc897ebc..74b34a331cf0 100644
--- a/fs/xfs/libxfs/xfs_rmap.c
+++ b/fs/xfs/libxfs/xfs_rmap.c
@@ -2549,7 +2549,7 @@ xfs_rmap_map_extent(
 	if (!xfs_rmap_update_is_needed(tp->t_mountp, whichfork))
 		return;
 
-	if (whichfork != XFS_ATTR_FORK && xfs_is_reflink_inode(ip))
+	if (whichfork == XFS_DATA_FORK && xfs_is_reflink_inode(ip))
 		type = XFS_RMAP_MAP_SHARED;
 
 	__xfs_rmap_add(tp, type, ip->i_ino, whichfork, PREV);
@@ -2568,7 +2568,7 @@ xfs_rmap_unmap_extent(
 	if (!xfs_rmap_update_is_needed(tp->t_mountp, whichfork))
 		return;
 
-	if (whichfork != XFS_ATTR_FORK && xfs_is_reflink_inode(ip))
+	if (whichfork == XFS_DATA_FORK && xfs_is_reflink_inode(ip))
 		type = XFS_RMAP_UNMAP_SHARED;
 
 	__xfs_rmap_add(tp, type, ip->i_ino, whichfork, PREV);
@@ -2593,7 +2593,7 @@ xfs_rmap_convert_extent(
 	if (!xfs_rmap_update_is_needed(mp, whichfork))
 		return;
 
-	if (whichfork != XFS_ATTR_FORK && xfs_is_reflink_inode(ip))
+	if (whichfork == XFS_DATA_FORK && xfs_is_reflink_inode(ip))
 		type = XFS_RMAP_CONVERT_SHARED;
 
 	__xfs_rmap_add(tp, type, ip->i_ino, whichfork, PREV);
-- 
2.25.1


             reply	other threads:[~2022-09-06  9:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06  9:35 Zeng Heng [this message]
2022-09-07 14:55 ` Darrick J. Wong

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=20220906093554.899222-1-zengheng4@huawei.com \
    --to=zengheng4@huawei.com \
    --cc=chandan.babu@oracle.com \
    --cc=dchinner@redhat.com \
    --cc=djwong@kernel.org \
    --cc=guoxuenan@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=weiyongjun1@huawei.com \
    /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

all inboxes | Powered by JetHome®