]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
staging: lustre: lmv: separate master object with master stripe
[mirror_ubuntu-bionic-kernel.git] / drivers / staging / lustre / lustre / include / lustre / lustre_idl.h
index 3444addc3f6b14e92bdf6a8ad06edcef51d0eda4..8736826ffd5a4372ce5495a37d853b2e35cce42b 100644 (file)
@@ -2497,18 +2497,52 @@ struct lmv_desc {
        struct obd_uuid ld_uuid;
 };
 
-/* lmv structures */
-#define LMV_MAGIC_V1   0x0CD10CD0      /* normal stripe lmv magic */
-#define LMV_USER_MAGIC 0x0CD20CD0      /* default lmv magic*/
-#define LMV_MAGIC_MIGRATE      0x0CD30CD0      /* migrate stripe lmv magic */
-#define LMV_MAGIC      LMV_MAGIC_V1
+/* LMV layout EA, and it will be stored both in master and slave object */
+struct lmv_mds_md_v1 {
+       __u32 lmv_magic;
+       __u32 lmv_stripe_count;
+       __u32 lmv_master_mdt_index;     /* On master object, it is master
+                                        * MDT index, on slave object, it
+                                        * is stripe index of the slave obj
+                                        */
+       __u32 lmv_hash_type;            /* dir stripe policy, i.e. indicate
+                                        * which hash function to be used,
+                                        * Note: only lower 16 bits is being
+                                        * used for now. Higher 16 bits will
+                                        * be used to mark the object status,
+                                        * for example migrating or dead.
+                                        */
+       __u32 lmv_layout_version;       /* Used for directory restriping */
+       __u32 lmv_padding;
+       struct lu_fid lmv_master_fid;   /* The FID of the master object, which
+                                        * is the namespace-visible dir FID
+                                        */
+       char lmv_pool_name[LOV_MAXPOOLNAME];    /* pool name */
+       struct lu_fid lmv_stripe_fids[0];       /* FIDs for each stripe */
+};
 
+#define LMV_MAGIC_V1    0x0CD20CD0     /* normal stripe lmv magic */
+#define LMV_MAGIC       LMV_MAGIC_V1
+
+/* #define LMV_USER_MAGIC 0x0CD30CD0 */
+#define LMV_MAGIC_STRIPE 0x0CD40CD0    /* magic for dir sub_stripe */
+
+/*
+ *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,
+ * for example the object is being migrated. And the hash function
+ * might be interpreted differently with different flags.
+ */
 enum lmv_hash_type {
        LMV_HASH_TYPE_ALL_CHARS = 1,
        LMV_HASH_TYPE_FNV_1A_64 = 2,
-       LMV_HASH_TYPE_MIGRATION = 3,
 };
 
+#define LMV_HASH_TYPE_MASK             0x0000ffff
+
+#define LMV_HASH_FLAG_MIGRATION                0x80000000
+#define LMV_HASH_FLAG_DEAD             0x40000000
+
 #define LMV_HASH_NAME_ALL_CHARS                "all_char"
 #define LMV_HASH_NAME_FNV_1A_64                "fnv_1a_64"
 
@@ -2540,19 +2574,6 @@ static inline __u64 lustre_hash_fnv_1a_64(const void *buf, size_t size)
        return hash;
 }
 
-struct lmv_mds_md_v1 {
-       __u32 lmv_magic;
-       __u32 lmv_stripe_count;         /* stripe count */
-       __u32 lmv_master_mdt_index;     /* master MDT index */
-       __u32 lmv_hash_type;            /* dir stripe policy, i.e. indicate
-                                        * which hash function to be used
-                                        */
-       __u32 lmv_layout_version;       /* Used for directory restriping */
-       __u32 lmv_padding;
-       char lmv_pool_name[LOV_MAXPOOLNAME];    /* pool name */
-       struct lu_fid lmv_stripe_fids[0];       /* FIDs for each stripe */
-};
-
 union lmv_mds_md {
        __u32                   lmv_magic;
        struct lmv_mds_md_v1    lmv_md_v1;
@@ -2566,8 +2587,7 @@ static inline ssize_t lmv_mds_md_size(int stripe_count, unsigned int lmm_magic)
        ssize_t len = -EINVAL;
 
        switch (lmm_magic) {
-       case LMV_MAGIC_V1:
-       case LMV_MAGIC_MIGRATE: {
+       case LMV_MAGIC_V1: {
                struct lmv_mds_md_v1 *lmm1;
 
                len = sizeof(*lmm1);
@@ -2583,7 +2603,6 @@ static inline int lmv_mds_md_stripe_count_get(const union lmv_mds_md *lmm)
 {
        switch (le32_to_cpu(lmm->lmv_magic)) {
        case LMV_MAGIC_V1:
-       case LMV_MAGIC_MIGRATE:
                return le32_to_cpu(lmm->lmv_md_v1.lmv_stripe_count);
        case LMV_USER_MAGIC:
                return le32_to_cpu(lmm->lmv_user_md.lum_stripe_count);
@@ -2599,7 +2618,6 @@ static inline int lmv_mds_md_stripe_count_set(union lmv_mds_md *lmm,
 
        switch (le32_to_cpu(lmm->lmv_magic)) {
        case LMV_MAGIC_V1:
-       case LMV_MAGIC_MIGRATE:
                lmm->lmv_md_v1.lmv_stripe_count = cpu_to_le32(stripe_count);
                break;
        case LMV_USER_MAGIC: