lkml.org 
[lkml]   [2022]   [Sep]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH -next] xfs: rmap: only XFS_DATA_FORK field would be set shared
Date
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
\
 
 \ /
  Last update: 2022-09-06 11:30    [W:0.091 / U:0.472 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site