Whamcloud - gitweb
LU-10499 pcc: introducing OBD_CONNECT2_PCCRO flag
[fs/lustre-release.git] / lustre / include / uapi / linux / lustre / lustre_idl.h
index 1a55c84..d9e0f66 100644 (file)
@@ -27,7 +27,6 @@
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  *
  * Lustre wire protocol definitions.
  */
@@ -849,6 +848,13 @@ struct ptlrpc_body_v2 {
 #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
@@ -906,7 +912,11 @@ struct ptlrpc_body_v2 {
                                OBD_CONNECT2_ASYNC_DISCARD | \
                                OBD_CONNECT2_PCC | \
                                OBD_CONNECT2_CRUSH | \
-                               OBD_CONNECT2_ENCRYPT)
+                               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 | \
@@ -928,17 +938,19 @@ struct ptlrpc_body_v2 {
                                OBD_CONNECT_SHORTIO | OBD_CONNECT_FLAGS2)
 
 #define OST_CONNECT_SUPPORTED2 (OBD_CONNECT2_LOCKAHEAD | OBD_CONNECT2_INC_XID |\
-                               OBD_CONNECT2_ENCRYPT)
+                               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_PINGLESS |\
-                               OBD_CONNECT_BULK_MBITS | OBD_CONNECT_BARRIER)
+                               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 |     \
@@ -1057,6 +1069,7 @@ enum ost_cmd {
        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
@@ -1386,12 +1399,16 @@ struct hsm_state_set {
                               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 */
 
@@ -1825,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 */
@@ -1892,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,
@@ -1935,6 +1963,8 @@ enum mds_op_bias {
        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 |         \
@@ -2193,14 +2223,6 @@ 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)
-
 /* stripe count before directory split */
 #define lmv_split_offset       lmv_migrate_offset
 /* stripe count after directory merge */
@@ -2437,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 {
@@ -2591,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 */
@@ -2713,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,
@@ -2813,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.
@@ -2823,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"
@@ -2842,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;
@@ -2853,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,
@@ -2920,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,
@@ -3483,7 +3524,7 @@ 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 {