Whamcloud - gitweb
LU-10499 pcc: introducing OBD_CONNECT2_PCCRO flag
[fs/lustre-release.git] / lustre / include / uapi / linux / lustre / lustre_idl.h
index 3d392d1..d9e0f66 100644 (file)
@@ -27,9 +27,6 @@
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- *
- * lustre/include/lustre/lustre_idl.h
  *
  * Lustre wire protocol definitions.
  */
@@ -42,7 +39,7 @@
  * that are used in interfaces with userspace should go in lustre_user.h.
  *
  * All structs being declared here should be built from simple fixed-size
- * types (__u8, __u16, __u32, __u64) or be built from other types or
+ * types defined in linux/types.h or be built from other types or
  * structs also declared in this file.  Similarly, all flags and magic
  * values in those structs should also be declared here.  This ensures
  * that the Lustre wire protocol is not influenced by external dependencies.
 
 #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/lnet/lnet-types.h>
+#include <linux/lustre/lustre_user.h>
+#include <linux/lustre/lustre_ver.h>
 
 #if defined(__cplusplus)
 extern "C" {
@@ -101,15 +88,15 @@ extern "C" {
 
 #define CONNMGR_REQUEST_PORTAL          1
 #define CONNMGR_REPLY_PORTAL            2
-//#define OSC_REQUEST_PORTAL            3
+/* #define OSC_REQUEST_PORTAL           3*/
 #define OSC_REPLY_PORTAL                4
-//#define OSC_BULK_PORTAL               5
+/*#define OSC_BULK_PORTAL               5*/
 #define OST_IO_PORTAL                   6
 #define OST_CREATE_PORTAL               7
 #define OST_BULK_PORTAL                 8
-//#define MDC_REQUEST_PORTAL            9
+/*#define MDC_REQUEST_PORTAL            9*/
 #define MDC_REPLY_PORTAL               10
-//#define MDC_BULK_PORTAL              11
+/*#define MDC_BULK_PORTAL              11*/
 #define MDS_REQUEST_PORTAL             12
 #define MDS_IO_PORTAL                  13
 #define MDS_BULK_PORTAL                14
@@ -117,9 +104,9 @@ extern "C" {
 #define LDLM_CB_REPLY_PORTAL           16
 #define LDLM_CANCEL_REQUEST_PORTAL     17
 #define LDLM_CANCEL_REPLY_PORTAL       18
-//#define PTLBD_REQUEST_PORTAL           19
-//#define PTLBD_REPLY_PORTAL             20
-//#define PTLBD_BULK_PORTAL              21
+/*#define PTLBD_REQUEST_PORTAL         19*/
+/*#define PTLBD_REPLY_PORTAL           20*/
+/*#define PTLBD_BULK_PORTAL            21*/
 #define MDS_SETATTR_PORTAL             22
 #define MDS_READPAGE_PORTAL            23
 #define OUT_PORTAL                     24
@@ -528,12 +515,12 @@ 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;
+               const __kernel_size_t align = sizeof(struct luda_type) - 1;
 
                size = (sizeof(struct lu_dirent) + namelen + 1 + align) &
                       ~align;
@@ -545,6 +532,24 @@ static inline size_t lu_dirent_calc_size(size_t namelen, __u16 attr)
        return (size + 7) & ~7;
 }
 
+static inline __u16 lu_dirent_type_get(struct lu_dirent *ent)
+{
+       __u16 type = 0;
+       struct luda_type *lt;
+       int len = 0;
+
+       if (__le32_to_cpu(ent->lde_attrs) & LUDA_TYPE) {
+               const unsigned int align = sizeof(struct luda_type) - 1;
+
+               len = __le16_to_cpu(ent->lde_namelen);
+               len = (len + align) & ~align;
+               lt = (void *)ent->lde_name + len;
+               type = __le16_to_cpu(lt->lt_type);
+       }
+
+       return type;
+}
+
 #define MDS_DIR_END_OFF 0xfffffffffffffffeULL
 
 /**
@@ -818,7 +823,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
@@ -829,29 +834,36 @@ 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_PLAIN_LAYOUT      0x2000ULL /* Plain Directory Layout */
-
+#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 */
+#define OBD_CONNECT2_FIDMAP           0x10000ULL /* FID map */
+#define OBD_CONNECT2_GETATTR_PFID      0x20000ULL /* pack parent FID in getattr */
+#define OBD_CONNECT2_LSEEK            0x40000ULL /* SEEK_HOLE/DATA RPC */
+#define OBD_CONNECT2_DOM_LVB          0x80000ULL /* pack DOM glimpse data in LVB */
+#define OBD_CONNECT2_REP_MBITS       0x100000ULL /* match reply mbits not xid*/
+#define OBD_CONNECT2_MODE_CONVERT     0x200000ULL /* LDLM mode convert */
+#define OBD_CONNECT2_BATCH_RPC        0x400000ULL /* Multi-RPC batch request */
+#define OBD_CONNECT2_PCCRO           0x800000ULL /* Read-only PCC */
+#define OBD_CONNECT2_ATOMIC_OPEN_LOCK 0x4000000ULL/* request lock on 1st open */
 /* 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. */
-
-/* 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
- * between 2.2 and 2.3 x86/ppc nodes, and can be removed when interop for
- * 2.2 clients/servers is no longer needed.  LU-1252/LU-1644. */
-#define OBD_CONNECT_MNE_SWAB            OBD_CONNECT_MDS_MDS
+ * 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.
+ */
 
 #define OCD_HAS_FLAG(ocd, flg)  \
         (!!((ocd)->ocd_connect_flags & OBD_CONNECT_##flg))
@@ -887,13 +899,24 @@ 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 | \
-                               OBD_CONNECT2_LOCK_CONVERT | \
+#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_ARCHIVE_ID_ARRAY | \
+                               OBD_CONNECT2_INC_XID | \
                                OBD_CONNECT2_SELINUX_POLICY | \
-                               OBD_CONNECT2_LSOM)
+                               OBD_CONNECT2_LSOM | \
+                               OBD_CONNECT2_ASYNC_DISCARD | \
+                               OBD_CONNECT2_PCC | \
+                               OBD_CONNECT2_CRUSH | \
+                               OBD_CONNECT2_ENCRYPT | \
+                               OBD_CONNECT2_GETATTR_PFID |\
+                               OBD_CONNECT2_LSEEK | OBD_CONNECT2_DOM_LVB |\
+                               OBD_CONNECT2_REP_MBITS | \
+                               OBD_CONNECT2_ATOMIC_OPEN_LOCK)
 
 #define OST_CONNECT_SUPPORTED  (OBD_CONNECT_SRVLOCK | OBD_CONNECT_GRANT | \
                                OBD_CONNECT_REQPORTAL | OBD_CONNECT_VERSION | \
@@ -914,17 +937,20 @@ 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 |\
+                               OBD_CONNECT2_ENCRYPT | OBD_CONNECT2_LSEEK |\
+                               OBD_CONNECT2_REP_MBITS)
 
-#define ECHO_CONNECT_SUPPORTED (OBD_CONNECT_FID)
-#define ECHO_CONNECT_SUPPORTED2 0
+#define ECHO_CONNECT_SUPPORTED (OBD_CONNECT_FID | OBD_CONNECT_FLAGS2)
+#define ECHO_CONNECT_SUPPORTED2 OBD_CONNECT2_REP_MBITS
 
 #define MGS_CONNECT_SUPPORTED  (OBD_CONNECT_VERSION | OBD_CONNECT_AT | \
                                OBD_CONNECT_FULL20 | OBD_CONNECT_IMP_RECOV | \
-                               OBD_CONNECT_MNE_SWAB | OBD_CONNECT_PINGLESS |\
-                               OBD_CONNECT_BULK_MBITS | OBD_CONNECT_BARRIER)
+                               OBD_CONNECT_PINGLESS |\
+                               OBD_CONNECT_BULK_MBITS | OBD_CONNECT_BARRIER | \
+                               OBD_CONNECT_FLAGS2)
 
-#define MGS_CONNECT_SUPPORTED2 0
+#define MGS_CONNECT_SUPPORTED2 OBD_CONNECT2_REP_MBITS
 
 /* Features required for this version of the client to work with server */
 #define CLIENT_CONNECT_MDT_REQD (OBD_CONNECT_FID |     \
@@ -1039,9 +1065,11 @@ 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_SEEK       = 23,
        OST_LAST_OPC /* must be < 33 to avoid MDS_GETATTR */
 };
 #define OST_FIRST_OPC  OST_REPLY
@@ -1110,6 +1138,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
@@ -1185,6 +1215,8 @@ struct lov_mds_md_v1 {            /* LOV EA mds/wire data (little-endian) */
 #define XATTR_NAME_LFSCK_BITMAP "trusted.lfsck_bitmap"
 #define XATTR_NAME_DUMMY       "trusted.dummy"
 
+#define LL_XATTR_NAME_ENCRYPTION_CONTEXT XATTR_SECURITY_PREFIX"c"
+
 #define XATTR_NAME_LFSCK_NAMESPACE "trusted.lfsck_ns"
 #define XATTR_NAME_MAX_LEN     32 /* increase this, if there is longer name. */
 
@@ -1214,7 +1246,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: {
@@ -1300,9 +1332,10 @@ lov_mds_md_max_stripe_count(size_t buf_size, __u32 lmm_magic)
 #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_FLLSIZE       (0x0200000000000000ULL) /* Lazy size */
-#define OBD_MD_FLLBLOCKS     (0x0400000000000000ULL) /* Lazy blocks */
+#define OBD_MD_FLLAZYSIZE    (0x0400000000000000ULL) /* Lazy size */
+#define OBD_MD_FLLAZYBLOCKS  (0x0800000000000000ULL) /* Lazy blocks */
+#define OBD_MD_FLBTIME       (0x1000000000000000ULL) /* birth time */
+#define OBD_MD_ENCCTX        (0x2000000000000000ULL) /* embed encryption ctx */
 
 #define OBD_MD_FLALLQUOTA (OBD_MD_FLUSRQUOTA | \
                           OBD_MD_FLGRPQUOTA | \
@@ -1313,7 +1346,7 @@ lov_mds_md_max_stripe_count(size_t buf_size, __u32 lmm_magic)
                          OBD_MD_FLMODE  | OBD_MD_FLTYPE  | OBD_MD_FLUID   | \
                          OBD_MD_FLGID   | OBD_MD_FLFLAGS | OBD_MD_FLNLINK | \
                          OBD_MD_FLPARENT | OBD_MD_FLRDEV  | OBD_MD_FLGROUP | \
-                         OBD_MD_FLPROJID)
+                         OBD_MD_FLPROJID | OBD_MD_FLBTIME)
 
 #define OBD_MD_FLXATTRALL (OBD_MD_FLXATTR | OBD_MD_FLXATTRLS)
 
@@ -1347,6 +1380,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 */
@@ -1359,17 +1393,22 @@ 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 | \
                               OBD_BRW_OVER_PRJQUOTA)
 
+#define OBD_BRW_DONE   0x40000000UL   /*
+                                       * osd-ldiskfs inernal,
+                                       * IO has been issued before
+                                       */
 #define OBD_BRW_LOCAL1 0x80000000UL    /*
                                         * osd-ldiskfs internal,
                                         * page mapped to real block
                                         */
 
-#define OBD_BRW_LOCALS (OBD_BRW_LOCAL1)
+#define OBD_BRW_LOCALS (OBD_BRW_LOCAL1 | OBD_BRW_DONE)
 
 #define OBD_MAX_GRANT 0x7fffffffUL /* Max grant allowed to one client: 2 GiB */
 
@@ -1469,18 +1508,23 @@ struct obd_quotactl {
        __u32                   qc_stat;
        struct obd_dqinfo       qc_dqinfo;
        struct obd_dqblk        qc_dqblk;
+       char                    qc_poolname[0];
 };
 
 #define Q_COPY(out, in, member) (out)->member = (in)->member
 
-#define QCTL_COPY(out, in)             \
-do {                                   \
-       Q_COPY(out, in, qc_cmd);        \
-       Q_COPY(out, in, qc_type);       \
-       Q_COPY(out, in, qc_id);         \
-       Q_COPY(out, in, qc_stat);       \
-       Q_COPY(out, in, qc_dqinfo);     \
-       Q_COPY(out, in, qc_dqblk);      \
+#define QCTL_COPY(out, in)                             \
+do {                                                   \
+       Q_COPY(out, in, qc_cmd);                        \
+       Q_COPY(out, in, qc_type);                       \
+       Q_COPY(out, in, qc_id);                         \
+       Q_COPY(out, in, qc_stat);                       \
+       Q_COPY(out, in, qc_dqinfo);                     \
+       Q_COPY(out, in, qc_dqblk);                      \
+       if (LUSTRE_Q_CMD_IS_POOL(in->qc_cmd))           \
+               memcpy(out->qc_poolname,                \
+                      in->qc_poolname,                 \
+                      LOV_MAXPOOLNAME + 1);            \
 } while (0)
 
 /* Body of quota request used for quota acquire/release RPCs between quota
@@ -1637,6 +1681,7 @@ enum mds_cmd {
        MDS_HSM_CT_REGISTER     = 59,
        MDS_HSM_CT_UNREGISTER   = 60,
        MDS_SWAP_LAYOUTS        = 61,
+       MDS_RMFID               = 62,
        MDS_LAST_OPC
 };
 
@@ -1685,29 +1730,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)
 
@@ -1737,7 +1784,6 @@ enum {
        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 */
 
@@ -1750,8 +1796,9 @@ enum {
         * stored in LMA. see LMAI_XXXX */
        LUSTRE_ORPHAN_FL        = 0x00002000,
        LUSTRE_SET_SYNC_FL      = 0x00040000, /* Synchronous setattr on OSTs */
+       LUSTRE_ENCRYPT_FL       = 0x00800000, /* encrypted file */
 
-       LUSTRE_LMA_FL_MASKS     = LUSTRE_ORPHAN_FL,
+       LUSTRE_LMA_FL_MASKS     = LUSTRE_ENCRYPT_FL | LUSTRE_ORPHAN_FL,
 };
 
 #ifndef FS_XFLAG_SYNC
@@ -1770,52 +1817,6 @@ enum {
 #define FS_XFLAG_PROJINHERIT   0x00000200      /* create with parents projid */
 #endif
 
-#ifdef __KERNEL__
-/* Convert wire LUSTRE_*_FL to corresponding client local VFS S_* values
- * for the client inode i_flags.  The LUSTRE_*_FL are the Lustre wire
- * protocol equivalents of LDISKFS_*_FL values stored on disk, while
- * the S_* flags are kernel-internal values that change between kernel
- * versions.  These flags are set/cleared via FSFILT_IOC_{GET,SET}_FLAGS.
- * See b=16526 for a full history. */
-static inline int ll_ext_to_inode_flags(int flags)
-{
-        return (((flags & LUSTRE_SYNC_FL)      ? S_SYNC      : 0) |
-                ((flags & LUSTRE_NOATIME_FL)   ? S_NOATIME   : 0) |
-                ((flags & LUSTRE_APPEND_FL)    ? S_APPEND    : 0) |
-#if defined(S_DIRSYNC)
-                ((flags & LUSTRE_DIRSYNC_FL)   ? S_DIRSYNC   : 0) |
-#endif
-               ((flags & LUSTRE_IMMUTABLE_FL) ? S_IMMUTABLE : 0));
-}
-
-static inline int ll_inode_to_ext_flags(int iflags)
-{
-        return (((iflags & S_SYNC)      ? LUSTRE_SYNC_FL      : 0) |
-                ((iflags & S_NOATIME)   ? LUSTRE_NOATIME_FL   : 0) |
-                ((iflags & S_APPEND)    ? LUSTRE_APPEND_FL    : 0) |
-#if defined(S_DIRSYNC)
-                ((iflags & S_DIRSYNC)   ? LUSTRE_DIRSYNC_FL   : 0) |
-#endif
-               ((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
-
 /* 64 possible states */
 enum md_transient_state {
        MS_RESTORE      = (1 << 0),     /* restore is running */
@@ -1841,7 +1842,9 @@ struct mdt_body {
        __u32   mbo_mode;
        __u32   mbo_uid;
        __u32   mbo_gid;
-       __u32   mbo_flags;   /* LUSTRE_*_FL file attributes */
+       __u32   mbo_flags; /* most replies: LUSTRE_*_FL file attributes,
+                           * data_version: OBD_FL_* flags
+                           */
        __u32   mbo_rdev;
        __u32   mbo_nlink; /* #bytes to read in the case of MDS_READPAGE */
        __u32   mbo_layout_gen; /* was "generation" until 2.4.0 */
@@ -1855,8 +1858,8 @@ struct mdt_body {
        __u32   mbo_projid;
        __u64   mbo_dom_size; /* size of DOM component */
        __u64   mbo_dom_blocks; /* blocks consumed by DOM component */
-       __u64   mbo_padding_8; /* also fix lustre_swab_mdt_body */
-       __u64   mbo_padding_9;
+       __u64   mbo_btime;
+       __u64   mbo_padding_9; /* also fix lustre_swab_mdt_body */
        __u64   mbo_padding_10;
 }; /* 216 */
 
@@ -1908,29 +1911,38 @@ struct mdt_rec_setattr {
  * since the client and MDS may run different kernels (see bug 13828)
  * Therefore, we should only use MDS_ATTR_* attributes for sa_valid.
  */
-#define MDS_ATTR_MODE          0x1ULL /* = 1 */
-#define MDS_ATTR_UID           0x2ULL /* = 2 */
-#define MDS_ATTR_GID           0x4ULL /* = 4 */
-#define MDS_ATTR_SIZE          0x8ULL /* = 8 */
-#define MDS_ATTR_ATIME        0x10ULL /* = 16 */
-#define MDS_ATTR_MTIME        0x20ULL /* = 32 */
-#define MDS_ATTR_CTIME        0x40ULL /* = 64 */
-#define MDS_ATTR_ATIME_SET    0x80ULL /* = 128 */
-#define MDS_ATTR_MTIME_SET   0x100ULL /* = 256 */
-#define MDS_ATTR_FORCE       0x200ULL /* = 512, Not a change, but a change it */
-#define MDS_ATTR_ATTR_FLAG   0x400ULL /* = 1024 */
-#define MDS_ATTR_KILL_SUID   0x800ULL /* = 2048 */
-#define MDS_ATTR_KILL_SGID  0x1000ULL /* = 4096 */
-#define MDS_ATTR_CTIME_SET  0x2000ULL /* = 8192 */
-#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 */
-#define MDS_ATTR_OVERRIDE      0x2000000ULL /* = 33554432 */
+enum mds_attr_flags {
+       MDS_ATTR_MODE =               0x1ULL, /* = 1 */
+       MDS_ATTR_UID =                0x2ULL, /* = 2 */
+       MDS_ATTR_GID =                0x4ULL, /* = 4 */
+       MDS_ATTR_SIZE =               0x8ULL, /* = 8 */
+       MDS_ATTR_ATIME =             0x10ULL, /* = 16 */
+       MDS_ATTR_MTIME =             0x20ULL, /* = 32 */
+       MDS_ATTR_CTIME =             0x40ULL, /* = 64 */
+       MDS_ATTR_ATIME_SET =         0x80ULL, /* = 128 */
+       MDS_ATTR_MTIME_SET =        0x100ULL, /* = 256 */
+       MDS_ATTR_FORCE =            0x200ULL, /* = 512, change it */
+       MDS_ATTR_ATTR_FLAG =        0x400ULL, /* = 1024 */
+       MDS_ATTR_KILL_SUID =        0x800ULL, /* = 2048 */
+       MDS_ATTR_KILL_SGID =       0x1000ULL, /* = 4096 */
+       MDS_ATTR_CTIME_SET =       0x2000ULL, /* = 8192 */
+       MDS_ATTR_FROM_OPEN =       0x4000ULL, /* = 16384, from open O_TRUNC */
+       MDS_ATTR_BLOCKS =          0x8000ULL, /* = 32768 */
+       MDS_ATTR_PROJID =         0x10000ULL, /* = 65536 */
+       MDS_ATTR_LSIZE =          0x20000ULL, /* = 131072 */
+       MDS_ATTR_LBLOCKS =        0x40000ULL, /* = 262144 */
+       MDS_ATTR_OVERRIDE =     0x2000000ULL, /* = 33554432 */
+};
 
 enum mds_op_bias {
 /*     MDS_CHECK_SPLIT         = 1 << 0, obsolete before 2.3.58 */
+       /* used for remote object getattr/open by name: in the original
+        * getattr/open request, MDT found the object against name is on another
+        * MDT, then packed FID and LOOKUP lock in reply and returned -EREMOTE,
+        * and client knew it's a remote object, then set this flag in
+        * getattr/open request and sent to the corresponding MDT to finish
+        * getattr/open, which fetched attributes and UPDATE lock/opened file.
+        */
        MDS_CROSS_REF           = 1 << 1,
 /*     MDS_VTX_BYPASS          = 1 << 2, obsolete since 2.3.54 */
        MDS_PERM_BYPASS         = 1 << 3,
@@ -1949,6 +1961,10 @@ 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,
+       /* setstripe create only, don't restripe if target exists */
+       MDS_SETSTRIPE_CREATE    = 1 << 21,
 };
 
 #define MDS_CLOSE_INTENT (MDS_HSM_RELEASE | MDS_CLOSE_LAYOUT_SWAP |         \
@@ -1971,7 +1987,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;
@@ -2159,6 +2178,8 @@ struct mdt_rec_reint {
        __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 */
@@ -2202,33 +2223,28 @@ struct lmv_mds_md_v1 {
        struct lu_fid lmv_stripe_fids[0];       /* FIDs for each stripe */
 };
 
+/* stripe count before directory split */
+#define lmv_split_offset       lmv_migrate_offset
+/* stripe count after directory merge */
+#define lmv_merge_offset       lmv_migrate_offset
+/* directory hash type after merge */
+#define lmv_merge_hash         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, 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
- * 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:
@@ -2244,11 +2260,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];
@@ -2258,24 +2274,32 @@ 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)
+static inline __kernel_ssize_t lmv_mds_md_size(int stripe_count,
+                                              unsigned int lmm_magic)
 {
+       __kernel_ssize_t len = -EINVAL;
+
        switch (lmm_magic) {
-       case LMV_MAGIC_V1:{
+       case LMV_MAGIC_V1: {
                struct lmv_mds_md_v1 *lmm1;
 
-               return sizeof(*lmm1) + stripe_count *
-                                      sizeof(lmm1->lmv_stripe_fids[0]);
-       }
+               len = sizeof(*lmm1);
+               len += stripe_count * sizeof(lmm1->lmv_stripe_fids[0]);
+               break; }
        default:
-               return -EINVAL;
+               break;
        }
+       return len;
 }
 
 static inline int lmv_mds_md_stripe_count_get(const union lmv_mds_md *lmm)
@@ -2435,6 +2459,7 @@ struct ldlm_inodebits {
                __u64 try_bits; /* optional bits to try */
                __u64 cancel_bits; /* for lock convert */
        };
+       __u64 li_gid;
 };
 
 struct ldlm_flock_wire {
@@ -2548,12 +2573,12 @@ enum mgs_cmd {
        MGS_FIRST_OPC   = MGS_CONNECT
 };
 
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 13, 53, 0)
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 18, 53, 0)
 #define MGS_PARAM_MAXLEN 1024
 #define KEY_SET_INFO "set_info"
 
 struct mgs_send_param {
-        char             mgs_param[MGS_PARAM_MAXLEN];
+       char            mgs_param[MGS_PARAM_MAXLEN];
 };
 #endif
 
@@ -2589,20 +2614,20 @@ struct mgs_nidtbl_entry {
         } u;
 };
 
-enum {
-       CONFIG_T_CONFIG  = 0,
-       CONFIG_T_SPTLRPC = 1,
-       CONFIG_T_RECOVER = 2,
-       CONFIG_T_PARAMS  = 3,
-       CONFIG_T_NODEMAP = 4,
-       CONFIG_T_BARRIER = 5,
-       CONFIG_T_MAX
+enum mgs_cfg_type {
+       MGS_CFG_T_CONFIG        = 0,
+       MGS_CFG_T_SPTLRPC       = 1,
+       MGS_CFG_T_RECOVER       = 2,
+       MGS_CFG_T_PARAMS        = 3,
+       MGS_CFG_T_NODEMAP       = 4,
+       MGS_CFG_T_BARRIER       = 5,
+       MGS_CFG_T_MAX
 };
 
 struct mgs_config_body {
        char     mcb_name[MTI_NAME_MAXLEN]; /* logname */
        __u64    mcb_offset;    /* next index of config log to request */
-       __u16    mcb_type;      /* type of log: CONFIG_T_[CONFIG|RECOVER] */
+       __u16    mcb_type;      /* type of log: MGS_CFG_T_[CONFIG|RECOVER] */
        __u8     mcb_nm_cur_pass;
        __u8     mcb_bits;      /* bits unit size of config log */
        __u32    mcb_units;     /* # of units for bulk transfer */
@@ -2711,6 +2736,7 @@ enum llog_op_type {
        /* LLOG_JOIN_REC        = LLOG_OP_MAGIC | 0x50000, obsolete  1.8.0 */
        CHANGELOG_REC           = LLOG_OP_MAGIC | 0x60000,
        CHANGELOG_USER_REC      = LLOG_OP_MAGIC | 0x70000,
+       CHANGELOG_USER_REC2     = LLOG_OP_MAGIC | 0x70002,
        HSM_AGENT_REC           = LLOG_OP_MAGIC | 0x80000,
        UPDATE_REC              = LLOG_OP_MAGIC | 0xa0000,
        LLOG_HDR_MAGIC          = LLOG_OP_MAGIC | 0x45539,
@@ -2729,12 +2755,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)                                          \
@@ -2811,9 +2837,9 @@ struct llog_size_change_rec {
 #define CHANGELOG_MAGIC 0xca103000
 
 /** \a changelog_rec_type's that can't be masked */
-#define CHANGELOG_MINMASK (1 << CL_MARK)
+#define CHANGELOG_MINMASK BIT(CL_MARK)
 /** bits covering all \a changelog_rec_type's */
-#define CHANGELOG_ALLMASK 0XFFFFFFFF
+#define CHANGELOG_ALLMASK (BIT(CL_LAST) - 1)
 /** default \a changelog_rec_type mask. Allow all of them, except
  * CL_ATIME since it can really be time consuming, and not necessary
  * under normal use.
@@ -2821,8 +2847,7 @@ struct llog_size_change_rec {
  * be costly and only necessary for audit purpose.
  */
 #define CHANGELOG_DEFMASK (CHANGELOG_ALLMASK & \
-                          ~(1 << CL_ATIME | 1 << CL_OPEN | 1 << CL_GETXATTR | \
-                            1 << CL_DN_OPEN))
+       ~(BIT(CL_ATIME) | BIT(CL_OPEN) | BIT(CL_GETXATTR) | BIT(CL_DN_OPEN)))
 
 /* changelog llog name, needed by client replicators */
 #define CHANGELOG_CATALOG "changelog_catalog"
@@ -2840,6 +2865,8 @@ struct llog_changelog_rec {
 } __attribute__((packed));
 
 #define CHANGELOG_USER_PREFIX "cl"
+#define CHANGELOG_USER_NAMELEN 16 /* base name including NUL terminator */
+#define CHANGELOG_USER_NAMELEN_FULL 30 /* basename plus 'cl$ID-' prefix */
 
 struct llog_changelog_user_rec {
        struct llog_rec_hdr   cur_hdr;
@@ -2851,6 +2878,21 @@ struct llog_changelog_user_rec {
        struct llog_rec_tail  cur_tail;
 } __attribute__((packed));
 
+/* this is twice the size of CHANGELOG_USER_REC */
+struct llog_changelog_user_rec2 {
+       struct llog_rec_hdr     cur_hdr;
+       __u32                   cur_id;
+       /* only for use in relative time comparisons to detect idle users */
+       __u32                   cur_time;
+       __u64                   cur_endrec;
+       __u32                   cur_mask;
+       __u32                   cur_padding1;
+       char                    cur_name[CHANGELOG_USER_NAMELEN];
+       __u64                   cur_padding2;
+       __u64                   cur_padding3;
+       struct llog_rec_tail    cur_tail;
+} __attribute__((packed));
+
 enum agent_req_status {
        ARS_WAITING,
        ARS_STARTED,
@@ -2918,6 +2960,7 @@ enum llog_flag {
        LLOG_F_EXT_X_NID        = 0x80,
        LLOG_F_EXT_X_OMODE      = 0x100,
        LLOG_F_EXT_X_XATTR      = 0x200,
+       LLOG_F_RM_ON_ERR        = 0x400,
 
        /* Note: Flags covered by LLOG_F_EXT_MASK will be inherited from
         * catlog to plain log, so do not add LLOG_F_IS_FIXSIZE here,
@@ -3074,6 +3117,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;
@@ -3235,67 +3279,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 {
@@ -3314,7 +3297,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 {
@@ -3531,6 +3514,8 @@ struct close_data {
                struct close_data_resync_done   cd_resync;
                /* split close */
                __u16                           cd_mirror_id;
+               /* PCC release */
+               __u32                           cd_archive_id;
        };
 };
 
@@ -3539,8 +3524,8 @@ struct update_op {
        struct lu_fid   uop_fid;
        __u16           uop_type;
        __u16           uop_param_count;
-       __u16           uop_params_off[0];
-};
+       __u16           uop_params_off[];
+} __attribute__((packed));
 
 struct update_ops {
        struct update_op        uops_op[0];