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.
Signed-off-by: Qian Yingjin <qian@ddn.com>
Change-Id: Idee26018642a174b04d1d36a81952ea98a06514e
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49160
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Feng Lei <flei@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
};
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";
}
{
int rc;
- switch (type) {
+ switch (type & LU_PCC_TYPE_MASK) {
case LU_PCC_READWRITE:
rc = llapi_readwrite_pcc_attach(path, id);
break;
{
int rc;
- switch (type) {
+ switch (type & LU_PCC_TYPE_MASK) {
case LU_PCC_READWRITE:
rc = llapi_readwrite_pcc_attach_fid(mntpath, fid, id);
break;