Whamcloud - gitweb
LU-6179 llite: remove LOCKAHEAD_OLD compatibility
[fs/lustre-release.git] / lustre / include / uapi / linux / lustre / lustre_idl.h
index 9a8963a..1402fbb 100644 (file)
 
 #include <asm/byteorder.h>
 #include <linux/errno.h>
+#include <linux/fiemap.h>
 #include <linux/types.h>
-
 /*
  * This is due to us being out of kernel and the way the OpenSFS branch
  * handles CFLAGS.
  */
 #ifdef __KERNEL__
 # include <uapi/linux/lnet/lnet-types.h>
-# include <uapi/linux/lustre/lustre_user.h> /* Defn's shared with user-space. */
-# include <uapi/linux/lustre/lustre_ver.h>
 #else
 # include <linux/lnet/lnet-types.h>
-# include <linux/lustre/lustre_user.h>
-# include <linux/lustre/lustre_ver.h>
 #endif
+#include <linux/lustre/lustre_user.h>
+#include <linux/lustre/lustre_ver.h>
 
 #if defined(__cplusplus)
 extern "C" {
@@ -173,12 +171,14 @@ extern void lustre_loa_init(struct lustre_ost_attrs *loa,
                            const struct lu_fid *fid,
                            __u32 compat, __u32 incompat);
 
-/* copytool uses a 32b bitmask field to encode archive-Ids during register
- * with MDT thru kuc.
+/* copytool can use any nonnegative integer to represent archive-Ids during
+ * register with MDT thru kuc.
  * archive num = 0 => all
- * archive num from 1 to 32
+ * archive num from 1 to MAX_U32
  */
-#define LL_HSM_MAX_ARCHIVE (sizeof(__u32) * 8)
+#define LL_HSM_ORIGIN_MAX_ARCHIVE      (sizeof(__u32) * 8)
+/* the max count of archive ids that one agent can support */
+#define LL_HSM_MAX_ARCHIVES_PER_AGENT  1024
 
 /**
  * HSM on-disk attributes stored in a separate xattr.
@@ -526,18 +526,21 @@ static inline struct lu_dirent *lu_dirent_next(struct lu_dirent *ent)
        return next;
 }
 
-static inline size_t lu_dirent_calc_size(size_t namelen, __u16 attr)
+static inline __kernel_size_t lu_dirent_calc_size(size_t namelen, __u16 attr)
 {
-       size_t size;
+       __kernel_size_t size;
 
        if (attr & LUDA_TYPE) {
-               const size_t align = sizeof(struct luda_type) - 1;
-                size = (sizeof(struct lu_dirent) + namelen + align) & ~align;
-                size += sizeof(struct luda_type);
-        } else
-                size = sizeof(struct lu_dirent) + namelen;
+               const __kernel_size_t align = sizeof(struct luda_type) - 1;
+
+               size = (sizeof(struct lu_dirent) + namelen + 1 + align) &
+                      ~align;
+               size += sizeof(struct luda_type);
+       } else {
+               size = sizeof(struct lu_dirent) + namelen + 1;
+       }
 
-        return (size + 7) & ~7;
+       return (size + 7) & ~7;
 }
 
 #define MDS_DIR_END_OFF 0xfffffffffffffffeULL
@@ -813,7 +816,7 @@ struct ptlrpc_body_v2 {
                                                         RPCs in parallel */
 #define OBD_CONNECT_DIR_STRIPE  0x400000000000000ULL /* striped DNE dir */
 #define OBD_CONNECT_SUBTREE    0x800000000000000ULL /* fileset mount */
-#define OBD_CONNECT_LOCKAHEAD_OLD 0x1000000000000000ULL /* Old Cray lockahead */
+/* was OBD_CONNECT_LOCKAHEAD_OLD 0x1000000000000000ULL old lockahead 2.12-2.13*/
 
 /** bulk matchbits is sent within ptlrpc_body */
 #define OBD_CONNECT_BULK_MBITS  0x2000000000000000ULL
@@ -824,19 +827,27 @@ struct ptlrpc_body_v2 {
 #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_OVERSTRIPING      0x10ULL /* OST overstriping support */
 #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 */
-
+#define OBD_CONNECT2_INC_XID           0x200ULL /* Increasing xid */
+#define OBD_CONNECT2_SELINUX_POLICY    0x400ULL /* has client SELinux policy */
+#define OBD_CONNECT2_LSOM              0x800ULL /* LSOM support */
+#define OBD_CONNECT2_PCC               0x1000ULL /* Persistent Client Cache */
+#define OBD_CONNECT2_CRUSH             0x2000ULL /* crush hash striped directory */
+#define OBD_CONNECT2_ASYNC_DISCARD     0x4000ULL /* support async DoM data discard */
+#define OBD_CONNECT2_ENCRYPT           0x8000ULL /* client-to-disk encrypt */
 /* XXX README XXX:
  * Please DO NOT add flag values here before first ensuring that this same
  * flag value is not in use on some other branch.  Please clear any such
  * changes with senior engineers before starting to use a new flag.  Then,
  * submit a small patch against EVERY branch that ONLY adds the new flag,
- * updates obd_connect_names[] for lprocfs_rd_connect_flags(), adds the
- * flag to check_obd_connect_data(), and updates wiretests accordingly, so it
- * can be approved and landed easily to reserve the flag for future use. */
+ * updates obd_connect_names[], adds the flag to check_obd_connect_data(),
+ * and updates wiretests accordingly, so it can be approved and landed easily
+ * to reserve the flag for future use.
+ */
 
 /* The MNE_SWAB flag is overloading the MDS_MDS bit only for the MGS
  * connection.  It is a temporary bug fix for Imperative Recovery interop
@@ -878,10 +889,19 @@ struct ptlrpc_body_v2 {
                                OBD_CONNECT_GRANT_PARAM | \
                                OBD_CONNECT_SHORTIO | OBD_CONNECT_FLAGS2)
 
-#define MDT_CONNECT_SUPPORTED2 (OBD_CONNECT2_FILE_SECCTX | OBD_CONNECT2_FLR | \
-                                OBD_CONNECT2_SUM_STATFS | \
+#define MDT_CONNECT_SUPPORTED2 (OBD_CONNECT2_FILE_SECCTX | \
+                               OBD_CONNECT2_DIR_MIGRATE | \
+                               OBD_CONNECT2_SUM_STATFS | \
+                               OBD_CONNECT2_OVERSTRIPING | \
+                               OBD_CONNECT2_FLR |\
                                OBD_CONNECT2_LOCK_CONVERT | \
-                               OBD_CONNECT2_DIR_MIGRATE)
+                               OBD_CONNECT2_ARCHIVE_ID_ARRAY | \
+                               OBD_CONNECT2_INC_XID | \
+                               OBD_CONNECT2_SELINUX_POLICY | \
+                               OBD_CONNECT2_LSOM | \
+                               OBD_CONNECT2_ASYNC_DISCARD | \
+                               OBD_CONNECT2_PCC | \
+                               OBD_CONNECT2_CRUSH)
 
 #define OST_CONNECT_SUPPORTED  (OBD_CONNECT_SRVLOCK | OBD_CONNECT_GRANT | \
                                OBD_CONNECT_REQPORTAL | OBD_CONNECT_VERSION | \
@@ -902,7 +922,7 @@ struct ptlrpc_body_v2 {
                                OBD_CONNECT_GRANT_PARAM | \
                                OBD_CONNECT_SHORTIO | OBD_CONNECT_FLAGS2)
 
-#define OST_CONNECT_SUPPORTED2 OBD_CONNECT2_LOCKAHEAD
+#define OST_CONNECT_SUPPORTED2 (OBD_CONNECT2_LOCKAHEAD | OBD_CONNECT2_INC_XID)
 
 #define ECHO_CONNECT_SUPPORTED (OBD_CONNECT_FID)
 #define ECHO_CONNECT_SUPPORTED2 0
@@ -1027,9 +1047,10 @@ enum ost_cmd {
         OST_SYNC       = 16,
         OST_SET_INFO   = 17,
        OST_QUOTACHECK = 18, /* not used since 2.4 */
-        OST_QUOTACTL   = 19,
+       OST_QUOTACTL   = 19,
        OST_QUOTA_ADJUST_QUNIT = 20, /* not used since 2.4 */
        OST_LADVISE    = 21,
+       OST_FALLOCATE  = 22,
        OST_LAST_OPC /* must be < 33 to avoid MDS_GETATTR */
 };
 #define OST_FIRST_OPC  OST_REPLY
@@ -1075,6 +1096,9 @@ enum obdo_flags {
                              OBD_FL_CKSUM_CRC32C | OBD_FL_CKSUM_T10IP512 |
                              OBD_FL_CKSUM_T10IP4K | OBD_FL_CKSUM_T10CRC512 |
                              OBD_FL_CKSUM_T10CRC4K,
+
+       OBD_FL_NO_QUOTA_ALL = OBD_FL_NO_USRQUOTA | OBD_FL_NO_GRPQUOTA |
+                             OBD_FL_NO_PRJQUOTA,
 };
 
 /*
@@ -1095,6 +1119,8 @@ enum obdo_flags {
 #define LOV_MAGIC_SPECIFIC     (0x0BD50000 | LOV_MAGIC_MAGIC)
 #define LOV_MAGIC              LOV_MAGIC_V1
 #define LOV_MAGIC_COMP_V1      (0x0BD60000 | LOV_MAGIC_MAGIC)
+#define LOV_MAGIC_FOREIGN      (0x0BD70000 | LOV_MAGIC_MAGIC)
+#define LOV_MAGIC_SEL          (0x0BD80000 | LOV_MAGIC_MAGIC)
 
 /*
  * magic for fully defined striping
@@ -1138,7 +1164,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,
@@ -1195,7 +1225,7 @@ static inline __u32 lov_mds_md_size(__u16 stripes, __u32 lmm_magic)
 }
 
 static inline __u32
-lov_mds_md_max_stripe_count(size_t buf_size, __u32 lmm_magic)
+lov_mds_md_max_stripe_count(__kernel_size_t buf_size, __u32 lmm_magic)
 {
        switch (lmm_magic) {
        case LOV_MAGIC_V1: {
@@ -1233,20 +1263,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 */
@@ -1255,7 +1284,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 */
 
@@ -1264,8 +1293,8 @@ lov_mds_md_max_stripe_count(size_t buf_size, __u32 lmm_magic)
 #define OBD_MD_FLXATTRRM     (0x0000004000000000ULL) /* xattr remove */
 #define OBD_MD_FLACL         (0x0000008000000000ULL) /* ACL */
 #define OBD_MD_FLAGSTATFS    (0x0000010000000000ULL) /* aggregated statfs */
-#define OBD_MD_FLMDSCAPA     (0x0000020000000000ULL) /* MDS capability */
-#define OBD_MD_FLOSSCAPA     (0x0000040000000000ULL) /* OSS capability */
+/*     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
@@ -1281,6 +1310,10 @@ lov_mds_md_max_stripe_count(size_t buf_size, __u32 lmm_magic)
 #define OBD_MD_DEFAULT_MEA   (0x0040000000000000ULL) /* default MEA */
 #define OBD_MD_FLOSTLAYOUT   (0x0080000000000000ULL) /* contain ost_layout */
 #define OBD_MD_FLPROJID      (0x0100000000000000ULL) /* project ID */
+#define OBD_MD_SECCTX        (0x0200000000000000ULL) /* embed security xattr */
+
+#define OBD_MD_FLLAZYSIZE    (0x0400000000000000ULL) /* Lazy size */
+#define OBD_MD_FLLAZYBLOCKS  (0x0800000000000000ULL) /* Lazy blocks */
 
 #define OBD_MD_FLALLQUOTA (OBD_MD_FLUSRQUOTA | \
                           OBD_MD_FLGRPQUOTA | \
@@ -1290,7 +1323,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)
@@ -1325,6 +1358,7 @@ struct hsm_state_set {
 #define OBD_BRW_CHECK           0x10
 #define OBD_BRW_FROM_GRANT      0x20 /* the osc manages this under llite */
 #define OBD_BRW_GRANTED         0x40 /* the ost manages this */
+/* OBD_BRW_NOCACHE is currently neither set nor tested */
 #define OBD_BRW_NOCACHE         0x80 /* this page is a part of non-cached IO */
 #define OBD_BRW_NOQUOTA        0x100
 #define OBD_BRW_SRVLOCK        0x200 /* Client holds no lock over this page */
@@ -1337,6 +1371,7 @@ struct hsm_state_set {
                                      * space for unstable pages; asking
                                      * it to sync quickly */
 #define OBD_BRW_OVER_PRJQUOTA 0x8000 /* Running out of project quota */
+#define OBD_BRW_RDMA_ONLY    0x20000 /* RPC contains RDMA-only pages*/
 
 #define OBD_BRW_OVER_ALLQUOTA (OBD_BRW_OVER_USRQUOTA | \
                               OBD_BRW_OVER_GRPQUOTA | \
@@ -1615,6 +1650,7 @@ enum mds_cmd {
        MDS_HSM_CT_REGISTER     = 59,
        MDS_HSM_CT_UNREGISTER   = 60,
        MDS_SWAP_LAYOUTS        = 61,
+       MDS_RMFID               = 62,
        MDS_LAST_OPC
 };
 
@@ -1663,29 +1699,31 @@ enum mds_reint_op {
 #define DISP_OPEN_DENY      0x10000000
 
 /* INODE LOCK PARTS */
-#define MDS_INODELOCK_LOOKUP 0x000001  /* For namespace, dentry etc, and also
-                                        * was used to protect permission (mode,
-                                        * owner, group etc) before 2.4. */
-#define MDS_INODELOCK_UPDATE 0x000002  /* size, links, timestamps */
-#define MDS_INODELOCK_OPEN   0x000004  /* For opened files */
-#define MDS_INODELOCK_LAYOUT 0x000008  /* for layout */
-
-/* The PERM bit is added int 2.4, and it is used to protect permission(mode,
- * owner, group, acl etc), so to separate the permission from LOOKUP lock.
- * Because for remote directories(in DNE), these locks will be granted by
- * different MDTs(different ldlm namespace).
- *
- * For local directory, MDT will always grant UPDATE_LOCK|PERM_LOCK together.
- * For Remote directory, the master MDT, where the remote directory is, will
- * grant UPDATE_LOCK|PERM_LOCK, and the remote MDT, where the name entry is,
- * will grant LOOKUP_LOCK. */
-#define MDS_INODELOCK_PERM   0x000010
-#define MDS_INODELOCK_XATTR  0x000020  /* extended attributes */
-#define MDS_INODELOCK_DOM    0x000040 /* Data for data-on-mdt files */
-
-#define MDS_INODELOCK_MAXSHIFT 6
+enum mds_ibits_locks {
+       MDS_INODELOCK_LOOKUP    = 0x000001, /* For namespace, dentry etc.  Was
+                                            * used to protect permission (mode,
+                                            * owner, group, etc) before 2.4. */
+       MDS_INODELOCK_UPDATE    = 0x000002, /* size, links, timestamps */
+       MDS_INODELOCK_OPEN      = 0x000004, /* For opened files */
+       MDS_INODELOCK_LAYOUT    = 0x000008, /* for layout */
+
+       /* The PERM bit is added in 2.4, and is used to protect permission
+        * (mode, owner, group, ACL, etc.) separate from LOOKUP lock.
+        * For remote directories (in DNE) these locks will be granted by
+        * different MDTs (different LDLM namespace).
+        *
+        * For local directory, the MDT always grants UPDATE|PERM together.
+        * For remote directory, master MDT (where remote directory is) grants
+        * UPDATE|PERM, and remote MDT (where name entry is) grants LOOKUP_LOCK.
+        */
+       MDS_INODELOCK_PERM      = 0x000010,
+       MDS_INODELOCK_XATTR     = 0x000020, /* non-permission extended attrs */
+       MDS_INODELOCK_DOM       = 0x000040, /* Data for Data-on-MDT files */
+       /* Do not forget to increase MDS_INODELOCK_NUMBITS when adding bits */
+};
+#define MDS_INODELOCK_NUMBITS 7
 /* This FULL lock is useful to take on unlink sort of operations */
-#define MDS_INODELOCK_FULL ((1<<(MDS_INODELOCK_MAXSHIFT+1))-1)
+#define MDS_INODELOCK_FULL ((1 << MDS_INODELOCK_NUMBITS) - 1)
 /* DOM lock shouldn't be canceled early, use this macro for ELC */
 #define MDS_INODELOCK_ELC (MDS_INODELOCK_FULL & ~MDS_INODELOCK_DOM)
 
@@ -1707,17 +1745,16 @@ enum {
 enum {
        /* these should be identical to their EXT4_*_FL counterparts, they are
         * redefined here only to avoid dragging in fs/ext4/ext4.h */
-       LUSTRE_SYNC_FL = 0x00000008, /* Synchronous updates */
-       LUSTRE_IMMUTABLE_FL = 0x00000010, /* Immutable file */
-       LUSTRE_APPEND_FL = 0x00000020, /* writes to file may only append */
-       LUSTRE_NODUMP_FL = 0x00000040, /* do not dump file */
-       LUSTRE_NOATIME_FL = 0x00000080, /* do not update atime */
-       LUSTRE_INDEX_FL = 0x00001000, /* hash-indexed directory */
-       LUSTRE_DIRSYNC_FL = 0x00010000, /* dirsync behaviour (dir only) */
-       LUSTRE_TOPDIR_FL = 0x00020000, /* Top of directory hierarchies*/
-       LUSTRE_DIRECTIO_FL = 0x00100000, /* Use direct i/o */
-       LUSTRE_INLINE_DATA_FL = 0x10000000, /* Inode has inline data. */
-       LUSTRE_PROJINHERIT_FL = 0x20000000, /* Create with parents projid */
+       LUSTRE_SYNC_FL          = 0x00000008, /* Synchronous updates */
+       LUSTRE_IMMUTABLE_FL     = 0x00000010, /* Immutable file */
+       LUSTRE_APPEND_FL        = 0x00000020, /* file writes may only append */
+       LUSTRE_NODUMP_FL        = 0x00000040, /* do not dump file */
+       LUSTRE_NOATIME_FL       = 0x00000080, /* do not update atime */
+       LUSTRE_INDEX_FL         = 0x00001000, /* hash-indexed directory */
+       LUSTRE_DIRSYNC_FL       = 0x00010000, /* dirsync behaviour (dir only) */
+       LUSTRE_TOPDIR_FL        = 0x00020000, /* Top of directory hierarchies*/
+       LUSTRE_INLINE_DATA_FL   = 0x10000000, /* Inode has inline data. */
+       LUSTRE_PROJINHERIT_FL   = 0x20000000, /* Create with parents projid */
 
        /* These flags will not be identical to any EXT4_*_FL counterparts,
         * and only reserved for lustre purpose. Note: these flags might
@@ -1726,10 +1763,10 @@ enum {
         * wired by la_flags see osd_attr_get().
         * 2. If these flags needs to be stored into inode, they will be
         * stored in LMA. see LMAI_XXXX */
-       LUSTRE_ORPHAN_FL = 0x00002000,
-       LUSTRE_SET_SYNC_FL = 0x00040000, /* Synchronous setattr on OSTs */
+       LUSTRE_ORPHAN_FL        = 0x00002000,
+       LUSTRE_SET_SYNC_FL      = 0x00040000, /* Synchronous setattr on OSTs */
 
-       LUSTRE_LMA_FL_MASKS = LUSTRE_ORPHAN_FL,
+       LUSTRE_LMA_FL_MASKS     = LUSTRE_ORPHAN_FL,
 };
 
 #ifndef FS_XFLAG_SYNC
@@ -1905,6 +1942,7 @@ struct mdt_rec_setattr {
 #define MDS_ATTR_PROJID            0x10000ULL  /* = 65536 */
 #define MDS_ATTR_LSIZE      0x20000ULL /* = 131072 */
 #define MDS_ATTR_LBLOCKS    0x40000ULL /* = 262144 */
+#define MDS_ATTR_OVERRIDE      0x2000000ULL /* = 33554432 */
 
 enum mds_op_bias {
 /*     MDS_CHECK_SPLIT         = 1 << 0, obsolete before 2.3.58 */
@@ -1926,6 +1964,8 @@ enum mds_op_bias {
        MDS_CLOSE_RESYNC_DONE   = 1 << 16,
        MDS_CLOSE_LAYOUT_SPLIT  = 1 << 17,
        MDS_TRUNC_KEEP_LEASE    = 1 << 18,
+       MDS_PCC_ATTACH          = 1 << 19,
+       MDS_CLOSE_UPDATE_TIMES  = 1 << 20,
 };
 
 #define MDS_CLOSE_INTENT (MDS_HSM_RELEASE | MDS_CLOSE_LAYOUT_SWAP |         \
@@ -1948,7 +1988,10 @@ struct mdt_rec_create {
        struct lu_fid   cr_fid2;
        struct lustre_handle cr_open_handle_old; /* in case of open replay */
        __s64           cr_time;
-       __u64           cr_rdev;
+       union {
+               __u64           cr_rdev;
+               __u32           cr_archive_id;
+       };
        __u64           cr_ioepoch;
        __u64           cr_padding_1;   /* rr_blocks */
        __u32           cr_mode;
@@ -2097,7 +2140,8 @@ struct mdt_rec_resync {
        __u32           rs_padding6;    /* rr_flags */
        __u32           rs_padding7;    /* rr_flags_h */
        __u32           rs_padding8;    /* rr_umask */
-       __u32           rs_padding9;    /* rr_padding_4 */
+       __u16           rs_mirror_id;
+       __u16           rs_padding9;    /* rr_padding_4 */
 };
 
 /*
@@ -2131,9 +2175,12 @@ struct mdt_rec_reint {
        __u32           rr_flags;
        __u32           rr_flags_h;
        __u32           rr_umask;
-       __u32           rr_padding_4; /* also fix lustre_swab_mdt_rec_reint */
+       __u16           rr_mirror_id;
+       __u16           rr_padding_4; /* also fix lustre_swab_mdt_rec_reint */
 };
 
+#define LMV_DESC_QOS_MAXAGE_DEFAULT 60  /* Seconds */
+
 /* lmv structures */
 struct lmv_desc {
        __u32 ld_tgt_count;             /* how many MDS's */
@@ -2177,33 +2224,28 @@ struct lmv_mds_md_v1 {
        struct lu_fid lmv_stripe_fids[0];       /* FIDs for each stripe */
 };
 
+#define LMV_DEBUG(mask, lmv, msg)                                      \
+       CDEBUG(mask, "%s LMV: magic %#x count %u index %u hash %#x version %u migrate offset %u migrate hash %u.\n",    \
+              msg, (lmv)->lmv_magic, (lmv)->lmv_stripe_count,          \
+              (lmv)->lmv_master_mdt_index, (lmv)->lmv_hash_type,       \
+              (lmv)->lmv_layout_version, (lmv)->lmv_migrate_offset,    \
+              (lmv)->lmv_migrate_hash)
+
+/* foreign LMV EA */
+struct lmv_foreign_md {
+       __u32 lfm_magic;        /* magic number = LMV_MAGIC_FOREIGN */
+       __u32 lfm_length;       /* length of lfm_value */
+       __u32 lfm_type;         /* type, see LU_FOREIGN_TYPE_ */
+       __u32 lfm_flags;        /* flags, type specific */
+       char lfm_value[];       /* free format value */
+};
+
 #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. */
-#define LMV_HASH_TYPE_MASK 0x0000ffff
-
-#define LMV_HASH_FLAG_MIGRATION        0x80000000
-
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 11, 56, 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
- * flag when it checks the old FS */
-#define LMV_HASH_FLAG_DEAD     0x40000000
-#endif
-#define LMV_HASH_FLAG_BAD_TYPE 0x20000000
-
-/* The striped directory has ever lost its master LMV EA, then LFSCK
- * re-generated it. This flag is used to indicate such case. It is an
- * on-disk flag. */
-#define LMV_HASH_FLAG_LOST_LMV 0x10000000
+#define LMV_MAGIC_FOREIGN 0x0CD50CD0 /* magic for lmv foreign */
 
 /**
  * The FNV-1a hash algorithm is as follows:
@@ -2219,11 +2261,11 @@ struct lmv_mds_md_v1 {
  **/
 #define LUSTRE_FNV_1A_64_PRIME 0x100000001b3ULL
 #define LUSTRE_FNV_1A_64_OFFSET_BIAS 0xcbf29ce484222325ULL
-static inline __u64 lustre_hash_fnv_1a_64(const void *buf, size_t size)
+static inline __u64 lustre_hash_fnv_1a_64(const void *buf, __kernel_size_t size)
 {
        __u64 hash = LUSTRE_FNV_1A_64_OFFSET_BIAS;
        const unsigned char *p = buf;
-       size_t i;
+       __kernel_size_t i;
 
        for (i = 0; i < size; i++) {
                hash ^= p[i];
@@ -2233,10 +2275,14 @@ static inline __u64 lustre_hash_fnv_1a_64(const void *buf, size_t size)
        return hash;
 }
 
+/* CRUSH placement group count */
+#define LMV_CRUSH_PG_COUNT     4096
+
 union lmv_mds_md {
        __u32                    lmv_magic;
        struct lmv_mds_md_v1     lmv_md_v1;
        struct lmv_user_md       lmv_user_md;
+       struct lmv_foreign_md    lmv_foreign_md;
 };
 
 static inline int lmv_mds_md_size(int stripe_count, unsigned int lmm_magic)
@@ -2523,15 +2569,6 @@ enum mgs_cmd {
        MGS_FIRST_OPC   = MGS_CONNECT
 };
 
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 13, 53, 0)
-#define MGS_PARAM_MAXLEN 1024
-#define KEY_SET_INFO "set_info"
-
-struct mgs_send_param {
-        char             mgs_param[MGS_PARAM_MAXLEN];
-};
-#endif
-
 /* We pass this info to the MGS so it can write config logs */
 #define MTI_NAME_MAXLEN  64
 #define MTI_PARAM_MAXLEN 4096
@@ -2704,12 +2741,12 @@ struct llog_rec_hdr {
        __u32   lrh_index;
        __u32   lrh_type;
        __u32   lrh_id;
-};
+} __attribute__((packed));
 
 struct llog_rec_tail {
        __u32   lrt_len;
        __u32   lrt_index;
-};
+} __attribute__((packed));
 
 /* Where data follow just after header */
 #define REC_DATA(ptr)                                          \
@@ -2903,6 +2940,11 @@ enum llog_flag {
                          LLOG_F_EXT_X_OMODE | LLOG_F_EXT_X_XATTR,
 };
 
+/* means first record of catalog */
+enum {
+       LLOG_CAT_FIRST = -1,
+};
+
 /* On-disk header structure of each log object, stored in little endian order */
 #define LLOG_MIN_CHUNK_SIZE    8192
 #define LLOG_HEADER_SIZE        (96) /* sizeof (llog_log_hdr) + sizeof(llh_tail)
@@ -3044,6 +3086,7 @@ struct obdo {
 #define o_dropped o_misc
 #define o_cksum   o_nlink
 #define o_grant_used o_data_version
+#define o_falloc_mode o_nlink
 
 struct lfsck_request {
        __u32           lr_event;
@@ -3205,67 +3248,6 @@ enum sec_cmd {
         SEC_FIRST_OPC           = SEC_CTX_INIT
 };
 
-/*
- * capa related definitions
- */
-#define CAPA_HMAC_MAX_LEN       64
-#define CAPA_HMAC_KEY_MAX_LEN   56
-
-/* NB take care when changing the sequence of elements this struct,
- * because the offset info is used in find_capa() */
-struct lustre_capa {
-        struct lu_fid   lc_fid;         /** fid */
-        __u64           lc_opc;         /** operations allowed */
-        __u64           lc_uid;         /** file owner */
-        __u64           lc_gid;         /** file group */
-        __u32           lc_flags;       /** HMAC algorithm & flags */
-        __u32           lc_keyid;       /** key# used for the capability */
-        __u32           lc_timeout;     /** capa timeout value (sec) */
-        __u32           lc_expiry;      /** expiry time (sec) */
-        __u8            lc_hmac[CAPA_HMAC_MAX_LEN];   /** HMAC */
-} __attribute__((packed));
-
-/** lustre_capa::lc_opc */
-enum {
-        CAPA_OPC_BODY_WRITE   = 1<<0,  /**< write object data */
-        CAPA_OPC_BODY_READ    = 1<<1,  /**< read object data */
-        CAPA_OPC_INDEX_LOOKUP = 1<<2,  /**< lookup object fid */
-        CAPA_OPC_INDEX_INSERT = 1<<3,  /**< insert object fid */
-        CAPA_OPC_INDEX_DELETE = 1<<4,  /**< delete object fid */
-        CAPA_OPC_OSS_WRITE    = 1<<5,  /**< write oss object data */
-        CAPA_OPC_OSS_READ     = 1<<6,  /**< read oss object data */
-        CAPA_OPC_OSS_TRUNC    = 1<<7,  /**< truncate oss object */
-        CAPA_OPC_OSS_DESTROY  = 1<<8,  /**< destroy oss object */
-        CAPA_OPC_META_WRITE   = 1<<9,  /**< write object meta data */
-        CAPA_OPC_META_READ    = 1<<10, /**< read object meta data */
-};
-
-#define CAPA_OPC_OSS_RW (CAPA_OPC_OSS_READ | CAPA_OPC_OSS_WRITE)
-#define CAPA_OPC_MDS_ONLY                                                   \
-        (CAPA_OPC_BODY_WRITE | CAPA_OPC_BODY_READ | CAPA_OPC_INDEX_LOOKUP | \
-         CAPA_OPC_INDEX_INSERT | CAPA_OPC_INDEX_DELETE)
-#define CAPA_OPC_OSS_ONLY                                                   \
-        (CAPA_OPC_OSS_WRITE | CAPA_OPC_OSS_READ | CAPA_OPC_OSS_TRUNC |      \
-         CAPA_OPC_OSS_DESTROY)
-#define CAPA_OPC_MDS_DEFAULT ~CAPA_OPC_OSS_ONLY
-#define CAPA_OPC_OSS_DEFAULT ~(CAPA_OPC_MDS_ONLY | CAPA_OPC_OSS_ONLY)
-
-/* lustre_capa::lc_hmac_alg */
-enum {
-        CAPA_HMAC_ALG_SHA1 = 1, /**< sha1 algorithm */
-        CAPA_HMAC_ALG_MAX,
-};
-
-#define CAPA_FL_MASK            0x00ffffff
-#define CAPA_HMAC_ALG_MASK      0xff000000
-
-struct lustre_capa_key {
-        __u64   lk_seq;       /**< mds# */
-        __u32   lk_keyid;     /**< key# */
-        __u32   lk_padding;
-        __u8    lk_key[CAPA_HMAC_KEY_MAX_LEN];    /**< key */
-} __attribute__((packed));
-
 /** The link ea holds 1 \a link_ea_entry for each hardlink */
 #define LINK_EA_MAGIC 0x11EAF1DFUL
 struct link_ea_header {
@@ -3284,7 +3266,7 @@ struct link_ea_entry {
         unsigned char      lee_reclen[2];
         unsigned char      lee_parent_fid[sizeof(struct lu_fid)];
         char               lee_name[0];
-}__attribute__((packed));
+} __attribute__((packed));
 
 /** fid2path request/reply structure */
 struct getinfo_fid2path {
@@ -3501,6 +3483,8 @@ struct close_data {
                struct close_data_resync_done   cd_resync;
                /* split close */
                __u16                           cd_mirror_id;
+               /* PCC release */
+               __u32                           cd_archive_id;
        };
 };
 
@@ -3510,7 +3494,7 @@ struct update_op {
        __u16           uop_type;
        __u16           uop_param_count;
        __u16           uop_params_off[0];
-};
+} __attribute__((packed));
 
 struct update_ops {
        struct update_op        uops_op[0];
@@ -3561,6 +3545,19 @@ struct llog_update_record {
        */
 };
 
+/* sepol string format is:
+ * <1-digit for SELinux status>:<policy name>:<policy version>:<policy hash>
+ */
+/* Max length of the sepol string
+ * Should be large enough to contain a sha512sum of the policy
+ */
+#define SELINUX_MODE_LEN 1
+#define SELINUX_POLICY_VER_LEN 3 /* 3 chars to leave room for the future */
+#define SELINUX_POLICY_HASH_LEN 64
+#define LUSTRE_NODEMAP_SEPOL_LENGTH (SELINUX_MODE_LEN + NAME_MAX + \
+                                    SELINUX_POLICY_VER_LEN + \
+                                    SELINUX_POLICY_HASH_LEN + 3)
+
 /* nodemap records, uses 32 byte record length */
 #define LUSTRE_NODEMAP_NAME_LENGTH 16
 struct nodemap_cluster_rec {