mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-19 02:34:01 +08:00
xfs: Refactor xfs_attr_try_sf_addname
To help pre-simplify xfs_attr_set_args, we need to hoist transaction handling up, while modularizing the adjacent code down into helpers. In this patch, hoist the commit in xfs_attr_try_sf_addname up into the calling function, and also pull the attr list creation down. Signed-off-by: Allison Collins <allison.henderson@oracle.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Chandan Rajendra <chandanrlinux@gmail.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Acked-by: Dave Chinner <dchinner@redhat.com>
This commit is contained in:
parent
7c93d4a8fc
commit
6cc5b5f898
@ -178,8 +178,13 @@ xfs_attr_try_sf_addname(
|
||||
struct xfs_da_args *args)
|
||||
{
|
||||
|
||||
struct xfs_mount *mp = dp->i_mount;
|
||||
int error, error2;
|
||||
int error;
|
||||
|
||||
/*
|
||||
* Build initial attribute list (if required).
|
||||
*/
|
||||
if (dp->i_afp->if_format == XFS_DINODE_FMT_EXTENTS)
|
||||
xfs_attr_shortform_create(args);
|
||||
|
||||
error = xfs_attr_shortform_addname(args);
|
||||
if (error == -ENOSPC)
|
||||
@ -192,12 +197,10 @@ xfs_attr_try_sf_addname(
|
||||
if (!error && !(args->op_flags & XFS_DA_OP_NOTIME))
|
||||
xfs_trans_ichgtime(args->trans, dp, XFS_ICHGTIME_CHG);
|
||||
|
||||
if (mp->m_flags & XFS_MOUNT_WSYNC)
|
||||
if (dp->i_mount->m_flags & XFS_MOUNT_WSYNC)
|
||||
xfs_trans_set_sync(args->trans);
|
||||
|
||||
error2 = xfs_trans_commit(args->trans);
|
||||
args->trans = NULL;
|
||||
return error ? error : error2;
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -209,7 +212,7 @@ xfs_attr_set_args(
|
||||
{
|
||||
struct xfs_inode *dp = args->dp;
|
||||
struct xfs_buf *leaf_bp = NULL;
|
||||
int error;
|
||||
int error, error2 = 0;
|
||||
|
||||
/*
|
||||
* If the attribute list is non-existent or a shortform list,
|
||||
@ -219,18 +222,15 @@ xfs_attr_set_args(
|
||||
(dp->i_afp->if_format == XFS_DINODE_FMT_EXTENTS &&
|
||||
dp->i_afp->if_nextents == 0)) {
|
||||
|
||||
/*
|
||||
* Build initial attribute list (if required).
|
||||
*/
|
||||
if (dp->i_afp->if_format == XFS_DINODE_FMT_EXTENTS)
|
||||
xfs_attr_shortform_create(args);
|
||||
|
||||
/*
|
||||
* Try to add the attr to the attribute list in the inode.
|
||||
*/
|
||||
error = xfs_attr_try_sf_addname(dp, args);
|
||||
if (error != -ENOSPC)
|
||||
return error;
|
||||
if (error != -ENOSPC) {
|
||||
error2 = xfs_trans_commit(args->trans);
|
||||
args->trans = NULL;
|
||||
return error ? error : error2;
|
||||
}
|
||||
|
||||
/*
|
||||
* It won't fit in the shortform, transform to a leaf block.
|
||||
|
Loading…
Reference in New Issue
Block a user