Whamcloud - gitweb
LU-3345 llapi: add user space method for lov_user_md
[fs/lustre-release.git] / lustre / include / lustre / lustre_idl.h
index 5ad9f21..174fd42 100644 (file)
@@ -1550,10 +1550,16 @@ enum obdo_flags {
 #define LOV_MAGIC_V1_DEF  0x0CD10BD0
 #define LOV_MAGIC_V3_DEF  0x0CD30BD0
 
-#define LOV_PATTERN_RAID0 0x001   /* stripes are used round-robin */
-#define LOV_PATTERN_RAID1 0x002   /* stripes are mirrors of each other */
-#define LOV_PATTERN_FIRST 0x100   /* first stripe is not in round-robin */
-#define LOV_PATTERN_CMOBD 0x200
+#define LOV_PATTERN_RAID0      0x001   /* stripes are used round-robin */
+#define LOV_PATTERN_RAID1      0x002   /* stripes are mirrors of each other */
+#define LOV_PATTERN_FIRST      0x100   /* first stripe is not in round-robin */
+#define LOV_PATTERN_CMOBD      0x200
+
+#define LOV_PATTERN_F_MASK     0xffff0000
+#define LOV_PATTERN_F_RELEASED 0x80000000 /* HSM released file */
+
+#define lov_pattern(pattern)           (pattern & ~LOV_PATTERN_F_MASK)
+#define lov_pattern_flags(pattern)     (pattern & LOV_PATTERN_F_MASK)
 
 #define lov_ost_data lov_ost_data_v1
 struct lov_ost_data_v1 {          /* per-stripe data structure (little-endian)*/
@@ -1668,6 +1674,17 @@ struct lov_mds_md_v3 {            /* LOV EA mds/wire data (little-endian) */
        struct lov_ost_data_v1 lmm_objects[0]; /* per-stripe data */
 };
 
+static inline __u32 lov_mds_md_size(__u16 stripes, __u32 lmm_magic)
+{
+       if (lmm_magic == LOV_MAGIC_V3)
+               return sizeof(struct lov_mds_md_v3) +
+                               stripes * sizeof(struct lov_ost_data_v1);
+       else
+               return sizeof(struct lov_mds_md_v1) +
+                               stripes * sizeof(struct lov_ost_data_v1);
+}
+
+
 #define OBD_MD_FLID        (0x00000001ULL) /* object ID */
 #define OBD_MD_FLATIME     (0x00000002ULL) /* access time */
 #define OBD_MD_FLMTIME     (0x00000004ULL) /* data modification time */