Whamcloud - gitweb
LU-14459 lmv: change default hash type to crush
[fs/lustre-release.git] / lustre / include / uapi / linux / lustre / lustre_user.h
index a13306e..5bd1693 100644 (file)
@@ -27,7 +27,6 @@
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  *
  * lustre/include/lustre/lustre_user.h
  *
@@ -571,6 +570,7 @@ struct ll_ioc_lease_id {
  * *INFO    - set/get lov_user_mds_data
  */
 /*     lustre_ioctl.h                  101-150 */
+/* ioctl codes 128-143 are reserved for fsverity */
 #define LL_IOC_GETFLAGS                 _IOR ('f', 151, long)
 #define LL_IOC_SETFLAGS                 _IOW ('f', 152, long)
 #define LL_IOC_CLRFLAGS                 _IOW ('f', 153, long)
@@ -618,6 +618,7 @@ struct ll_ioc_lease_id {
 #define LL_IOC_LMV_GETSTRIPE           _IOWR('f', 241, struct lmv_user_md)
 #define LL_IOC_REMOVE_ENTRY            _IOWR('f', 242, __u64)
 #define LL_IOC_RMFID                   _IOR('f', 242, struct fid_array)
+#define LL_IOC_UNLOCK_FOREIGN          _IO('f', 242)
 #define LL_IOC_SET_LEASE               _IOWR('f', 243, struct ll_ioc_lease)
 #define LL_IOC_SET_LEASE_OLD           _IOWR('f', 243, long)
 #define LL_IOC_GET_LEASE               _IO('f', 244)
@@ -996,11 +997,14 @@ enum lmv_hash_type {
        LMV_HASH_TYPE_MAX,
 };
 
-#define LMV_HASH_TYPE_DEFAULT LMV_HASH_TYPE_FNV_1A_64
+static __attribute__((unused)) const char *mdt_hash_name[] = {
+       "none",
+       "all_char",
+       "fnv_1a_64",
+       "crush",
+};
 
-#define LMV_HASH_NAME_ALL_CHARS        "all_char"
-#define LMV_HASH_NAME_FNV_1A_64        "fnv_1a_64"
-#define LMV_HASH_NAME_CRUSH    "crush"
+#define LMV_HASH_TYPE_DEFAULT LMV_HASH_TYPE_CRUSH
 
 /* Right now only the lower part(0-16bits) of lmv_hash_type is being used,
  * and the higher part will be the flag to indicate the status of object,
@@ -1060,8 +1064,6 @@ static inline bool lmv_hash_is_layout_changing(__u32 hash)
               lmv_hash_is_migrating(hash);
 }
 
-extern char *mdt_hash_name[LMV_HASH_TYPE_MAX];
-
 struct lustre_foreign_type {
        __u32           lft_type;
        const char      *lft_name;
@@ -1072,7 +1074,7 @@ struct lustre_foreign_type {
  **/
 enum lustre_foreign_types {
        LU_FOREIGN_TYPE_NONE = 0,
-       LU_FOREIGN_TYPE_DAOS = 0xda05,
+       LU_FOREIGN_TYPE_SYMLINK = 0xda05,
        /* must be the max/last one */
        LU_FOREIGN_TYPE_UNKNOWN = 0xffffffff,
 };
@@ -1084,12 +1086,14 @@ extern struct lustre_foreign_type lu_foreign_types[];
 #define LMV_MAX_STRIPE_COUNT 2000  /* ((12 * 4096 - 256) / 24) */
 #define lmv_user_md lmv_user_md_v1
 struct lmv_user_md_v1 {
-       __u32   lum_magic;       /* must be the first field */
+       __u32   lum_magic;         /* must be the first field */
        __u32   lum_stripe_count;  /* dirstripe count */
        __u32   lum_stripe_offset; /* MDT idx for default dirstripe */
        __u32   lum_hash_type;     /* Dir stripe policy */
-       __u32   lum_type;         /* LMV type: default */
-       __u32   lum_padding1;
+       __u32   lum_type;          /* LMV type: default */
+       __u8    lum_max_inherit;   /* inherit depth of default LMV */
+       __u8    lum_max_inherit_rr;     /* inherit depth of default LMV to round-robin mkdir */
+       __u16   lum_padding1;
        __u32   lum_padding2;
        __u32   lum_padding3;
        char    lum_pool_name[LOV_MAXPOOLNAME + 1];
@@ -1115,6 +1119,37 @@ enum lmv_type {
        LMV_TYPE_DEFAULT = 0x0000,
 };
 
+/* lum_max_inherit will be decreased by 1 after each inheritance if it's not
+ * LMV_INHERIT_UNLIMITED or > LMV_INHERIT_MAX.
+ */
+enum {
+       /* for historical reason, 0 means unlimited inheritance */
+       LMV_INHERIT_UNLIMITED   = 0,
+       /* unlimited lum_max_inherit by default */
+       LMV_INHERIT_DEFAULT     = 0,
+       /* not inherit any more */
+       LMV_INHERIT_END         = 1,
+       /* max inherit depth */
+       LMV_INHERIT_MAX         = 250,
+       /* [251, 254] are reserved */
+       /* not set, or when inherit depth goes beyond end,  */
+       LMV_INHERIT_NONE        = 255,
+};
+
+enum {
+       /* not set, or when inherit_rr depth goes beyond end,  */
+       LMV_INHERIT_RR_NONE             = 0,
+       /* disable lum_max_inherit_rr by default */
+       LMV_INHERIT_RR_DEFAULT          = 0,
+       /* not inherit any more */
+       LMV_INHERIT_RR_END              = 1,
+       /* max inherit depth */
+       LMV_INHERIT_RR_MAX              = 250,
+       /* [251, 254] are reserved */
+       /* unlimited inheritance */
+       LMV_INHERIT_RR_UNLIMITED        = 255,
+};
+
 static inline int lmv_user_md_size(int stripes, int lmm_magic)
 {
        int size = sizeof(struct lmv_user_md);
@@ -1239,6 +1274,8 @@ static inline __u64 lustre_stoqb(__kernel_size_t space)
 #define LUSTRE_Q_SETQUOTAPOOL  0x800010  /* set user pool quota */
 #define LUSTRE_Q_GETINFOPOOL   0x800011  /* get pool quota info */
 #define LUSTRE_Q_SETINFOPOOL   0x800012  /* set pool quota info */
+#define LUSTRE_Q_GETDEFAULT_POOL       0x800013  /* get default pool quota*/
+#define LUSTRE_Q_SETDEFAULT_POOL       0x800014  /* set default pool quota */
 /* In the current Lustre implementation, the grace time is either the time
  * or the timestamp to be used after some quota ID exceeds the soft limt,
  * 48 bits should be enough, its high 16 bits can be used as quota flags.
@@ -1268,7 +1305,9 @@ static inline __u64 lustre_stoqb(__kernel_size_t space)
        (cmd == LUSTRE_Q_GETQUOTAPOOL ||        \
         cmd == LUSTRE_Q_SETQUOTAPOOL ||        \
         cmd == LUSTRE_Q_SETINFOPOOL ||         \
-        cmd == LUSTRE_Q_GETINFOPOOL)
+        cmd == LUSTRE_Q_GETINFOPOOL ||         \
+        cmd == LUSTRE_Q_SETDEFAULT_POOL ||     \
+        cmd == LUSTRE_Q_GETDEFAULT_POOL)
 
 #define ALLQUOTA 255       /* set all quota */
 static inline const char *qtype_name(int qtype)
@@ -1532,7 +1571,7 @@ enum changelog_rec_type {
 };
 
 static inline const char *changelog_type2str(int type) {
-       static const char *changelog_str[] = {
+       static const char *const changelog_str[] = {
                "MARK",  "CREAT", "MKDIR", "HLINK", "SLINK", "MKNOD", "UNLNK",
                "RMDIR", "RENME", "RNMTO", "OPEN",  "CLOSE", "LYOUT", "TRUNC",
                "SATTR", "XATTR", "HSM",   "MTIME", "CTIME", "ATIME", "MIGRT",
@@ -2639,6 +2678,52 @@ struct fid_array {
 };
 #define OBD_MAX_FIDS_IN_ARRAY  4096
 
+/* more types could be defined upon need for more complex
+ * format to be used in foreign symlink LOV/LMV EAs, like
+ * one to describe a delimiter string and occurence number
+ * of delimited sub-string, ...
+ */
+enum ll_foreign_symlink_upcall_item_type {
+       EOB_TYPE = 1,
+       STRING_TYPE = 2,
+       POSLEN_TYPE = 3,
+};
+
+/* may need to be modified to allow for more format items to be defined, and
+ * like for ll_foreign_symlink_upcall_item_type enum
+ */
+struct ll_foreign_symlink_upcall_item {
+       __u32 type;
+       union {
+               struct {
+                       __u32 pos;
+                       __u32 len;
+               };
+               struct {
+                       size_t size;
+                       union {
+                               /* internal storage of constant string */
+                               char *string;
+                               /* upcall stores constant string in a raw */
+                               char bytestring[0];
+                       };
+               };
+       };
+};
+
+#define POSLEN_ITEM_SZ (offsetof(struct ll_foreign_symlink_upcall_item, len) + \
+               sizeof(((struct ll_foreign_symlink_upcall_item *)0)->len))
+#define STRING_ITEM_SZ(sz) ( \
+       offsetof(struct ll_foreign_symlink_upcall_item, bytestring) + \
+       (sz + sizeof(__u32) - 1) / sizeof(__u32) * sizeof(__u32))
+
+/* presently limited to not cause max stack frame size to be reached
+ * because of temporary automatic array of
+ * "struct ll_foreign_symlink_upcall_item" presently used in
+ * foreign_symlink_upcall_info_store()
+ */
+#define MAX_NB_UPCALL_ITEMS 32
+
 #if defined(__cplusplus)
 }
 #endif