xfs: remove the ip argument to xfs_defer_finish
And instead require callers to explicitly join the inode using xfs_defer_ijoin. Also consolidate the defer error handling in a few places using a goto label. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
This commit is contained in:

committed by
Darrick J. Wong

parent
882d8785fb
commit
8ad7c629b1
@@ -467,13 +467,12 @@ xfs_attr_rmtval_set(
|
||||
error = xfs_bmapi_write(args->trans, dp, (xfs_fileoff_t)lblkno,
|
||||
blkcnt, XFS_BMAPI_ATTRFORK, args->firstblock,
|
||||
args->total, &map, &nmap, args->dfops);
|
||||
if (!error)
|
||||
error = xfs_defer_finish(&args->trans, args->dfops, dp);
|
||||
if (error) {
|
||||
args->trans = NULL;
|
||||
xfs_defer_cancel(args->dfops);
|
||||
return error;
|
||||
}
|
||||
if (error)
|
||||
goto out_defer_cancel;
|
||||
xfs_defer_ijoin(args->dfops, dp);
|
||||
error = xfs_defer_finish(&args->trans, args->dfops);
|
||||
if (error)
|
||||
goto out_defer_cancel;
|
||||
|
||||
ASSERT(nmap == 1);
|
||||
ASSERT((map.br_startblock != DELAYSTARTBLOCK) &&
|
||||
@@ -539,6 +538,10 @@ xfs_attr_rmtval_set(
|
||||
}
|
||||
ASSERT(valuelen == 0);
|
||||
return 0;
|
||||
out_defer_cancel:
|
||||
xfs_defer_cancel(args->dfops);
|
||||
args->trans = NULL;
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -609,14 +612,12 @@ xfs_attr_rmtval_remove(
|
||||
error = xfs_bunmapi(args->trans, args->dp, lblkno, blkcnt,
|
||||
XFS_BMAPI_ATTRFORK, 1, args->firstblock,
|
||||
args->dfops, &done);
|
||||
if (!error)
|
||||
error = xfs_defer_finish(&args->trans, args->dfops,
|
||||
args->dp);
|
||||
if (error) {
|
||||
args->trans = NULL;
|
||||
xfs_defer_cancel(args->dfops);
|
||||
return error;
|
||||
}
|
||||
if (error)
|
||||
goto out_defer_cancel;
|
||||
xfs_defer_ijoin(args->dfops, args->dp);
|
||||
error = xfs_defer_finish(&args->trans, args->dfops);
|
||||
if (error)
|
||||
goto out_defer_cancel;
|
||||
|
||||
/*
|
||||
* Close out trans and start the next one in the chain.
|
||||
@@ -626,4 +627,8 @@ xfs_attr_rmtval_remove(
|
||||
return error;
|
||||
}
|
||||
return 0;
|
||||
out_defer_cancel:
|
||||
xfs_defer_cancel(args->dfops);
|
||||
args->trans = NULL;
|
||||
return error;
|
||||
}
|
||||
|
Reference in New Issue
Block a user