xfs: rmap: only XFS_DATA_FORK field would be set shared
PATCH 1/1 xfs: rmap: only XFS_DATA_FORK field would be set shared
whichfork could be one of the following 3 types:XFS_DATA_FORKXFS_ATTR_FORKXFS_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.
--- fs/xfs/libxfs/xfs_rmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/xfs/libxfs/xfs_rmap.c +3 -3
@@ -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 );
Signature · 1 line
2.25.1
Quoted 5 lines · Zeng Heng
whichfork could be one of the following 3 types:
XFS_DATA_FORKXFS_ATTR_FORKXFS_COW_FORK
Quoted 8 lines
XFS_COW_FORKis in-memory field instead of on-disk field, which doesn't need to update inrmap_btree(already preclude byxfs_rmap_update_is_neededahead).
XFS_ATTR_FORKfield 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
Quoted 40 lines
Signed-off-by Zeng Heng <[email protected]>--- fs/xfs/libxfs/xfs_rmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)fs/xfs/libxfs/xfs_rmap.c +3
-3@@ -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 );Signature · 1 line
2.25.1