[lustre-devel] [PATCH 08/42] lustre: pcc: use two bits to indicate pcc type for attach

James Simmons <[email protected]>
Newsgroups org.lustre.lists.lustre-devel
Message-ID <[email protected]>
From: Qian Yingjin <[email protected]>

PCC currenty supports two types: readwrite and readonly.
The attach data structure @lu_pcc_attach is using 32 bit value to
indicate the PCC type:
    struct lu_pcc_attach {
        __u32 pcca_type;
        __u32 pcca_id;
    };

In this patch, it changes to use 2 bits to represent the PCC type.
The left bits in @pcca_type can be used as flags for attach such
as a flag to indicate using the asynchronous attach via the
command "lfs pcc attach -A" for PCCRO.

WC-bug-id: https://jira.whamcloud.com/browse/LU-16313
Lustre-commit: 6e90974b1f4ac24c5 ("LU-16313 pcc: use two bits to indicate pcc type for attach")
Signed-off-by: Qian Yingjin <[email protected]>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49160
Reviewed-by: Andreas Dilger <[email protected]>
Reviewed-by: Feng Lei <[email protected]>
Reviewed-by: Oleg Drokin <[email protected]>
Signed-off-by: James Simmons <[email protected]>
---
 include/uapi/linux/lustre/lustre_user.h | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/include/uapi/linux/lustre/lustre_user.h b/include/uapi/linux/lustre/lustre_user.h
index e97ccb0635ba..c2096ba1cdbe 100644
--- a/include/uapi/linux/lustre/lustre_user.h
+++ b/include/uapi/linux/lustre/lustre_user.h
@@ -2324,18 +2324,22 @@ struct lu_heat {
 };
 
 enum lu_pcc_type {
-	LU_PCC_NONE = 0,
-	LU_PCC_READWRITE,
+	LU_PCC_NONE		= 0x0,
+	LU_PCC_READWRITE	= 0x01,
+	LU_PCC_READONLY		= 0x02,
+	LU_PCC_TYPE_MASK	= LU_PCC_READWRITE | LU_PCC_READONLY,
 	LU_PCC_MAX
 };
 
 static inline const char *pcc_type2string(enum lu_pcc_type type)
 {
-	switch (type) {
+	switch (type & LU_PCC_TYPE_MASK) {
 	case LU_PCC_NONE:
 		return "none";
 	case LU_PCC_READWRITE:
 		return "readwrite";
+	case LU_PCC_READONLY:
+		return "readonly";
 	default:
 		return "fault";
 	}
-- 
2.27.0

_______________________________________________
lustre-devel mailing list
[email protected]
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.