diff mbox series

[07/14] xfs: introduce XFS_DA_OP_EMPTY

Message ID 20241229133836.1194272-8-aalbersh@kernel.org (mailing list archive)
State New
Headers show
Series Direct mapped extended attribute data | expand

Commit Message

Andrey Albershteyn Dec. 29, 2024, 1:38 p.m. UTC
Allocate blocks but don't copy data into the attribute.

Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
---
 fs/xfs/libxfs/xfs_attr.c     | 8 +++++---
 fs/xfs/libxfs/xfs_da_btree.h | 4 +++-
 2 files changed, 8 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
index 17875ad865f5..5060c266f776 100644
--- a/fs/xfs/libxfs/xfs_attr.c
+++ b/fs/xfs/libxfs/xfs_attr.c
@@ -642,9 +642,11 @@  xfs_attr_rmtval_alloc(
 			goto out;
 	}
 
-	error = xfs_attr_rmtval_set_value(args);
-	if (error)
-		return error;
+	if (!(args->op_flags & XFS_DA_OP_EMPTY)) {
+		error = xfs_attr_rmtval_set_value(args);
+		if (error)
+			return error;
+	}
 
 	attr->xattri_dela_state = xfs_attr_complete_op(attr,
 						++attr->xattri_dela_state);
diff --git a/fs/xfs/libxfs/xfs_da_btree.h b/fs/xfs/libxfs/xfs_da_btree.h
index 354d5d65043e..2428a3a466cb 100644
--- a/fs/xfs/libxfs/xfs_da_btree.h
+++ b/fs/xfs/libxfs/xfs_da_btree.h
@@ -97,6 +97,7 @@  typedef struct xfs_da_args {
 #define XFS_DA_OP_CILOOKUP	(1u << 4) /* lookup returns CI name if found */
 #define XFS_DA_OP_RECOVERY	(1u << 5) /* Log recovery operation */
 #define XFS_DA_OP_LOGGED	(1u << 6) /* Use intent items to track op */
+#define XFS_DA_OP_EMPTY		(1u << 7) /* Don't copy any data but alloc blks */
 
 #define XFS_DA_OP_FLAGS \
 	{ XFS_DA_OP_JUSTCHECK,	"JUSTCHECK" }, \
@@ -105,7 +106,8 @@  typedef struct xfs_da_args {
 	{ XFS_DA_OP_OKNOENT,	"OKNOENT" }, \
 	{ XFS_DA_OP_CILOOKUP,	"CILOOKUP" }, \
 	{ XFS_DA_OP_RECOVERY,	"RECOVERY" }, \
-	{ XFS_DA_OP_LOGGED,	"LOGGED" }
+	{ XFS_DA_OP_LOGGED,	"LOGGED" }, \
+	{ XFS_DA_OP_EMPTY,	"EMPTY" }
 
 /*
  * Storage for holding state during Btree searches and split/join ops.