Whamcloud - gitweb
LU-11872 quota: add get/set project support for non-dir/file
[fs/lustre-release.git] / lustre / include / uapi / linux / lustre / lustre_user.h
index 24867af..495335b 100644 (file)
@@ -633,6 +633,7 @@ struct ll_ioc_lease_id {
 #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)
+#define LL_IOC_PROJECT                 _IOW('f', 253, struct lu_project)
 
 #ifndef        FS_IOC_FSGETXATTR
 /*
@@ -1004,7 +1005,7 @@ static __attribute__((unused)) const char *mdt_hash_name[] = {
        "crush",
 };
 
-#define LMV_HASH_TYPE_DEFAULT LMV_HASH_TYPE_FNV_1A_64
+#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,
@@ -1086,12 +1087,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];
@@ -1117,6 +1120,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);
@@ -1241,6 +1275,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.
@@ -1270,7 +1306,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)
@@ -1530,7 +1568,7 @@ enum changelog_rec_type {
        CL_RESYNC   = 22, /* FLR: file was resync-ed */
        CL_GETXATTR = 23,
        CL_DN_OPEN  = 24, /* denied open */
-       CL_LAST
+       CL_LAST,
 };
 
 static inline const char *changelog_type2str(int type) {
@@ -2632,6 +2670,21 @@ struct lu_pcc_state {
        char    pccs_path[PATH_MAX];
 };
 
+enum lu_project_type {
+       LU_PROJECT_NONE = 0,
+       LU_PROJECT_SET,
+       LU_PROJECT_GET,
+       LU_PROJECT_MAX
+};
+
+struct lu_project {
+       __u32   project_type; /* enum lu_project_type */
+       __u32   project_id;
+       __u32   project_xflags;
+       __u32   project_reserved;
+       char    project_name[NAME_MAX + 1];
+};
+
 struct fid_array {
        __u32 fa_nr;
        /* make header's size equal lu_fid */