xfs: Remove unused xfs_attr_*_args
Remove xfs_attr_set_args, xfs_attr_remove_args, and xfs_attr_trans_roll. These high level loops are now driven by the delayed operations code, and can be removed. Additionally collapse in the leaf_bp parameter of xfs_attr_set_iter since we only have one caller that passes dac->leaf_bp Signed-off-by: Allison Henderson <allison.henderson@oracle.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
committed by
Dave Chinner
parent
f3f36c893f
commit
73159fc27c
@@ -246,64 +246,9 @@ xfs_attr_is_shortform(
|
|||||||
ip->i_afp->if_nextents == 0);
|
ip->i_afp->if_nextents == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Checks to see if a delayed attribute transaction should be rolled. If so,
|
|
||||||
* transaction is finished or rolled as needed.
|
|
||||||
*/
|
|
||||||
STATIC int
|
|
||||||
xfs_attr_trans_roll(
|
|
||||||
struct xfs_delattr_context *dac)
|
|
||||||
{
|
|
||||||
struct xfs_da_args *args = dac->da_args;
|
|
||||||
int error;
|
|
||||||
|
|
||||||
if (dac->flags & XFS_DAC_DEFER_FINISH) {
|
|
||||||
/*
|
|
||||||
* The caller wants us to finish all the deferred ops so that we
|
|
||||||
* avoid pinning the log tail with a large number of deferred
|
|
||||||
* ops.
|
|
||||||
*/
|
|
||||||
dac->flags &= ~XFS_DAC_DEFER_FINISH;
|
|
||||||
error = xfs_defer_finish(&args->trans);
|
|
||||||
} else
|
|
||||||
error = xfs_trans_roll_inode(&args->trans, args->dp);
|
|
||||||
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set the attribute specified in @args.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
xfs_attr_set_args(
|
|
||||||
struct xfs_da_args *args)
|
|
||||||
{
|
|
||||||
struct xfs_buf *leaf_bp = NULL;
|
|
||||||
int error = 0;
|
|
||||||
struct xfs_delattr_context dac = {
|
|
||||||
.da_args = args,
|
|
||||||
};
|
|
||||||
|
|
||||||
do {
|
|
||||||
error = xfs_attr_set_iter(&dac, &leaf_bp);
|
|
||||||
if (error != -EAGAIN)
|
|
||||||
break;
|
|
||||||
|
|
||||||
error = xfs_attr_trans_roll(&dac);
|
|
||||||
if (error) {
|
|
||||||
if (leaf_bp)
|
|
||||||
xfs_trans_brelse(args->trans, leaf_bp);
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
} while (true);
|
|
||||||
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
STATIC int
|
STATIC int
|
||||||
xfs_attr_sf_addname(
|
xfs_attr_sf_addname(
|
||||||
struct xfs_delattr_context *dac,
|
struct xfs_delattr_context *dac)
|
||||||
struct xfs_buf **leaf_bp)
|
|
||||||
{
|
{
|
||||||
struct xfs_da_args *args = dac->da_args;
|
struct xfs_da_args *args = dac->da_args;
|
||||||
struct xfs_inode *dp = args->dp;
|
struct xfs_inode *dp = args->dp;
|
||||||
@@ -322,7 +267,7 @@ xfs_attr_sf_addname(
|
|||||||
* It won't fit in the shortform, transform to a leaf block. GROT:
|
* It won't fit in the shortform, transform to a leaf block. GROT:
|
||||||
* another possible req'mt for a double-split btree op.
|
* another possible req'mt for a double-split btree op.
|
||||||
*/
|
*/
|
||||||
error = xfs_attr_shortform_to_leaf(args, leaf_bp);
|
error = xfs_attr_shortform_to_leaf(args, &dac->leaf_bp);
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
@@ -331,7 +276,7 @@ xfs_attr_sf_addname(
|
|||||||
* push cannot grab the half-baked leaf buffer and run into problems
|
* push cannot grab the half-baked leaf buffer and run into problems
|
||||||
* with the write verifier.
|
* with the write verifier.
|
||||||
*/
|
*/
|
||||||
xfs_trans_bhold(args->trans, *leaf_bp);
|
xfs_trans_bhold(args->trans, dac->leaf_bp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We're still in XFS_DAS_UNINIT state here. We've converted
|
* We're still in XFS_DAS_UNINIT state here. We've converted
|
||||||
@@ -339,7 +284,6 @@ xfs_attr_sf_addname(
|
|||||||
* add.
|
* add.
|
||||||
*/
|
*/
|
||||||
trace_xfs_attr_sf_addname_return(XFS_DAS_UNINIT, args->dp);
|
trace_xfs_attr_sf_addname_return(XFS_DAS_UNINIT, args->dp);
|
||||||
dac->flags |= XFS_DAC_DEFER_FINISH;
|
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -352,8 +296,7 @@ xfs_attr_sf_addname(
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xfs_attr_set_iter(
|
xfs_attr_set_iter(
|
||||||
struct xfs_delattr_context *dac,
|
struct xfs_delattr_context *dac)
|
||||||
struct xfs_buf **leaf_bp)
|
|
||||||
{
|
{
|
||||||
struct xfs_da_args *args = dac->da_args;
|
struct xfs_da_args *args = dac->da_args;
|
||||||
struct xfs_inode *dp = args->dp;
|
struct xfs_inode *dp = args->dp;
|
||||||
@@ -372,14 +315,14 @@ xfs_attr_set_iter(
|
|||||||
* release the hold once we return with a clean transaction.
|
* release the hold once we return with a clean transaction.
|
||||||
*/
|
*/
|
||||||
if (xfs_attr_is_shortform(dp))
|
if (xfs_attr_is_shortform(dp))
|
||||||
return xfs_attr_sf_addname(dac, leaf_bp);
|
return xfs_attr_sf_addname(dac);
|
||||||
if (*leaf_bp != NULL) {
|
if (dac->leaf_bp != NULL) {
|
||||||
xfs_trans_bhold_release(args->trans, *leaf_bp);
|
xfs_trans_bhold_release(args->trans, dac->leaf_bp);
|
||||||
*leaf_bp = NULL;
|
dac->leaf_bp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xfs_attr_is_leaf(dp)) {
|
if (xfs_attr_is_leaf(dp)) {
|
||||||
error = xfs_attr_leaf_try_add(args, *leaf_bp);
|
error = xfs_attr_leaf_try_add(args, dac->leaf_bp);
|
||||||
if (error == -ENOSPC) {
|
if (error == -ENOSPC) {
|
||||||
error = xfs_attr3_leaf_to_node(args);
|
error = xfs_attr3_leaf_to_node(args);
|
||||||
if (error)
|
if (error)
|
||||||
@@ -398,7 +341,6 @@ xfs_attr_set_iter(
|
|||||||
* be a node, so we'll fall down into the node
|
* be a node, so we'll fall down into the node
|
||||||
* handling code below
|
* handling code below
|
||||||
*/
|
*/
|
||||||
dac->flags |= XFS_DAC_DEFER_FINISH;
|
|
||||||
trace_xfs_attr_set_iter_return(
|
trace_xfs_attr_set_iter_return(
|
||||||
dac->dela_state, args->dp);
|
dac->dela_state, args->dp);
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
@@ -689,32 +631,6 @@ xfs_attr_lookup(
|
|||||||
return xfs_attr_node_hasname(args, NULL);
|
return xfs_attr_node_hasname(args, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Remove the attribute specified in @args.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
xfs_attr_remove_args(
|
|
||||||
struct xfs_da_args *args)
|
|
||||||
{
|
|
||||||
int error;
|
|
||||||
struct xfs_delattr_context dac = {
|
|
||||||
.da_args = args,
|
|
||||||
};
|
|
||||||
|
|
||||||
do {
|
|
||||||
error = xfs_attr_remove_iter(&dac);
|
|
||||||
if (error != -EAGAIN)
|
|
||||||
break;
|
|
||||||
|
|
||||||
error = xfs_attr_trans_roll(&dac);
|
|
||||||
if (error)
|
|
||||||
return error;
|
|
||||||
|
|
||||||
} while (true);
|
|
||||||
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note: If args->value is NULL the attribute will be removed, just like the
|
* Note: If args->value is NULL the attribute will be removed, just like the
|
||||||
* Linux ->setattr API.
|
* Linux ->setattr API.
|
||||||
@@ -1311,7 +1227,6 @@ xfs_attr_node_addname(
|
|||||||
* this. dela_state is still unset by this function at
|
* this. dela_state is still unset by this function at
|
||||||
* this point.
|
* this point.
|
||||||
*/
|
*/
|
||||||
dac->flags |= XFS_DAC_DEFER_FINISH;
|
|
||||||
trace_xfs_attr_node_addname_return(
|
trace_xfs_attr_node_addname_return(
|
||||||
dac->dela_state, args->dp);
|
dac->dela_state, args->dp);
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
@@ -1326,7 +1241,6 @@ xfs_attr_node_addname(
|
|||||||
error = xfs_da3_split(state);
|
error = xfs_da3_split(state);
|
||||||
if (error)
|
if (error)
|
||||||
goto out;
|
goto out;
|
||||||
dac->flags |= XFS_DAC_DEFER_FINISH;
|
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* Addition succeeded, update Btree hashvals.
|
* Addition succeeded, update Btree hashvals.
|
||||||
@@ -1580,7 +1494,6 @@ xfs_attr_remove_iter(
|
|||||||
if (error)
|
if (error)
|
||||||
goto out;
|
goto out;
|
||||||
dac->dela_state = XFS_DAS_RM_NAME;
|
dac->dela_state = XFS_DAS_RM_NAME;
|
||||||
dac->flags |= XFS_DAC_DEFER_FINISH;
|
|
||||||
trace_xfs_attr_remove_iter_return(dac->dela_state, args->dp);
|
trace_xfs_attr_remove_iter_return(dac->dela_state, args->dp);
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
}
|
}
|
||||||
@@ -1608,7 +1521,6 @@ xfs_attr_remove_iter(
|
|||||||
if (error)
|
if (error)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
dac->flags |= XFS_DAC_DEFER_FINISH;
|
|
||||||
dac->dela_state = XFS_DAS_RM_SHRINK;
|
dac->dela_state = XFS_DAS_RM_SHRINK;
|
||||||
trace_xfs_attr_remove_iter_return(
|
trace_xfs_attr_remove_iter_return(
|
||||||
dac->dela_state, args->dp);
|
dac->dela_state, args->dp);
|
||||||
|
|||||||
@@ -457,8 +457,7 @@ enum xfs_delattr_state {
|
|||||||
/*
|
/*
|
||||||
* Defines for xfs_delattr_context.flags
|
* Defines for xfs_delattr_context.flags
|
||||||
*/
|
*/
|
||||||
#define XFS_DAC_DEFER_FINISH 0x01 /* finish the transaction */
|
#define XFS_DAC_LEAF_ADDNAME_INIT 0x01 /* xfs_attr_leaf_addname init*/
|
||||||
#define XFS_DAC_LEAF_ADDNAME_INIT 0x02 /* xfs_attr_leaf_addname init*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Context used for keeping track of delayed attribute operations
|
* Context used for keeping track of delayed attribute operations
|
||||||
@@ -516,10 +515,7 @@ bool xfs_attr_is_leaf(struct xfs_inode *ip);
|
|||||||
int xfs_attr_get_ilocked(struct xfs_da_args *args);
|
int xfs_attr_get_ilocked(struct xfs_da_args *args);
|
||||||
int xfs_attr_get(struct xfs_da_args *args);
|
int xfs_attr_get(struct xfs_da_args *args);
|
||||||
int xfs_attr_set(struct xfs_da_args *args);
|
int xfs_attr_set(struct xfs_da_args *args);
|
||||||
int xfs_attr_set_args(struct xfs_da_args *args);
|
int xfs_attr_set_iter(struct xfs_delattr_context *dac);
|
||||||
int xfs_attr_set_iter(struct xfs_delattr_context *dac,
|
|
||||||
struct xfs_buf **leaf_bp);
|
|
||||||
int xfs_attr_remove_args(struct xfs_da_args *args);
|
|
||||||
int xfs_attr_remove_iter(struct xfs_delattr_context *dac);
|
int xfs_attr_remove_iter(struct xfs_delattr_context *dac);
|
||||||
bool xfs_attr_namecheck(const void *name, size_t length);
|
bool xfs_attr_namecheck(const void *name, size_t length);
|
||||||
void xfs_delattr_context_init(struct xfs_delattr_context *dac,
|
void xfs_delattr_context_init(struct xfs_delattr_context *dac,
|
||||||
|
|||||||
@@ -695,7 +695,6 @@ xfs_attr_rmtval_remove(
|
|||||||
* the parent
|
* the parent
|
||||||
*/
|
*/
|
||||||
if (!done) {
|
if (!done) {
|
||||||
dac->flags |= XFS_DAC_DEFER_FINISH;
|
|
||||||
trace_xfs_attr_rmtval_remove_return(dac->dela_state, args->dp);
|
trace_xfs_attr_rmtval_remove_return(dac->dela_state, args->dp);
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -303,7 +303,6 @@ STATIC int
|
|||||||
xfs_xattri_finish_update(
|
xfs_xattri_finish_update(
|
||||||
struct xfs_delattr_context *dac,
|
struct xfs_delattr_context *dac,
|
||||||
struct xfs_attrd_log_item *attrdp,
|
struct xfs_attrd_log_item *attrdp,
|
||||||
struct xfs_buf **leaf_bp,
|
|
||||||
uint32_t op_flags)
|
uint32_t op_flags)
|
||||||
{
|
{
|
||||||
struct xfs_da_args *args = dac->da_args;
|
struct xfs_da_args *args = dac->da_args;
|
||||||
@@ -313,7 +312,7 @@ xfs_xattri_finish_update(
|
|||||||
|
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case XFS_ATTR_OP_FLAGS_SET:
|
case XFS_ATTR_OP_FLAGS_SET:
|
||||||
error = xfs_attr_set_iter(dac, leaf_bp);
|
error = xfs_attr_set_iter(dac);
|
||||||
break;
|
break;
|
||||||
case XFS_ATTR_OP_FLAGS_REMOVE:
|
case XFS_ATTR_OP_FLAGS_REMOVE:
|
||||||
ASSERT(XFS_IFORK_Q(args->dp));
|
ASSERT(XFS_IFORK_Q(args->dp));
|
||||||
@@ -432,8 +431,7 @@ xfs_attr_finish_item(
|
|||||||
*/
|
*/
|
||||||
dac->da_args->trans = tp;
|
dac->da_args->trans = tp;
|
||||||
|
|
||||||
error = xfs_xattri_finish_update(dac, done_item, &dac->leaf_bp,
|
error = xfs_xattri_finish_update(dac, done_item, attr->xattri_op_flags);
|
||||||
attr->xattri_op_flags);
|
|
||||||
if (error != -EAGAIN)
|
if (error != -EAGAIN)
|
||||||
kmem_free(attr);
|
kmem_free(attr);
|
||||||
|
|
||||||
@@ -592,8 +590,7 @@ xfs_attri_item_recover(
|
|||||||
xfs_trans_ijoin(tp, ip, 0);
|
xfs_trans_ijoin(tp, ip, 0);
|
||||||
|
|
||||||
ret = xfs_xattri_finish_update(&attr->xattri_dac, done_item,
|
ret = xfs_xattri_finish_update(&attr->xattri_dac, done_item,
|
||||||
&attr->xattri_dac.leaf_bp,
|
attrp->alfi_op_flags);
|
||||||
attrp->alfi_op_flags);
|
|
||||||
if (ret == -EAGAIN) {
|
if (ret == -EAGAIN) {
|
||||||
/* There's more work to do, so add it to this transaction */
|
/* There's more work to do, so add it to this transaction */
|
||||||
xfs_defer_add(tp, XFS_DEFER_OPS_TYPE_ATTR, &attr->xattri_list);
|
xfs_defer_add(tp, XFS_DEFER_OPS_TYPE_ATTR, &attr->xattri_list);
|
||||||
|
|||||||
Reference in New Issue
Block a user