From: Allison Henderson <allison.henderson@oracle.com>
To: linux-xfs@vger.kernel.org
Subject: [PATCH v28 08/15] xfs: Remove unused xfs_attr_*_args
Date: Mon, 28 Feb 2022 12:51:40 -0700 [thread overview]
Message-ID: <20220228195147.1913281-9-allison.henderson@oracle.com> (raw)
In-Reply-To: <20220228195147.1913281-1-allison.henderson@oracle.com>
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>
---
fs/xfs/libxfs/xfs_attr.c | 106 +++-----------------------------
fs/xfs/libxfs/xfs_attr.h | 8 +--
fs/xfs/libxfs/xfs_attr_remote.c | 1 -
fs/xfs/xfs_attr_item.c | 9 +--
4 files changed, 14 insertions(+), 110 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
index 848c19b34809..3d7531817e74 100644
--- a/fs/xfs/libxfs/xfs_attr.c
+++ b/fs/xfs/libxfs/xfs_attr.c
@@ -247,64 +247,9 @@ xfs_attr_is_shortform(
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
xfs_attr_sf_addname(
- struct xfs_delattr_context *dac,
- struct xfs_buf **leaf_bp)
+ struct xfs_delattr_context *dac)
{
struct xfs_da_args *args = dac->da_args;
struct xfs_inode *dp = args->dp;
@@ -323,7 +268,7 @@ xfs_attr_sf_addname(
* It won't fit in the shortform, transform to a leaf block. GROT:
* 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)
return error;
@@ -332,7 +277,7 @@ xfs_attr_sf_addname(
* push cannot grab the half-baked leaf buffer and run into problems
* 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
@@ -340,7 +285,6 @@ xfs_attr_sf_addname(
* add.
*/
trace_xfs_attr_sf_addname_return(XFS_DAS_UNINIT, args->dp);
- dac->flags |= XFS_DAC_DEFER_FINISH;
return -EAGAIN;
}
@@ -353,8 +297,7 @@ xfs_attr_sf_addname(
*/
int
xfs_attr_set_iter(
- struct xfs_delattr_context *dac,
- struct xfs_buf **leaf_bp)
+ struct xfs_delattr_context *dac)
{
struct xfs_da_args *args = dac->da_args;
struct xfs_inode *dp = args->dp;
@@ -373,14 +316,14 @@ xfs_attr_set_iter(
* release the hold once we return with a clean transaction.
*/
if (xfs_attr_is_shortform(dp))
- return xfs_attr_sf_addname(dac, leaf_bp);
- if (*leaf_bp != NULL) {
- xfs_trans_bhold_release(args->trans, *leaf_bp);
- *leaf_bp = NULL;
+ return xfs_attr_sf_addname(dac);
+ if (dac->leaf_bp != NULL) {
+ xfs_trans_bhold_release(args->trans, dac->leaf_bp);
+ dac->leaf_bp = NULL;
}
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) {
error = xfs_attr3_leaf_to_node(args);
if (error)
@@ -399,7 +342,6 @@ xfs_attr_set_iter(
* be a node, so we'll fall down into the node
* handling code below
*/
- dac->flags |= XFS_DAC_DEFER_FINISH;
trace_xfs_attr_set_iter_return(
dac->dela_state, args->dp);
return -EAGAIN;
@@ -690,32 +632,6 @@ xfs_attr_lookup(
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
* Linux ->setattr API.
@@ -1309,7 +1225,6 @@ xfs_attr_node_addname(
* this. dela_state is still unset by this function at
* this point.
*/
- dac->flags |= XFS_DAC_DEFER_FINISH;
trace_xfs_attr_node_addname_return(
dac->dela_state, args->dp);
return -EAGAIN;
@@ -1324,7 +1239,6 @@ xfs_attr_node_addname(
error = xfs_da3_split(state);
if (error)
goto out;
- dac->flags |= XFS_DAC_DEFER_FINISH;
} else {
/*
* Addition succeeded, update Btree hashvals.
@@ -1578,7 +1492,6 @@ xfs_attr_remove_iter(
if (error)
goto out;
dac->dela_state = XFS_DAS_RM_NAME;
- dac->flags |= XFS_DAC_DEFER_FINISH;
trace_xfs_attr_remove_iter_return(dac->dela_state, args->dp);
return -EAGAIN;
}
@@ -1606,7 +1519,6 @@ xfs_attr_remove_iter(
if (error)
goto out;
- dac->flags |= XFS_DAC_DEFER_FINISH;
dac->dela_state = XFS_DAS_RM_SHRINK;
trace_xfs_attr_remove_iter_return(
dac->dela_state, args->dp);
diff --git a/fs/xfs/libxfs/xfs_attr.h b/fs/xfs/libxfs/xfs_attr.h
index b52156ad8e6e..5331551d5939 100644
--- a/fs/xfs/libxfs/xfs_attr.h
+++ b/fs/xfs/libxfs/xfs_attr.h
@@ -457,8 +457,7 @@ enum xfs_delattr_state {
/*
* Defines for xfs_delattr_context.flags
*/
-#define XFS_DAC_DEFER_FINISH 0x01 /* finish the transaction */
-#define XFS_DAC_LEAF_ADDNAME_INIT 0x02 /* xfs_attr_leaf_addname init*/
+#define XFS_DAC_LEAF_ADDNAME_INIT 0x01 /* xfs_attr_leaf_addname init*/
/*
* 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(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,
- struct xfs_buf **leaf_bp);
-int xfs_attr_remove_args(struct xfs_da_args *args);
+int xfs_attr_set_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);
void xfs_delattr_context_init(struct xfs_delattr_context *dac,
diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c
index 83b95be9ded8..c806319134fb 100644
--- a/fs/xfs/libxfs/xfs_attr_remote.c
+++ b/fs/xfs/libxfs/xfs_attr_remote.c
@@ -695,7 +695,6 @@ xfs_attr_rmtval_remove(
* the parent
*/
if (!done) {
- dac->flags |= XFS_DAC_DEFER_FINISH;
trace_xfs_attr_rmtval_remove_return(dac->dela_state, args->dp);
return -EAGAIN;
}
diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c
index 6e4c65d82db5..468358f44a8f 100644
--- a/fs/xfs/xfs_attr_item.c
+++ b/fs/xfs/xfs_attr_item.c
@@ -270,7 +270,6 @@ STATIC int
xfs_xattri_finish_update(
struct xfs_delattr_context *dac,
struct xfs_attrd_log_item *attrdp,
- struct xfs_buf **leaf_bp,
uint32_t op_flags)
{
struct xfs_da_args *args = dac->da_args;
@@ -280,7 +279,7 @@ xfs_xattri_finish_update(
switch (op) {
case XFS_ATTR_OP_FLAGS_SET:
- error = xfs_attr_set_iter(dac, leaf_bp);
+ error = xfs_attr_set_iter(dac);
break;
case XFS_ATTR_OP_FLAGS_REMOVE:
ASSERT(XFS_IFORK_Q(args->dp));
@@ -390,8 +389,7 @@ xfs_attr_finish_item(
*/
dac->da_args->trans = tp;
- error = xfs_xattri_finish_update(dac, done_item, &dac->leaf_bp,
- attr->xattri_op_flags);
+ error = xfs_xattri_finish_update(dac, done_item, attr->xattri_op_flags);
if (error != -EAGAIN)
kmem_free(attr);
@@ -550,8 +548,7 @@ xfs_attri_item_recover(
xfs_trans_ijoin(tp, ip, 0);
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) {
/* There's more work to do, so add it to this transaction */
xfs_defer_add(tp, XFS_DEFER_OPS_TYPE_ATTR, &attr->xattri_list);
--
2.25.1
next prev parent reply other threads:[~2022-02-28 19:52 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-28 19:51 [PATCH v28 00/15] xfs: Log Attribute Replay Allison Henderson
2022-02-28 19:51 ` [PATCH v28 01/15] xfs: Fix double unlock in defer capture code Allison Henderson
2022-02-28 19:51 ` [PATCH v28 02/15] xfs: don't commit the first deferred transaction without intents Allison Henderson
2022-02-28 19:51 ` [PATCH v28 03/15] xfs: Return from xfs_attr_set_iter if there are no more rmtblks to process Allison Henderson
2022-02-28 19:51 ` [PATCH v28 04/15] xfs: Set up infrastructure for log attribute replay Allison Henderson
2022-02-28 19:51 ` [PATCH v28 05/15] xfs: Implement attr logging and replay Allison Henderson
2022-02-28 19:51 ` [PATCH v28 06/15] xfs: Skip flip flags for delayed attrs Allison Henderson
2022-02-28 19:51 ` [PATCH v28 07/15] xfs: Add xfs_attr_set_deferred and xfs_attr_remove_deferred Allison Henderson
2022-02-28 19:51 ` Allison Henderson [this message]
2022-02-28 19:51 ` [PATCH v28 09/15] xfs: Add log attribute error tag Allison Henderson
2022-02-28 19:51 ` [PATCH v28 10/15] xfs: Add larp debug option Allison Henderson
2022-02-28 19:51 ` [PATCH v28 11/15] xfs: Merge xfs_delattr_context into xfs_attr_item Allison Henderson
2022-02-28 19:51 ` [PATCH v28 12/15] xfs: Add helper function xfs_attr_leaf_addname Allison Henderson
2022-02-28 19:51 ` [PATCH v28 13/15] xfs: Add helper function xfs_init_attr_trans Allison Henderson
2022-02-28 19:51 ` [PATCH v28 14/15] xfs: add leaf split error tag Allison Henderson
2022-02-28 19:51 ` [PATCH v28 15/15] xfs: add leaf to node " Allison Henderson
2022-03-01 2:29 ` [PATCH v28 00/15] xfs: Log Attribute Replay Darrick J. Wong
2022-03-01 20:39 ` Allison Henderson
2022-03-09 3:53 ` Darrick J. Wong
2022-03-10 6:13 ` Alli
2022-03-10 6:55 ` Dave Chinner
2022-03-10 7:35 ` Dave Chinner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220228195147.1913281-9-allison.henderson@oracle.com \
--to=allison.henderson@oracle.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox