From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Allison Henderson <allison.henderson@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH v13 06/10] xfs: Add xfs_attr_set_deferred and xfs_attr_remove_deferred
Date: Tue, 10 Nov 2020 12:15:23 -0800 [thread overview]
Message-ID: <20201110201523.GF9695@magnolia> (raw)
In-Reply-To: <20201023063435.7510-7-allison.henderson@oracle.com>
On Thu, Oct 22, 2020 at 11:34:31PM -0700, Allison Henderson wrote:
> From: Allison Collins <allison.henderson@oracle.com>
>
> These routines to set up and start a new deferred attribute operations.
> These functions are meant to be called by any routine needing to
> initiate a deferred attribute operation as opposed to the existing
> inline operations. New helper function xfs_attr_item_init also added.
>
> Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
> ---
> fs/xfs/libxfs/xfs_attr.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++
> fs/xfs/libxfs/xfs_attr.h | 2 ++
> 2 files changed, 56 insertions(+)
>
> diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
> index 760383c..7fe5554 100644
> --- a/fs/xfs/libxfs/xfs_attr.c
> +++ b/fs/xfs/libxfs/xfs_attr.c
> @@ -25,6 +25,7 @@
> #include "xfs_trans_space.h"
> #include "xfs_trace.h"
> #include "xfs_attr_item.h"
> +#include "xfs_attr.h"
>
> /*
> * xfs_attr.c
> @@ -643,6 +644,59 @@ xfs_attr_set(
> goto out_unlock;
> }
>
> +STATIC int
> +xfs_attr_item_init(
> + struct xfs_da_args *args,
> + unsigned int op_flags, /* op flag (set or remove) */
> + struct xfs_attr_item **attr) /* new xfs_attr_item */
> +{
> +
> + struct xfs_attr_item *new;
> +
> + new = kmem_alloc_large(sizeof(struct xfs_attr_item), KM_NOFS);
I don't think we need _large allocations for struct xfs_attr_item, right?
> + memset(new, 0, sizeof(struct xfs_attr_item));
Use kmem_zalloc and you won't have to memset. Better yet, zalloc will
get you memory that's been pre-zeroed in the background.
> + new->xattri_op_flags = op_flags;
> + new->xattri_dac.da_args = args;
> +
> + *attr = new;
> + return 0;
> +}
> +
> +/* Sets an attribute for an inode as a deferred operation */
> +int
> +xfs_attr_set_deferred(
> + struct xfs_da_args *args)
> +{
> + struct xfs_attr_item *new;
> + int error = 0;
> +
> + error = xfs_attr_item_init(args, XFS_ATTR_OP_FLAGS_SET, &new);
> + if (error)
> + return error;
> +
> + xfs_defer_add(args->trans, XFS_DEFER_OPS_TYPE_ATTR, &new->xattri_list);
> +
> + return 0;
> +}
The changes in "xfs: enable delayed attributes" should be moved to this
patch so that these new functions immediately have callers.
(Also see the reply I sent to the next patch, which will avoid weird
regressions if someone's bisect lands in the middle of this series...)
--D
> +
> +/* Removes an attribute for an inode as a deferred operation */
> +int
> +xfs_attr_remove_deferred(
> + struct xfs_da_args *args)
> +{
> +
> + struct xfs_attr_item *new;
> + int error;
> +
> + error = xfs_attr_item_init(args, XFS_ATTR_OP_FLAGS_REMOVE, &new);
> + if (error)
> + return error;
> +
> + xfs_defer_add(args->trans, XFS_DEFER_OPS_TYPE_ATTR, &new->xattri_list);
> +
> + return 0;
> +}
> +
> /*========================================================================
> * External routines when attribute list is inside the inode
> *========================================================================*/
> diff --git a/fs/xfs/libxfs/xfs_attr.h b/fs/xfs/libxfs/xfs_attr.h
> index 5b4a1ca..8a08411 100644
> --- a/fs/xfs/libxfs/xfs_attr.h
> +++ b/fs/xfs/libxfs/xfs_attr.h
> @@ -307,5 +307,7 @@ bool xfs_attr_namecheck(const void *name, size_t length);
> void xfs_delattr_context_init(struct xfs_delattr_context *dac,
> struct xfs_da_args *args);
> int xfs_attr_calc_size(struct xfs_da_args *args, int *local);
> +int xfs_attr_set_deferred(struct xfs_da_args *args);
> +int xfs_attr_remove_deferred(struct xfs_da_args *args);
>
> #endif /* __XFS_ATTR_H__ */
> --
> 2.7.4
>
next prev parent reply other threads:[~2020-11-10 20:15 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-23 6:34 [PATCH v13 00/10] xfs: Delayed Attributes Allison Henderson
2020-10-23 6:34 ` [PATCH v13 01/10] xfs: Add helper xfs_attr_node_remove_step Allison Henderson
2020-10-27 7:03 ` Chandan Babu R
2020-10-27 22:23 ` Allison Henderson
2020-10-27 12:15 ` Brian Foster
2020-10-27 15:33 ` Allison Henderson
2020-11-10 23:12 ` Darrick J. Wong
2020-11-13 1:38 ` Allison Henderson
2020-10-23 6:34 ` [PATCH v13 02/10] xfs: Add delay ready attr remove routines Allison Henderson
2020-10-27 9:59 ` Chandan Babu R
2020-10-27 15:32 ` Allison Henderson
2020-10-28 12:04 ` Chandan Babu R
2020-10-29 1:29 ` Allison Henderson
2020-11-14 0:53 ` Darrick J. Wong
2020-10-27 12:16 ` Brian Foster
2020-10-27 22:27 ` Allison Henderson
2020-10-28 12:28 ` Brian Foster
2020-10-29 1:03 ` Allison Henderson
2020-11-10 23:15 ` Darrick J. Wong
2020-11-10 23:43 ` Darrick J. Wong
2020-11-11 0:28 ` Dave Chinner
2020-11-13 4:00 ` Allison Henderson
2020-11-13 3:43 ` Allison Henderson
2020-11-14 1:18 ` Darrick J. Wong
2020-11-16 5:12 ` Allison Henderson
2020-10-23 6:34 ` [PATCH v13 03/10] xfs: Add delay ready attr set routines Allison Henderson
2020-10-27 13:32 ` Chandan Babu R
2020-11-10 21:57 ` Darrick J. Wong
2020-11-13 1:33 ` Allison Henderson
2020-11-13 9:16 ` Chandan Babu R
2020-11-13 17:12 ` Allison Henderson
2020-11-14 1:20 ` Darrick J. Wong
2020-11-10 23:10 ` Darrick J. Wong
2020-11-13 1:38 ` Allison Henderson
2020-11-14 1:35 ` Darrick J. Wong
2020-11-16 5:25 ` Allison Henderson
2020-10-23 6:34 ` [PATCH v13 04/10] xfs: Rename __xfs_attr_rmtval_remove Allison Henderson
2020-10-23 6:34 ` [PATCH v13 05/10] xfs: Set up infastructure for deferred attribute operations Allison Henderson
2020-11-10 21:51 ` Darrick J. Wong
2020-11-11 3:44 ` Darrick J. Wong
2020-11-13 17:06 ` Allison Henderson
2020-11-13 1:32 ` Allison Henderson
2020-11-14 2:00 ` Darrick J. Wong
2020-11-16 7:41 ` Allison Henderson
2020-10-23 6:34 ` [PATCH v13 06/10] xfs: Add xfs_attr_set_deferred and xfs_attr_remove_deferred Allison Henderson
2020-11-10 20:15 ` Darrick J. Wong [this message]
2020-11-13 1:27 ` Allison Henderson
2020-11-14 2:03 ` Darrick J. Wong
2020-10-23 6:34 ` [PATCH v13 07/10] xfs: Add feature bit XFS_SB_FEAT_INCOMPAT_LOG_DELATTR Allison Henderson
2020-11-10 20:10 ` Darrick J. Wong
2020-11-13 1:27 ` Allison Henderson
2020-11-19 2:36 ` Darrick J. Wong
2020-11-19 4:01 ` Allison Henderson
2020-10-23 6:34 ` [PATCH v13 08/10] xfs: Enable delayed attributes Allison Henderson
2020-10-23 6:34 ` [PATCH v13 09/10] xfs: Remove unused xfs_attr_*_args Allison Henderson
2020-11-10 20:07 ` Darrick J. Wong
2020-11-13 1:27 ` Allison Henderson
2020-10-23 6:34 ` [PATCH v13 10/10] xfs: Add delayed attributes error tag Allison Henderson
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=20201110201523.GF9695@magnolia \
--to=darrick.wong@oracle.com \
--cc=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