linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] xfs: rmap: only XFS_DATA_FORK field would be set shared
@ 2022-09-06  9:35 Zeng Heng
  2022-09-07 14:55 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Zeng Heng @ 2022-09-06  9:35 UTC (permalink / raw)
  To: djwong, dchinner
  Cc: chandan.babu, linux-xfs, linux-kernel, zengheng4, weiyongjun1,
	guoxuenan

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


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

* Re: [PATCH -next] xfs: rmap: only XFS_DATA_FORK field would be set shared
  2022-09-06  9:35 [PATCH -next] xfs: rmap: only XFS_DATA_FORK field would be set shared Zeng Heng
@ 2022-09-07 14:55 ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2022-09-07 14:55 UTC (permalink / raw)
  To: Zeng Heng
  Cc: dchinner, chandan.babu, linux-xfs, linux-kernel, weiyongjun1,
	guoxuenan

On Tue, Sep 06, 2022 at 05:35:54PM +0800, Zeng Heng wrote:
> 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.

As you already state, xfs_rmap_update_is_needed() filters out
whichfork==XFS_COW_FORK.  Why is this change necessary?  It looks like
pointless churn to me.

--D

> 
> 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
> 

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

end of thread, other threads:[~2022-09-07 14:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-06  9:35 [PATCH -next] xfs: rmap: only XFS_DATA_FORK field would be set shared Zeng Heng
2022-09-07 14:55 ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).