Skip to contentSkip to conversation

linux-next: manual merge of the vfs tree with the xfs tree

DISCUSSION Stephen Rothwell 2 participants 2 messages Apr 19, 2021 – Apr 20, 2021 Linux-next tree

lore
Share & tools
lore
#0 lore raw

Hi all,

Today's linux-next merge of the vfs tree got a conflict in:

fs/xfs/xfs_ioctl.c

between commit:

b2197a36c0ef ("xfs: remove XFS_IFEXTENTS")

from the xfs tree and commit:

9fefd5db08ce ("xfs: convert to fileattr")

from the vfs tree.

I fixed it up (see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.

Signature · 91 lines
Cheers,
Stephen Rothwell

diff --cc fs/xfs/xfs_ioctl.c
index bf490bfae6cb,bbda105a2ce5..000000000000
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@@ -1056,77 -1057,17 +1057,19 @@@ xfs_ioc_ag_geometry
  static void
  xfs_fill_fsxattr(
  	struct xfs_inode	*ip,
- 	bool			attr,
- 	struct fsxattr		*fa)
+ 	int			whichfork,
+ 	struct fileattr		*fa)
  {
 +	struct xfs_mount	*mp = ip->i_mount;
- 	struct xfs_ifork	*ifp = attr ? ip->i_afp : &ip->i_df;
+ 	struct xfs_ifork	*ifp = XFS_IFORK_PTR(ip, whichfork);
  
- 	simple_fill_fsxattr(fa, xfs_ip2xflags(ip));
+ 	fileattr_fill_xflags(fa, xfs_ip2xflags(ip));
 -	fa->fsx_extsize = ip->i_d.di_extsize << ip->i_mount->m_sb.sb_blocklog;
 -	fa->fsx_cowextsize = ip->i_d.di_cowextsize <<
 -			ip->i_mount->m_sb.sb_blocklog;
 -	fa->fsx_projid = ip->i_d.di_projid;
 -	if (ifp && (ifp->if_flags & XFS_IFEXTENTS))
 +
 +	fa->fsx_extsize = XFS_FSB_TO_B(mp, ip->i_extsize);
 +	if (ip->i_diflags2 & XFS_DIFLAG2_COWEXTSIZE)
 +		fa->fsx_cowextsize = XFS_FSB_TO_B(mp, ip->i_cowextsize);
 +	fa->fsx_projid = ip->i_projid;
 +	if (ifp && !xfs_need_iread_extents(ifp))
  		fa->fsx_nextents = xfs_iext_count(ifp);
  	else
  		fa->fsx_nextents = xfs_ifork_nextents(ifp);
@@@ -1212,10 -1167,10 +1169,10 @@@ static in
  xfs_ioctl_setattr_xflags(
  	struct xfs_trans	*tp,
  	struct xfs_inode	*ip,
- 	struct fsxattr		*fa)
+ 	struct fileattr		*fa)
  {
  	struct xfs_mount	*mp = ip->i_mount;
 -	uint64_t		di_flags2;
 +	uint64_t		i_flags2;
  
  	/* Can't change realtime flag if any extents are allocated. */
  	if ((ip->i_df.if_nextents || ip->i_delayed_blks) &&
@@@ -1348,8 -1289,11 +1291,11 @@@ xfs_ioctl_setattr_check_extsize
  	xfs_extlen_t		size;
  	xfs_fsblock_t		extsize_fsb;
  
+ 	if (!fa->fsx_valid)
+ 		return 0;
+ 
  	if (S_ISREG(VFS_I(ip)->i_mode) && ip->i_df.if_nextents &&
 -	    ((ip->i_d.di_extsize << mp->m_sb.sb_blocklog) != fa->fsx_extsize))
 +	    ((ip->i_extsize << mp->m_sb.sb_blocklog) != fa->fsx_extsize))
  		return -EINVAL;
  
  	if (fa->fsx_extsize == 0)
@@@ -1520,18 -1476,18 +1478,19 @@@ xfs_fileattr_set
  	 * extent size hint should be set on the inode. If no extent size flags
  	 * are set on the inode then unconditionally clear the extent size hint.
  	 */
 -	if (ip->i_d.di_flags & (XFS_DIFLAG_EXTSIZE | XFS_DIFLAG_EXTSZINHERIT))
 -		ip->i_d.di_extsize = fa->fsx_extsize >> mp->m_sb.sb_blocklog;
 -	else
 -		ip->i_d.di_extsize = 0;
 -	if (xfs_sb_version_has_v3inode(&mp->m_sb) &&
 -	    (ip->i_d.di_flags2 & XFS_DIFLAG2_COWEXTSIZE))
 -		ip->i_d.di_cowextsize = fa->fsx_cowextsize >>
 -				mp->m_sb.sb_blocklog;
 +	if (ip->i_diflags & (XFS_DIFLAG_EXTSIZE | XFS_DIFLAG_EXTSZINHERIT))
 +		ip->i_extsize = XFS_B_TO_FSB(mp, fa->fsx_extsize);
  	else
 -		ip->i_d.di_cowextsize = 0;
 +		ip->i_extsize = 0;
 +
 +	if (xfs_sb_version_has_v3inode(&mp->m_sb)) {
 +		if (ip->i_diflags2 & XFS_DIFLAG2_COWEXTSIZE)
 +			ip->i_cowextsize = XFS_B_TO_FSB(mp, fa->fsx_cowextsize);
 +		else
 +			ip->i_cowextsize = 0;
 +	}
  
+ skip_xattr:
  	error = xfs_trans_commit(tp);
  
  	/*
#1 lore raw
Quoted 14 lines · Stephen Rothwell

Hi all,

Today's linux-next merge of the vfs tree got a conflict in:

fs/xfs/xfs_ioctl.c

between commit:

b2197a36c0ef ("xfs: remove XFS_IFEXTENTS")

from the xfs tree and commit:

9fefd5db08ce ("xfs: convert to fileattr")

Quoted 8 lines

from the vfs tree.

I fixed it up (see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.

This looks like a good resolution to the merge conflict, thank you!

--D

Quoted 93 lines
Signature · 3 lines
-- 
Cheers,
Stephen Rothwell
fs/xfs/xfs_ioctl.c +9 -5
diff --cc fs/xfs/xfs_ioctl.c
index bf490bfae6cb,bbda105a2ce5..000000000000
@@@ -1056,77 -1057,17 +1057,19 @@@ xfs_ioc_ag_geometry
  static void
  xfs_fill_fsxattr(
  	struct xfs_inode	*ip,
- 	bool			attr,
- 	struct fsxattr		*fa)
+ 	int			whichfork,
+ 	struct fileattr		*fa)
  {
 +	struct xfs_mount	*mp = ip->i_mount;
- 	struct xfs_ifork	*ifp = attr ? ip->i_afp : &ip->i_df;
+ 	struct xfs_ifork	*ifp = XFS_IFORK_PTR(ip, whichfork);
 
- 	simple_fill_fsxattr(fa, xfs_ip2xflags(ip));
+ 	fileattr_fill_xflags(fa, xfs_ip2xflags(ip));
 -	fa->fsx_extsize = ip->i_d.di_extsize << ip->i_mount->m_sb.sb_blocklog;
 -	fa->fsx_cowextsize = ip->i_d.di_cowextsize <<
 -			ip->i_mount->m_sb.sb_blocklog;
 -	fa->fsx_projid = ip->i_d.di_projid;
 -	if (ifp && (ifp->if_flags & XFS_IFEXTENTS))
 +
 +	fa->fsx_extsize = XFS_FSB_TO_B(mp, ip->i_extsize);
 +	if (ip->i_diflags2 & XFS_DIFLAG2_COWEXTSIZE)
 +		fa->fsx_cowextsize = XFS_FSB_TO_B(mp, ip->i_cowextsize);
 +	fa->fsx_projid = ip->i_projid;
 +	if (ifp && !xfs_need_iread_extents(ifp))
  		fa->fsx_nextents = xfs_iext_count(ifp);
  	else
  		fa->fsx_nextents = xfs_ifork_nextents(ifp);
@@@ -1212,10 -1167,10 +1169,10 @@@ static in
  xfs_ioctl_setattr_xflags(
  	struct xfs_trans	*tp,
  	struct xfs_inode	*ip,
- 	struct fsxattr		*fa)
+ 	struct fileattr		*fa)
  {
  	struct xfs_mount	*mp = ip->i_mount;
 -	uint64_t		di_flags2;
 +	uint64_t		i_flags2;
 
  	/* Can't change realtime flag if any extents are allocated. */
  	if ((ip->i_df.if_nextents || ip->i_delayed_blks) &&
@@@ -1348,8 -1289,11 +1291,11 @@@ xfs_ioctl_setattr_check_extsize
  	xfs_extlen_t		size;
  	xfs_fsblock_t		extsize_fsb;
 
+ 	if (!fa->fsx_valid)
+ 		return 0;
+ 
  	if (S_ISREG(VFS_I(ip)->i_mode) && ip->i_df.if_nextents &&
 -	    ((ip->i_d.di_extsize << mp->m_sb.sb_blocklog) != fa->fsx_extsize))
 +	    ((ip->i_extsize << mp->m_sb.sb_blocklog) != fa->fsx_extsize))
  		return -EINVAL;
 
  	if (fa->fsx_extsize == 0)
@@@ -1520,18 -1476,18 +1478,19 @@@ xfs_fileattr_set
  	 * extent size hint should be set on the inode. If no extent size flags
  	 * are set on the inode then unconditionally clear the extent size hint.
  	 */
 -	if (ip->i_d.di_flags & (XFS_DIFLAG_EXTSIZE | XFS_DIFLAG_EXTSZINHERIT))
 -		ip->i_d.di_extsize = fa->fsx_extsize >> mp->m_sb.sb_blocklog;
 -	else
 -		ip->i_d.di_extsize = 0;
 -	if (xfs_sb_version_has_v3inode(&mp->m_sb) &&
 -	    (ip->i_d.di_flags2 & XFS_DIFLAG2_COWEXTSIZE))
 -		ip->i_d.di_cowextsize = fa->fsx_cowextsize >>
 -				mp->m_sb.sb_blocklog;
 +	if (ip->i_diflags & (XFS_DIFLAG_EXTSIZE | XFS_DIFLAG_EXTSZINHERIT))
 +		ip->i_extsize = XFS_B_TO_FSB(mp, fa->fsx_extsize);
  	else
 -		ip->i_d.di_cowextsize = 0;
 +		ip->i_extsize = 0;
 +
 +	if (xfs_sb_version_has_v3inode(&mp->m_sb)) {
 +		if (ip->i_diflags2 & XFS_DIFLAG2_COWEXTSIZE)
 +			ip->i_cowextsize = XFS_B_TO_FSB(mp, fa->fsx_cowextsize);
 +		else
 +			ip->i_cowextsize = 0;
 +	}
 
+ skip_xattr:
  	error = xfs_trans_commit(tp);
 
  	/*