All of lore.kernel.org
 help / color / mirror / Atom feed
From: Allison Henderson <allison.henderson@oracle.com>
To: linux-xfs@vger.kernel.org
Cc: Allison Henderson <allison.henderson@oracle.com>
Subject: [PATCH 03/17] Add xfs_attr_set_defered and xfs_attr_remove_defered
Date: Fri,  6 Oct 2017 15:05:34 -0700	[thread overview]
Message-ID: <1507327548-3221-4-git-send-email-allison.henderson@oracle.com> (raw)
In-Reply-To: <1507327548-3221-1-git-send-email-allison.henderson@oracle.com>

Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
---
:100644 100644 5325ec2... 5c9b604... M	fs/xfs/libxfs/xfs_attr.c
:100644 100644 06c4081... 67b0fbf... M	fs/xfs/xfs_attr.h
 fs/xfs/libxfs/xfs_attr.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++
 fs/xfs/xfs_attr.h        |  5 +++++
 2 files changed, 63 insertions(+)

diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
index 5325ec2..5c9b604 100644
--- a/fs/xfs/libxfs/xfs_attr.c
+++ b/fs/xfs/libxfs/xfs_attr.c
@@ -458,6 +458,37 @@ xfs_attr_set(
 	return error;
 }
 
+int
+xfs_attr_set_defered(
+	struct xfs_inode	*dp,
+	struct xfs_defer_ops    *dfops,
+	const unsigned char	*name,
+	int			namelen,
+	unsigned char		*value,
+	int			valuelen,
+	int			flags)
+{
+
+	struct xfs_attr_item     *new;
+
+	ASSERT(name != NULL);
+	ASSERT(value != NULL);
+
+	new = kmem_alloc(sizeof(struct xfs_attr_item), KM_SLEEP);
+	memset(new, 0, sizeof(struct xfs_attr_item));
+	new->xattri_ino = dp->i_ino;
+	new->xattri_op_flags = ATTR_OP_FLAGS_SET;
+	new->xattri_name_len = namelen;
+	new->xattri_nameval_len = namelen + valuelen;
+	new->xattri_flags = flags;
+	memcpy(new->xattri_nameval, name, namelen);
+	memcpy(&new->xattri_nameval[namelen], value, valuelen);
+
+	xfs_defer_add(dfops, XFS_DEFER_OPS_TYPE_ATTR, &new->xattri_list);
+
+	return 0;
+}
+
 /*
  * Generic handler routine to remove a name from an attribute list.
  * Transitions attribute list from Btree to shortform as necessary.
@@ -531,6 +562,33 @@ xfs_attr_remove(
 	return error;
 }
 
+int
+xfs_attr_remove_defered(
+	struct xfs_inode        *dp,
+	struct xfs_defer_ops    *dfops,
+	const unsigned char     *name,
+	int			namelen,
+	int                     flags)
+{
+
+	struct xfs_attr_item     *new;
+
+	ASSERT(name != NULL);
+
+	new = kmem_alloc(sizeof(struct xfs_attr_item), KM_SLEEP);
+	memset(new, 0, sizeof(struct xfs_attr_item));
+	new->xattri_ino = dp->i_ino;
+	new->xattri_op_flags = ATTR_OP_FLAGS_REMOVE;
+	new->xattri_name_len = namelen;
+	new->xattri_nameval_len = namelen;
+	new->xattri_flags = flags;
+	memcpy(new->xattri_nameval, name, namelen);
+
+	xfs_defer_add(dfops, XFS_DEFER_OPS_TYPE_ATTR, &new->xattri_list);
+
+	return 0;
+}
+
 /*========================================================================
  * External routines when attribute list is inside the inode
  *========================================================================*/
diff --git a/fs/xfs/xfs_attr.h b/fs/xfs/xfs_attr.h
index 06c4081..67b0fbf 100644
--- a/fs/xfs/xfs_attr.h
+++ b/fs/xfs/xfs_attr.h
@@ -176,5 +176,10 @@ int xfs_attr_list(struct xfs_inode *dp, char *buffer, int bufsize,
 int xfs_attr_args_init(struct xfs_da_args *args, struct xfs_inode *dp,
 		       const unsigned char *name, int flags);
 int xfs_attr_calc_size(struct xfs_da_args *args, int *local);
+int xfs_attr_set_defered(struct xfs_inode *dp, struct xfs_defer_ops *dfops,
+			 const unsigned char *name, int name_len,
+			 unsigned char *value, int valuelen, int flags);
+int xfs_attr_remove_defered(struct xfs_inode *dp, struct xfs_defer_ops *dfops,
+			    const unsigned char *name, int namelen, int flags);
 
 #endif	/* __XFS_ATTR_H__ */
-- 
2.7.4


  parent reply	other threads:[~2017-10-06 22:08 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-06 22:05 [PATCH 00/17] Parent Pointers V2 Allison Henderson
2017-10-06 22:05 ` [PATCH 01/17] Add helper functions xfs_attr_set_args and xfs_attr_remove_args Allison Henderson
2017-10-06 22:05 ` [PATCH 02/17] Set up infastructure for deferred attribute operations Allison Henderson
2017-10-09  4:20   ` Dave Chinner
2017-10-09 21:25     ` Allison Henderson
2017-10-09 22:51       ` Allison Henderson
2017-10-09 23:27         ` Dave Chinner
2017-10-06 22:05 ` Allison Henderson [this message]
2017-10-12  4:38   ` [PATCH 03/17] Add xfs_attr_set_defered and xfs_attr_remove_defered Darrick J. Wong
2017-10-06 22:05 ` [PATCH 04/17] Remove all strlen calls in all xfs_attr_* functions for attr names Allison Henderson
2017-10-06 22:05 ` [PATCH 05/17] xfs: get directory offset when adding directory name Allison Henderson
2017-10-06 22:05 ` [PATCH 06/17] xfs: get directory offset when removing " Allison Henderson
2017-10-06 22:05 ` [PATCH 07/17] xfs: get directory offset when replacing a " Allison Henderson
2017-10-06 22:05 ` [PATCH 08/17] xfs: add parent pointer support to attribute code Allison Henderson
2017-10-06 22:05 ` [PATCH 09/17] xfs: define parent pointer xattr format Allison Henderson
2017-10-06 22:05 ` [PATCH 10/17] :xfs: extent transaction reservations for parent attributes Allison Henderson
2017-10-06 22:05 ` [PATCH 11/17] Add the extra space requirements for parent pointer attributes when calculating the minimum log size during mkfs Allison Henderson
2017-10-06 22:05 ` [PATCH 12/17] xfs: parent pointer attribute creation Allison Henderson
2017-10-06 22:05 ` [PATCH 13/17] xfs: add parent attributes to link Allison Henderson
2017-10-06 22:05 ` [PATCH 14/17] xfs: remove parent pointers in unlink Allison Henderson
2017-10-06 22:05 ` [PATCH 15/17] xfs_bmap_add_attrfork(): re-add error handling from set_attrforkoff() call Allison Henderson
2017-10-06 22:05 ` [PATCH 16/17] Add parent pointers to rename Allison Henderson
2017-10-06 22:05 ` [PATCH 17/17] Add the parent pointer support to the superblock version 5 Allison Henderson
2017-10-18 22:55 [PATCH 00/17] Parent Pointers V3 Allison Henderson
2017-10-18 22:55 ` [PATCH 03/17] Add xfs_attr_set_defered and xfs_attr_remove_defered Allison Henderson
2017-10-19 19:13   ` Darrick J. Wong
2017-10-21  1:08     ` 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=1507327548-3221-4-git-send-email-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.