diff mbox series

[09/25] lustre: pcc: reserve flags for PCC-RO

Message ID 20250130141115.950749-10-jsimmons@infradead.org (mailing list archive)
State New
Headers show
Series lustre: sync to OpenSFS branch April 30, 2023 | expand

Commit Message

James Simmons Jan. 30, 2025, 2:10 p.m. UTC
From: Qian Yingjin <qian@ddn.com>

This patch reserves flags for PCC-RO. It also adds wire check /
test for these new flags.

WC-bug-id: https://jira.whamcloud.com/browse/LU-16700
Lustre-commit: d3874966e4938df175 ("LU-16700 pcc: reserve flags for PCC-RO")
Signed-off-by: Qian Yingjin <qian@ddn.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50504
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Feng Lei <flei@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/ptlrpc/wiretest.c             |  4 ++++
 include/uapi/linux/lustre/lustre_idl.h  |  4 +++-
 include/uapi/linux/lustre/lustre_user.h | 17 ++++++++++++++++-
 3 files changed, 23 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/fs/lustre/ptlrpc/wiretest.c b/fs/lustre/ptlrpc/wiretest.c
index 0da776dc6366..d4a2b82c961e 100644
--- a/fs/lustre/ptlrpc/wiretest.c
+++ b/fs/lustre/ptlrpc/wiretest.c
@@ -4373,6 +4373,10 @@  void lustre_assert_wire_constants(void)
 		 (long long)LAYOUT_INTENT_RELEASE);
 	LASSERTF(LAYOUT_INTENT_RESTORE == 6, "found %lld\n",
 		 (long long)LAYOUT_INTENT_RESTORE);
+	LASSERTF(LAYOUT_INTENT_PCCRO_SET == 7, "found %lld\n",
+		 (long long)LAYOUT_INTENT_PCCRO_SET);
+	LASSERTF(LAYOUT_INTENT_PCCRO_CLEAR == 8, "found %lld\n",
+		 (long long)LAYOUT_INTENT_PCCRO_CLEAR);
 
 	/* Checks for struct hsm_action_item */
 	LASSERTF((int)sizeof(struct hsm_action_item) == 72, "found %lld\n",
diff --git a/include/uapi/linux/lustre/lustre_idl.h b/include/uapi/linux/lustre/lustre_idl.h
index a77a005f0ab1..187a807d4809 100644
--- a/include/uapi/linux/lustre/lustre_idl.h
+++ b/include/uapi/linux/lustre/lustre_idl.h
@@ -2835,7 +2835,9 @@  enum layout_intent_opc {
 	LAYOUT_INTENT_GLIMPSE	= 3,	/** not used */
 	LAYOUT_INTENT_TRUNC	= 4,	/** truncate file, for comp layout */
 	LAYOUT_INTENT_RELEASE	= 5,	/** reserved for HSM release */
-	LAYOUT_INTENT_RESTORE	= 6	/** reserved for HSM restore */
+	LAYOUT_INTENT_RESTORE	= 6,	/** reserved for HSM restore */
+	LAYOUT_INTENT_PCCRO_SET	= 7,	/** set read-only layout for PCC */
+	LAYOUT_INTENT_PCCRO_CLEAR = 8,	/** clear read-only layout */
 };
 
 /* enqueue layout lock with intent */
diff --git a/include/uapi/linux/lustre/lustre_user.h b/include/uapi/linux/lustre/lustre_user.h
index 68fddcf4cb59..876d337a3b2b 100644
--- a/include/uapi/linux/lustre/lustre_user.h
+++ b/include/uapi/linux/lustre/lustre_user.h
@@ -373,6 +373,7 @@  struct ll_ioc_lease_id {
 #define LL_IOC_LADVISE			_IOR('f', 250, struct llapi_lu_ladvise)
 #define LL_IOC_HEAT_GET			_IOWR('f', 251, struct lu_heat)
 #define LL_IOC_HEAT_SET			_IOW('f', 251, __u64)
+#define LL_IOC_PCC_ATTACH		_IOW('f', 252, struct lu_pcc_attach)
 #define LL_IOC_PCC_DETACH		_IOW('f', 252, struct lu_pcc_detach)
 #define LL_IOC_PCC_DETACH_BY_FID	_IOW('f', 252, struct lu_pcc_detach_fid)
 #define LL_IOC_PCC_STATE		_IOR('f', 252, struct lu_pcc_state)
@@ -830,9 +831,18 @@  struct lustre_foreign_type {
  **/
 enum lustre_foreign_types {
 	LU_FOREIGN_TYPE_NONE = 0,
+	/* HSM copytool lhsm_posix */
+	LU_FOREIGN_TYPE_POSIX	= 1,
+	/* Used for PCC-RW. PCCRW components are local to a single archive. */
+	LU_FOREIGN_TYPE_PCCRW	= 2,
+	/* Used for PCC-RO. PCCRO components may be shared between archives. */
+	LU_FOREIGN_TYPE_PCCRO	= 3,
+	/* Used for S3 */
+	LU_FOREIGN_TYPE_S3	= 4,
+	/* Used for DAOS */
 	LU_FOREIGN_TYPE_SYMLINK = 0xda05,
 	/* must be the max/last one */
-	LU_FOREIGN_TYPE_UNKNOWN = 0xffffffff,
+	LU_FOREIGN_TYPE_UNKNOWN	= 0xffffffff,
 };
 
 extern struct lustre_foreign_type lu_foreign_types[];
@@ -1928,6 +1938,8 @@  enum hsm_states {
 	HS_NORELEASE	= 0x00000010,
 	HS_NOARCHIVE	= 0x00000020,
 	HS_LOST		= 0x00000040,
+	HS_PCCRW	= 0x00000080,
+	HS_PCCRO	= 0x00000100,
 };
 
 /* HSM user-setable flags. */
@@ -2356,6 +2368,7 @@  enum lu_pcc_type {
 	LU_PCC_READWRITE	= 0x01,
 	LU_PCC_READONLY		= 0x02,
 	LU_PCC_TYPE_MASK	= LU_PCC_READWRITE | LU_PCC_READONLY,
+	LU_PCC_FL_ASYNC		= 0x10,
 	LU_PCC_MAX
 };
 
@@ -2399,6 +2412,8 @@  enum lu_pcc_state_flags {
 	PCC_STATE_FL_ATTR_VALID		= 0x01,
 	/* The file is being attached into PCC */
 	PCC_STATE_FL_ATTACHING		= 0x02,
+	/* The PCC copy is unlinked */
+	PCC_STATE_FL_UNLINKED		= 0x04,
 };
 
 struct lu_pcc_state {