Whamcloud - gitweb
LU-11158 mdt: grow lvb buffer to hold layout
[fs/lustre-release.git] / lustre / include / uapi / linux / lustre / lustre_idl.h
index 7999816..a4ecd35 100644 (file)
@@ -384,6 +384,23 @@ struct lu_orphan_ent_v2 {
        struct lu_orphan_rec_v2 loe_rec;
 };
 
+struct lu_orphan_rec_v3 {
+       struct lu_orphan_rec    lor_rec;
+       struct ost_layout       lor_layout;
+       /* The OST-object declared layout version in PFID EA.*/
+       __u32                   lor_layout_version;
+       /* The OST-object declared layout range (of version) in PFID EA.*/
+       __u32                   lor_range;
+       __u32                   lor_padding_1;
+       __u64                   lor_padding_2;
+};
+
+struct lu_orphan_ent_v3 {
+       /* The orphan OST-object's FID */
+       struct lu_fid           loe_key;
+       struct lu_orphan_rec_v3 loe_rec;
+};
+
 /** @} lu_fid */
 
 /** \defgroup lu_dir lu_dir
@@ -806,9 +823,11 @@ struct ptlrpc_body_v2 {
 #define OBD_CONNECT2_FILE_SECCTX        0x1ULL /* set file security context at create */
 #define OBD_CONNECT2_LOCKAHEAD          0x2ULL /* ladvise lockahead v2 */
 #define OBD_CONNECT2_DIR_MIGRATE        0x4ULL /* migrate striped dir */
+#define OBD_CONNECT2_SUM_STATFS                0x8ULL /* MDT return aggregated stats */
 #define OBD_CONNECT2_FLR               0x20ULL /* FLR support */
 #define OBD_CONNECT2_WBC_INTENTS       0x40ULL /* create/unlink/... intents for wbc, also operations under client-held parent locks */
 #define OBD_CONNECT2_LOCK_CONVERT      0x80ULL /* IBITS lock convert support */
+#define OBD_CONNECT2_ARCHIVE_ID_ARRAY  0x100ULL /* store HSM archive_id in array */
 
 /* XXX README XXX:
  * Please DO NOT add flag values here before first ensuring that this same
@@ -860,7 +879,9 @@ struct ptlrpc_body_v2 {
                                OBD_CONNECT_SHORTIO | OBD_CONNECT_FLAGS2)
 
 #define MDT_CONNECT_SUPPORTED2 (OBD_CONNECT2_FILE_SECCTX | OBD_CONNECT2_FLR | \
-+                               OBD_CONNECT2_LOCK_CONVERT)
+                                OBD_CONNECT2_SUM_STATFS | \
+                               OBD_CONNECT2_LOCK_CONVERT | \
+                               OBD_CONNECT2_DIR_MIGRATE)
 
 #define OST_CONNECT_SUPPORTED  (OBD_CONNECT_SRVLOCK | OBD_CONNECT_GRANT | \
                                OBD_CONNECT_REQPORTAL | OBD_CONNECT_VERSION | \
@@ -1117,7 +1138,11 @@ struct lov_mds_md_v1 {            /* LOV EA mds/wire data (little-endian) */
        struct lov_ost_data_v1 lmm_objects[0]; /* per-stripe data */
 };
 
-#define MAX_MD_SIZE (sizeof(struct lov_mds_md) + 4 * sizeof(struct lov_ost_data))
+#define MAX_MD_SIZE_OLD (sizeof(struct lov_mds_md) +                   \
+                        4 * sizeof(struct lov_ost_data))
+#define MAX_MD_SIZE (sizeof(struct lov_comp_md_v1) +                   \
+                    4 * (sizeof(struct lov_comp_md_entry_v1) +         \
+                         MAX_MD_SIZE_OLD))
 #define MIN_MD_SIZE (sizeof(struct lov_mds_md) + 1 * sizeof(struct lov_ost_data))
 
 /* This is the default MDT reply size allocated, should the striping be bigger,
@@ -1212,20 +1237,19 @@ lov_mds_md_max_stripe_count(size_t buf_size, __u32 lmm_magic)
 #define OBD_MD_FLFLAGS     (0x00000800ULL) /* flags word */
 #define OBD_MD_DOM_SIZE    (0X00001000ULL) /* Data-on-MDT component size */
 #define OBD_MD_FLNLINK     (0x00002000ULL) /* link count */
-#define OBD_MD_FLGENER     (0x00004000ULL) /* generation number */
-#define OBD_MD_LAYOUT_VERSION (0x00008000ULL) /* layout version for
-                                              * OST objects */
+#define OBD_MD_FLPARENT    (0x00004000ULL) /* parent FID */
+#define OBD_MD_LAYOUT_VERSION (0x00008000ULL) /* OST object layout version */
 #define OBD_MD_FLRDEV      (0x00010000ULL) /* device number */
 #define OBD_MD_FLEASIZE    (0x00020000ULL) /* extended attribute data */
 #define OBD_MD_LINKNAME    (0x00040000ULL) /* symbolic link target */
 #define OBD_MD_FLHANDLE    (0x00080000ULL) /* file/lock handle */
 #define OBD_MD_FLCKSUM     (0x00100000ULL) /* bulk data checksum */
-#define OBD_MD_FLQOS       (0x00200000ULL) /* quality of service stats */
-/*     OBD_MD_FLCOOKIE    (0x00800000ULL)    obsolete in 2.8 */
+/*     OBD_MD_FLQOS       (0x00200000ULL) has never been used */
+/*     OBD_MD_FLCOOKIE    (0x00800000ULL) obsolete in 2.8 */
 #define OBD_MD_FLPRJQUOTA  (0x00400000ULL) /* over quota flags sent from ost */
 #define OBD_MD_FLGROUP     (0x01000000ULL) /* group */
 #define OBD_MD_FLFID       (0x02000000ULL) /* ->ost write inline fid */
-#define OBD_MD_FLEPOCH     (0x04000000ULL) /* ->ost write with ioepoch */
+/*     OBD_MD_FLEPOCH     (0x04000000ULL) obsolete 2.7.50 */
                                            /* ->mds if epoch opens or closes */
 #define OBD_MD_FLGRANT     (0x08000000ULL) /* ost preallocation space grant */
 #define OBD_MD_FLDIREA     (0x10000000ULL) /* dir's extended attribute data */
@@ -1234,7 +1258,7 @@ lov_mds_md_max_stripe_count(size_t buf_size, __u32 lmm_magic)
 #define OBD_MD_FLMODEASIZE (0x80000000ULL) /* EA size will be changed */
 
 #define OBD_MD_MDS         (0x0000000100000000ULL) /* where an inode lives on */
-#define OBD_MD_REINT       (0x0000000200000000ULL) /* reintegrate oa */
+/*     OBD_MD_REINT       (0x0000000200000000ULL) obsolete 1.8 */
 #define OBD_MD_MEA         (0x0000000400000000ULL) /* CMD split EA  */
 #define OBD_MD_TSTATE      (0x0000000800000000ULL) /* transient state field */
 
@@ -1242,9 +1266,9 @@ lov_mds_md_max_stripe_count(size_t buf_size, __u32 lmm_magic)
 #define OBD_MD_FLXATTRLS     (0x0000002000000000ULL) /* xattr list */
 #define OBD_MD_FLXATTRRM     (0x0000004000000000ULL) /* xattr remove */
 #define OBD_MD_FLACL         (0x0000008000000000ULL) /* ACL */
-/*     OBD_MD_FLRMTPERM     (0x0000010000000000ULL) remote perm, obsolete */
-#define OBD_MD_FLMDSCAPA     (0x0000020000000000ULL) /* MDS capability */
-#define OBD_MD_FLOSSCAPA     (0x0000040000000000ULL) /* OSS capability */
+#define OBD_MD_FLAGSTATFS    (0x0000010000000000ULL) /* aggregated statfs */
+/*     OBD_MD_FLMDSCAPA     (0x0000020000000000ULL) obsolete 2.7.54 */
+/*     OBD_MD_FLOSSCAPA     (0x0000040000000000ULL) obsolete 2.7.54 */
 /*      OBD_MD_FLCKSPLIT     (0x0000080000000000ULL) obsolete 2.3.58*/
 #define OBD_MD_FLCROSSREF    (0x0000100000000000ULL) /* Cross-ref case */
 #define OBD_MD_FLGETATTRLOCK (0x0000200000000000ULL) /* Get IOEpoch attributes
@@ -1269,7 +1293,7 @@ lov_mds_md_max_stripe_count(size_t buf_size, __u32 lmm_magic)
                          OBD_MD_FLCTIME | OBD_MD_FLSIZE  | OBD_MD_FLBLKSZ | \
                          OBD_MD_FLMODE  | OBD_MD_FLTYPE  | OBD_MD_FLUID   | \
                          OBD_MD_FLGID   | OBD_MD_FLFLAGS | OBD_MD_FLNLINK | \
-                         OBD_MD_FLGENER | OBD_MD_FLRDEV  | OBD_MD_FLGROUP | \
+                         OBD_MD_FLPARENT | OBD_MD_FLRDEV  | OBD_MD_FLGROUP | \
                          OBD_MD_FLPROJID)
 
 #define OBD_MD_FLXATTRALL (OBD_MD_FLXATTR | OBD_MD_FLXATTRLS)
@@ -1711,6 +1735,18 @@ enum {
        LUSTRE_LMA_FL_MASKS = LUSTRE_ORPHAN_FL,
 };
 
+#ifndef FS_XFLAG_SYNC
+#define FS_XFLAG_SYNC          0x00000020      /* all writes synchronous */
+#endif
+#ifndef FS_XFLAG_NOATIME
+#define FS_XFLAG_NOATIME       0x00000040      /* do not update access time */
+#endif
+#ifndef FS_XFLAG_IMMUTABLE
+#define FS_XFLAG_IMMUTABLE     0x00000008      /* file cannot be modified */
+#endif
+#ifndef FS_XFLAG_APPEND
+#define FS_XFLAG_APPEND                0x00000010      /* all writes append */
+#endif
 #ifndef FS_XFLAG_PROJINHERIT
 #define FS_XFLAG_PROJINHERIT   0x00000200      /* create with parents projid */
 #endif
@@ -1730,8 +1766,7 @@ static inline int ll_ext_to_inode_flags(int flags)
 #if defined(S_DIRSYNC)
                 ((flags & LUSTRE_DIRSYNC_FL)   ? S_DIRSYNC   : 0) |
 #endif
-               ((flags & LUSTRE_IMMUTABLE_FL) ? S_IMMUTABLE : 0) |
-               ((flags & LUSTRE_PROJINHERIT_FL) ? FS_XFLAG_PROJINHERIT : 0));
+               ((flags & LUSTRE_IMMUTABLE_FL) ? S_IMMUTABLE : 0));
 }
 
 static inline int ll_inode_to_ext_flags(int iflags)
@@ -1742,8 +1777,23 @@ static inline int ll_inode_to_ext_flags(int iflags)
 #if defined(S_DIRSYNC)
                 ((iflags & S_DIRSYNC)   ? LUSTRE_DIRSYNC_FL   : 0) |
 #endif
-               ((iflags & S_IMMUTABLE) ? LUSTRE_IMMUTABLE_FL : 0) |
-               ((iflags & FS_XFLAG_PROJINHERIT) ? LUSTRE_PROJINHERIT_FL : 0));
+               ((iflags & S_IMMUTABLE) ? LUSTRE_IMMUTABLE_FL : 0));
+}
+
+static inline int ll_xflags_to_inode_flags(int xflags)
+{
+       return  ((xflags & FS_XFLAG_SYNC) ? S_SYNC : 0) |
+               ((xflags & FS_XFLAG_NOATIME) ? S_NOATIME : 0) |
+               ((xflags & FS_XFLAG_APPEND) ? S_APPEND : 0) |
+               ((xflags & FS_XFLAG_IMMUTABLE) ? S_IMMUTABLE : 0);
+}
+
+static inline int ll_inode_flags_to_xflags(int flags)
+{
+       return  ((flags & S_SYNC) ? FS_XFLAG_SYNC : 0) |
+               ((flags & S_NOATIME) ? FS_XFLAG_NOATIME : 0) |
+               ((flags & S_APPEND) ? FS_XFLAG_APPEND : 0) |
+               ((flags & S_IMMUTABLE) ? FS_XFLAG_IMMUTABLE : 0);
 }
 #endif
 
@@ -1755,7 +1805,7 @@ enum md_transient_state {
 struct mdt_body {
        struct lu_fid mbo_fid1;
        struct lu_fid mbo_fid2;
-       struct lustre_handle mbo_handle;
+       struct lustre_handle mbo_open_handle;
        __u64   mbo_valid;
        __u64   mbo_size; /* Offset, in the case of MDS_READPAGE */
        __s64   mbo_mtime;
@@ -1792,7 +1842,7 @@ struct mdt_body {
 }; /* 216 */
 
 struct mdt_ioepoch {
-       struct lustre_handle mio_handle;
+       struct lustre_handle mio_open_handle;
        __u64 mio_unused1; /* was ioepoch */
        __u32 mio_unused2; /* was flags */
        __u32 mio_padding;
@@ -1856,6 +1906,8 @@ struct mdt_rec_setattr {
 #define MDS_ATTR_FROM_OPEN  0x4000ULL /* = 16384, called from open path, ie O_TRUNC */
 #define MDS_ATTR_BLOCKS     0x8000ULL /* = 32768 */
 #define MDS_ATTR_PROJID            0x10000ULL  /* = 65536 */
+#define MDS_ATTR_LSIZE      0x20000ULL /* = 131072 */
+#define MDS_ATTR_LBLOCKS    0x40000ULL /* = 262144 */
 
 enum mds_op_bias {
 /*     MDS_CHECK_SPLIT         = 1 << 0, obsolete before 2.3.58 */
@@ -1871,11 +1923,12 @@ enum mds_op_bias {
        MDS_CREATE_VOLATILE     = 1 << 10,
        MDS_OWNEROVERRIDE       = 1 << 11,
        MDS_HSM_RELEASE         = 1 << 12,
-       MDS_RENAME_MIGRATE      = 1 << 13,
+       MDS_CLOSE_MIGRATE       = 1 << 13,
        MDS_CLOSE_LAYOUT_SWAP   = 1 << 14,
        MDS_CLOSE_LAYOUT_MERGE  = 1 << 15,
        MDS_CLOSE_RESYNC_DONE   = 1 << 16,
        MDS_CLOSE_LAYOUT_SPLIT  = 1 << 17,
+       MDS_TRUNC_KEEP_LEASE    = 1 << 18,
 };
 
 #define MDS_CLOSE_INTENT (MDS_HSM_RELEASE | MDS_CLOSE_LAYOUT_SWAP |         \
@@ -1884,32 +1937,32 @@ enum mds_op_bias {
 
 /* instance of mdt_reint_rec */
 struct mdt_rec_create {
-        __u32           cr_opcode;
-        __u32           cr_cap;
-        __u32           cr_fsuid;
-        __u32           cr_fsuid_h;
-        __u32           cr_fsgid;
-        __u32           cr_fsgid_h;
-        __u32           cr_suppgid1;
-        __u32           cr_suppgid1_h;
-        __u32           cr_suppgid2;
-        __u32           cr_suppgid2_h;
-        struct lu_fid   cr_fid1;
-        struct lu_fid   cr_fid2;
-        struct lustre_handle cr_old_handle; /* handle in case of open replay */
+       __u32           cr_opcode;
+       __u32           cr_cap;
+       __u32           cr_fsuid;
+       __u32           cr_fsuid_h;
+       __u32           cr_fsgid;
+       __u32           cr_fsgid_h;
+       __u32           cr_suppgid1;
+       __u32           cr_suppgid1_h;
+       __u32           cr_suppgid2;
+       __u32           cr_suppgid2_h;
+       struct lu_fid   cr_fid1;
+       struct lu_fid   cr_fid2;
+       struct lustre_handle cr_open_handle_old; /* in case of open replay */
        __s64           cr_time;
-        __u64           cr_rdev;
-        __u64           cr_ioepoch;
-        __u64           cr_padding_1;   /* rr_blocks */
-        __u32           cr_mode;
-        __u32           cr_bias;
-        /* use of helpers set/get_mrc_cr_flags() is needed to access
-         * 64 bits cr_flags [cr_flags_l, cr_flags_h], this is done to
-         * extend cr_flags size without breaking 1.8 compat */
-        __u32           cr_flags_l;     /* for use with open, low  32 bits  */
-        __u32           cr_flags_h;     /* for use with open, high 32 bits */
-        __u32           cr_umask;       /* umask for create */
-        __u32           cr_padding_4;   /* rr_padding_4 */
+       __u64           cr_rdev;
+       __u64           cr_ioepoch;
+       __u64           cr_padding_1;   /* rr_blocks */
+       __u32           cr_mode;
+       __u32           cr_bias;
+       /* use of helpers set/get_mrc_cr_flags() is needed to access
+        * 64 bits cr_flags [cr_flags_l, cr_flags_h], this is done to
+        * extend cr_flags size without breaking 1.8 compat */
+       __u32           cr_flags_l;     /* for use with open, low  32 bits  */
+       __u32           cr_flags_h;     /* for use with open, high 32 bits */
+       __u32           cr_umask;       /* umask for create */
+       __u32           cr_padding_4;   /* rr_padding_4 */
 };
 
 /* instance of mdt_reint_rec */
@@ -2037,7 +2090,7 @@ struct mdt_rec_resync {
        __u32           rs_suppgid2_h;
        struct lu_fid   rs_fid;
        __u8            rs_padding0[sizeof(struct lu_fid)];
-       struct lustre_handle rs_handle; /* rr_mtime */
+       struct lustre_handle rs_lease_handle;   /* rr_mtime */
        __s64           rs_padding1;    /* rr_atime */
        __s64           rs_padding2;    /* rr_ctime */
        __u64           rs_padding3;    /* rr_size */
@@ -2112,9 +2165,16 @@ struct lmv_mds_md_v1 {
                                         * 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_padding1;
-       __u64 lmv_padding2;
+       __u32 lmv_layout_version;       /* increased each time layout changed,
+                                        * by directory migration, restripe
+                                        * and LFSCK. */
+       __u32 lmv_migrate_offset;       /* once this is set, it means this
+                                        * directory is been migrated, stripes
+                                        * before this offset belong to target,
+                                        * from this to source. */
+       __u32 lmv_migrate_hash;         /* hash type of source stripes of
+                                        * migrating directory */
+       __u32 lmv_padding2;
        __u64 lmv_padding3;
        char lmv_pool_name[LOV_MAXPOOLNAME + 1];        /* pool name */
        struct lu_fid lmv_stripe_fids[0];       /* FIDs for each stripe */
@@ -2134,7 +2194,7 @@ struct lmv_mds_md_v1 {
 
 #define LMV_HASH_FLAG_MIGRATION        0x80000000
 
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 11, 56, 0)
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 12, 53, 0)
 /* Since lustre 2.8, this flag will not be needed, instead this DEAD
  * and orphan flags will be stored in LMA (see LMAI_ORPHAN)
  * Keep this flag just for LFSCK, because it still might meet such
@@ -2395,19 +2455,19 @@ union ldlm_gl_desc {
 enum ldlm_intent_flags {
        IT_OPEN        = 0x00000001,
        IT_CREAT       = 0x00000002,
-       IT_OPEN_CREAT  = 0x00000003,
-       IT_READDIR     = 0x00000004,
+       IT_OPEN_CREAT  = IT_OPEN | IT_CREAT, /* To allow case label. */
+       IT_READDIR     = 0x00000004, /* Used by mdc, not put on the wire. */
        IT_GETATTR     = 0x00000008,
        IT_LOOKUP      = 0x00000010,
-       IT_UNLINK      = 0x00000020,
-       IT_TRUNC       = 0x00000040,
+/*     IT_UNLINK      = 0x00000020, Obsolete. */
+/*     IT_TRUNC       = 0x00000040, Obsolete. */
        IT_GETXATTR    = 0x00000080,
-       IT_EXEC        = 0x00000100,
-       IT_PIN         = 0x00000200,
+/*     IT_EXEC        = 0x00000100, Obsolete. */
+/*     IT_PIN         = 0x00000200, Obsolete. */
        IT_LAYOUT      = 0x00000400,
        IT_QUOTA_DQACQ = 0x00000800,
        IT_QUOTA_CONN  = 0x00001000,
-       IT_SETXATTR    = 0x00002000,
+/*     IT_SETXATTR    = 0x00002000, Obsolete. */
        IT_GLIMPSE     = 0x00004000,
        IT_BRW         = 0x00008000,
 };
@@ -2455,16 +2515,16 @@ struct ldlm_reply {
  * Opcodes for mountconf (mgs and mgc)
  */
 enum mgs_cmd {
-        MGS_CONNECT = 250,
-        MGS_DISCONNECT,
-        MGS_EXCEPTION,         /* node died, etc. */
-        MGS_TARGET_REG,        /* whenever target starts up */
-        MGS_TARGET_DEL,
-        MGS_SET_INFO,
-        MGS_CONFIG_READ,
-        MGS_LAST_OPC
+       MGS_CONNECT     = 250,
+       MGS_DISCONNECT  = 251,
+       MGS_EXCEPTION   = 252,  /* node died, etc. */
+       MGS_TARGET_REG  = 253,  /* whenever target starts up */
+       MGS_TARGET_DEL  = 254,
+       MGS_SET_INFO    = 255,
+       MGS_CONFIG_READ = 256,
+       MGS_LAST_OPC,
+       MGS_FIRST_OPC   = MGS_CONNECT
 };
-#define MGS_FIRST_OPC MGS_CONNECT
 
 #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 13, 53, 0)
 #define MGS_PARAM_MAXLEN 1024
@@ -2557,13 +2617,13 @@ struct cfg_marker {
  * Opcodes for multiple servers.
  */
 enum obd_cmd {
-       OBD_PING = 400,
-       OBD_LOG_CANCEL, /* Obsolete since 1.5. */
-       OBD_QC_CALLBACK, /* not used since 2.4 */
-       OBD_IDX_READ,
-        OBD_LAST_OPC
+       OBD_PING        = 400,
+/*     OBD_LOG_CANCEL  = 401, obsolete since 1.5 */
+/*     OBD_QC_CALLBACK = 402, obsolete since 2.4 */
+       OBD_IDX_READ    = 403,
+       OBD_LAST_OPC,
+       OBD_FIRST_OPC = OBD_PING
 };
-#define OBD_FIRST_OPC OBD_PING
 
 /**
  * llog contexts indices.
@@ -2906,12 +2966,12 @@ enum llogd_rpc_ops {
        LLOG_ORIGIN_HANDLE_CREATE       = 501,
        LLOG_ORIGIN_HANDLE_NEXT_BLOCK   = 502,
        LLOG_ORIGIN_HANDLE_READ_HEADER  = 503,
-       LLOG_ORIGIN_HANDLE_WRITE_REC    = 504, /* Obsolete by 2.1. */
-       LLOG_ORIGIN_HANDLE_CLOSE        = 505, /* Obsolete by 1.8. */
-       LLOG_ORIGIN_CONNECT             = 506, /* Obsolete by 2.4. */
-       LLOG_CATINFO                    = 507, /* Obsolete by 2.3. */
+/*     LLOG_ORIGIN_HANDLE_WRITE_REC    = 504, Obsolete by 2.1. */
+/*     LLOG_ORIGIN_HANDLE_CLOSE        = 505, Obsolete by 1.8. */
+/*     LLOG_ORIGIN_CONNECT             = 506, Obsolete by 2.4. */
+/*     LLOG_CATINFO                    = 507, Obsolete by 2.3. */
        LLOG_ORIGIN_HANDLE_PREV_BLOCK   = 508,
-       LLOG_ORIGIN_HANDLE_DESTROY      = 509, /* Obsolete. */
+       LLOG_ORIGIN_HANDLE_DESTROY      = 509, /* Obsolete by 2.11. */
        LLOG_LAST_OPC,
        LLOG_FIRST_OPC                  = LLOG_ORIGIN_HANDLE_CREATE
 };