Whamcloud - gitweb
LU-7669 lmv: assume a real connection in lmv_connect()
[fs/lustre-release.git] / lustre / include / lustre / lustre_idl.h
index 3f65812..b3c7852 100644 (file)
@@ -73,6 +73,7 @@
 #ifndef _LUSTRE_IDL_H_
 #define _LUSTRE_IDL_H_
 
+#include <linux/types.h>
 #include <libcfs/libcfs.h>
 #include <lnet/types.h>
 #include <lustre/lustre_user.h> /* Defn's shared with user-space. */
@@ -1195,8 +1196,16 @@ struct ptlrpc_body_v2 {
                                                   *to be reused.*/
 #define OBD_CONNECT_ATTRFID            0x4000ULL /*Server can GetAttr By Fid*/
 #define OBD_CONNECT_NODEVOH            0x8000ULL /*No open hndl on specl nodes*/
-#define OBD_CONNECT_RMT_CLIENT        0x10000ULL /*Remote client */
-#define OBD_CONNECT_RMT_CLIENT_FORCE  0x20000ULL /*Remote client by force */
+#define OBD_CONNECT_RMT_CLIENT        0x10000ULL /* Remote client, never used
+                                                 * in production. Removed in
+                                                 * 2.9. Keep this flag to
+                                                 * avoid reusing.
+                                                 */
+#define OBD_CONNECT_RMT_CLIENT_FORCE  0x20000ULL /* Remote client by force,
+                                                 * never used in production.
+                                                 * Removed in 2.9. Keep this
+                                                 * flag to avoid reusing.
+                                                 */
 #define OBD_CONNECT_BRW_SIZE          0x40000ULL /*Max bytes per rpc */
 #define OBD_CONNECT_QUOTA64           0x80000ULL /*Not used since 2.4 */
 #define OBD_CONNECT_MDS_CAPA         0x100000ULL /*MDS capability */
@@ -1206,7 +1215,7 @@ struct ptlrpc_body_v2 {
 #define OBD_CONNECT_AT              0x1000000ULL /*client uses AT */
 #define OBD_CONNECT_LRU_RESIZE      0x2000000ULL /*LRU resize feature. */
 #define OBD_CONNECT_MDS_MDS         0x4000000ULL /*MDS-MDS connection */
-#define OBD_CONNECT_REAL            0x8000000ULL /*real connection */
+#define OBD_CONNECT_REAL            0x8000000ULL /* obsolete since 2.8 */
 #define OBD_CONNECT_CHANGE_QS      0x10000000ULL /*Not used since 2.4 */
 #define OBD_CONNECT_CKSUM          0x20000000ULL /*support several cksum algos*/
 #define OBD_CONNECT_FID            0x40000000ULL /*FID is supported by server */
@@ -1249,6 +1258,9 @@ struct ptlrpc_body_v2 {
 #define OBD_CONNECT_BULK_MBITS  0x2000000000000000ULL
 #define OBD_CONNECT_OBDOPACK    0x4000000000000000ULL /* compact OUT obdo */
 #define OBD_CONNECT_FLAGS2      0x8000000000000000ULL /* second flags word */
+/* ocd_connect_flags2 flags */
+#define OBD_CONNECT2_FILE_SECCTX       0x1ULL /* set file security context at create */
+
 /* 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
@@ -1275,16 +1287,13 @@ struct ptlrpc_body_v2 {
 #endif
 
 #define MDT_CONNECT_SUPPORTED  (OBD_CONNECT_RDONLY | OBD_CONNECT_VERSION | \
-                                OBD_CONNECT_ACL | OBD_CONNECT_XATTR | \
-                                OBD_CONNECT_IBITS | \
-                                OBD_CONNECT_NODEVOH | OBD_CONNECT_ATTRFID | \
-                                OBD_CONNECT_CANCELSET | OBD_CONNECT_AT | \
-                                OBD_CONNECT_RMT_CLIENT | \
-                                OBD_CONNECT_RMT_CLIENT_FORCE | \
-                               OBD_CONNECT_BRW_SIZE | OBD_CONNECT_MDS_MDS | \
-                                OBD_CONNECT_FID | LRU_RESIZE_CONNECT_FLAG | \
-                                OBD_CONNECT_VBR | OBD_CONNECT_LOV_V3 | \
-                               OBD_CONNECT_FULL20 | \
+                               OBD_CONNECT_ACL | OBD_CONNECT_XATTR | \
+                               OBD_CONNECT_IBITS | OBD_CONNECT_NODEVOH | \
+                               OBD_CONNECT_ATTRFID | OBD_CONNECT_CANCELSET | \
+                               OBD_CONNECT_AT | OBD_CONNECT_BRW_SIZE | \
+                               OBD_CONNECT_MDS_MDS | OBD_CONNECT_FID | \
+                               LRU_RESIZE_CONNECT_FLAG | OBD_CONNECT_VBR | \
+                               OBD_CONNECT_LOV_V3 | OBD_CONNECT_FULL20 | \
                                OBD_CONNECT_64BITHASH | OBD_CONNECT_JOBSTATS | \
                                OBD_CONNECT_EINPROGRESS | \
                                OBD_CONNECT_LIGHTWEIGHT | OBD_CONNECT_UMASK | \
@@ -1295,20 +1304,22 @@ struct ptlrpc_body_v2 {
                                OBD_CONNECT_OPEN_BY_FID | \
                                OBD_CONNECT_DIR_STRIPE | \
                                OBD_CONNECT_BULK_MBITS | \
-                               OBD_CONNECT_MULTIMODRPCS)
+                               OBD_CONNECT_MULTIMODRPCS | \
+                               OBD_CONNECT_SUBTREE | \
+                               OBD_CONNECT_FLAGS2)
+
+#define MDT_CONNECT_SUPPORTED2 OBD_CONNECT2_FILE_SECCTX
 
 #define OST_CONNECT_SUPPORTED  (OBD_CONNECT_SRVLOCK | OBD_CONNECT_GRANT | \
-                                OBD_CONNECT_REQPORTAL | OBD_CONNECT_VERSION | \
-                                OBD_CONNECT_TRUNCLOCK | OBD_CONNECT_INDEX | \
-                               OBD_CONNECT_BRW_SIZE | \
-                                OBD_CONNECT_CANCELSET | OBD_CONNECT_AT | \
-                                LRU_RESIZE_CONNECT_FLAG | OBD_CONNECT_CKSUM | \
-                                OBD_CONNECT_RMT_CLIENT | \
-                                OBD_CONNECT_RMT_CLIENT_FORCE | OBD_CONNECT_VBR | \
-                                OBD_CONNECT_MDS | OBD_CONNECT_SKIP_ORPHAN | \
-                                OBD_CONNECT_GRANT_SHRINK | OBD_CONNECT_FULL20 | \
-                                OBD_CONNECT_64BITHASH | OBD_CONNECT_MAXBYTES | \
-                                OBD_CONNECT_MAX_EASIZE | \
+                               OBD_CONNECT_REQPORTAL | OBD_CONNECT_VERSION | \
+                               OBD_CONNECT_TRUNCLOCK | OBD_CONNECT_INDEX | \
+                               OBD_CONNECT_BRW_SIZE | OBD_CONNECT_CANCELSET | \
+                               OBD_CONNECT_AT | LRU_RESIZE_CONNECT_FLAG | \
+                               OBD_CONNECT_CKSUM | OBD_CONNECT_VBR | \
+                               OBD_CONNECT_MDS | OBD_CONNECT_SKIP_ORPHAN | \
+                               OBD_CONNECT_GRANT_SHRINK | OBD_CONNECT_FULL20 |\
+                               OBD_CONNECT_64BITHASH | OBD_CONNECT_MAXBYTES | \
+                               OBD_CONNECT_MAX_EASIZE | \
                                OBD_CONNECT_EINPROGRESS | \
                                OBD_CONNECT_JOBSTATS | \
                                OBD_CONNECT_LIGHTWEIGHT | OBD_CONNECT_LVB_TYPE|\
@@ -1316,12 +1327,18 @@ struct ptlrpc_body_v2 {
                                OBD_CONNECT_PINGLESS | OBD_CONNECT_LFSCK | \
                                OBD_CONNECT_BULK_MBITS | \
                                OBD_CONNECT_GRANT_PARAM)
-#define ECHO_CONNECT_SUPPORTED (0)
+#define OST_CONNECT_SUPPORTED2 0
+
+#define ECHO_CONNECT_SUPPORTED 0
+#define ECHO_CONNECT_SUPPORTED2 0
+
 #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)
 
+#define MGS_CONNECT_SUPPORTED2 0
+
 /* Features required for this version of the client to work with server */
 #define CLIENT_CONNECT_MDT_REQD (OBD_CONNECT_IBITS | OBD_CONNECT_FID | \
                                  OBD_CONNECT_FULL20)
@@ -1414,7 +1431,8 @@ typedef enum {
        OST_QUOTACHECK = 18, /* not used since 2.4 */
         OST_QUOTACTL   = 19,
        OST_QUOTA_ADJUST_QUNIT = 20, /* not used since 2.4 */
-        OST_LAST_OPC
+       OST_LADVISE    = 21,
+       OST_LAST_OPC /* must be < 33 to avoid MDS_GETATTR */
 } ost_cmd_t;
 #define OST_FIRST_OPC  OST_REPLY
 
@@ -1600,10 +1618,6 @@ static inline void lmm_oi_cpu_to_le(struct ost_id *dst_oi,
 #define XATTR_NAME_LFSCK_BITMAP "trusted.lfsck_bitmap"
 #define XATTR_NAME_DUMMY       "trusted.dummy"
 
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 8, 53, 0)
-# define XATTR_NAME_LFSCK_NAMESPACE_OLD "trusted.lfsck_namespace"
-#endif
-
 #define XATTR_NAME_LFSCK_NAMESPACE "trusted.lfsck_ns"
 #define XATTR_NAME_MAX_LEN     32 /* increase this, if there is longer name. */
 
@@ -1696,7 +1710,7 @@ 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 */
-#define OBD_MD_FLRMTPERM     (0x0000010000000000ULL) /* remote permission */
+/*     OBD_MD_FLRMTPERM     (0x0000010000000000ULL) remote perm, obsolete */
 #define OBD_MD_FLMDSCAPA     (0x0000020000000000ULL) /* MDS capability */
 #define OBD_MD_FLOSSCAPA     (0x0000040000000000ULL) /* OSS capability */
 #define OBD_MD_FLCKSPLIT     (0x0000080000000000ULL) /* Check split on server */
@@ -1707,10 +1721,10 @@ lov_mds_md_max_stripe_count(size_t buf_size, __u32 lmm_magic)
                                                       * client holds the lock */
 #define OBD_MD_FLOBJCOUNT    (0x0000400000000000ULL) /* for multiple destroy */
 
-#define OBD_MD_FLRMTLSETFACL (0x0001000000000000ULL) /* lfs lsetfacl case */
-#define OBD_MD_FLRMTLGETFACL (0x0002000000000000ULL) /* lfs lgetfacl case */
-#define OBD_MD_FLRMTRSETFACL (0x0004000000000000ULL) /* lfs rsetfacl case */
-#define OBD_MD_FLRMTRGETFACL (0x0008000000000000ULL) /* lfs rgetfacl case */
+/*     OBD_MD_FLRMTLSETFACL (0x0001000000000000ULL) lfs lsetfacl, obsolete */
+/*     OBD_MD_FLRMTLGETFACL (0x0002000000000000ULL) lfs lgetfacl, obsolete */
+/*     OBD_MD_FLRMTRSETFACL (0x0004000000000000ULL) lfs rsetfacl, obsolete */
+/*     OBD_MD_FLRMTRGETFACL (0x0008000000000000ULL) lfs rgetfacl, obsolete */
 
 #define OBD_MD_FLDATAVERSION (0x0010000000000000ULL) /* iversion sum */
 #define OBD_MD_CLOSE_INTENT_EXECED (0x0020000000000000ULL) /* close intent
@@ -1778,8 +1792,10 @@ struct obd_ioobj {
        __u32           ioo_bufcnt;     /* number of niobufs for this object */
 };
 
+/* NOTE: IOOBJ_MAX_BRW_BITS defines the _offset_ of the max_brw field in
+ * ioo_max_brw, NOT the maximum number of bits in PTLRPC_BULK_OPS_BITS.
+ * That said, ioo_max_brw is a 32-bit field so the limit is also 16 bits. */
 #define IOOBJ_MAX_BRW_BITS     16
-#define IOOBJ_TYPE_MASK                ((1U << IOOBJ_MAX_BRW_BITS) - 1)
 #define ioobj_max_brw_get(ioo) (((ioo)->ioo_max_brw >> IOOBJ_MAX_BRW_BITS) + 1)
 #define ioobj_max_brw_set(ioo, num)                                    \
 do { (ioo)->ioo_max_brw = ((num) - 1) << IOOBJ_MAX_BRW_BITS; } while (0)
@@ -2003,7 +2019,7 @@ typedef enum {
        MDS_READPAGE            = 37,
        MDS_CONNECT             = 38,
        MDS_DISCONNECT          = 39,
-       MDS_GETSTATUS           = 40,
+       MDS_GET_ROOT            = 40,
        MDS_STATFS              = 41,
        MDS_PIN                 = 42, /* obsolete, never used in a release */
        MDS_UNPIN               = 43, /* obsolete, never used in a release */
@@ -2235,21 +2251,6 @@ enum {
         CFS_SETUID_PERM = 0x01,
         CFS_SETGID_PERM = 0x02,
         CFS_SETGRP_PERM = 0x04,
-        CFS_RMTACL_PERM = 0x08,
-        CFS_RMTOWN_PERM = 0x10
-};
-
-/* inode access permission for remote user, the inode info are omitted,
- * for client knows them. */
-struct mdt_remote_perm {
-        __u32           rp_uid;
-        __u32           rp_gid;
-        __u32           rp_fsuid;
-        __u32           rp_fsuid_h;
-        __u32           rp_fsgid;
-        __u32           rp_fsgid_h;
-        __u32           rp_access_perm; /* MAY_READ/WRITE/EXEC */
-        __u32           rp_padding;
 };
 
 struct mdt_rec_setattr {
@@ -3480,54 +3481,9 @@ enum lfsck_event_flags {
        LEF_QUERY_ALL           = 0x00000020,
 };
 
-static inline void lustre_set_wire_obdo(const struct obd_connect_data *ocd,
-                                       struct obdo *wobdo,
-                                       const struct obdo *lobdo)
-{
-       *wobdo = *lobdo;
-       wobdo->o_flags &= ~OBD_FL_LOCAL_MASK;
-       if (ocd == NULL)
-               return;
-
-       if (unlikely(!(ocd->ocd_connect_flags & OBD_CONNECT_FID)) &&
-           fid_seq_is_echo(ostid_seq(&lobdo->o_oi))) {
-               /* Currently OBD_FL_OSTID will only be used when 2.4 echo
-                * client communicate with pre-2.4 server */
-               wobdo->o_oi.oi.oi_id = fid_oid(&lobdo->o_oi.oi_fid);
-               wobdo->o_oi.oi.oi_seq = fid_seq(&lobdo->o_oi.oi_fid);
-       }
-}
-
-static inline void lustre_get_wire_obdo(const struct obd_connect_data *ocd,
-                                       struct obdo *lobdo,
-                                       const struct obdo *wobdo)
-{
-       __u32 local_flags = 0;
-
-        if (lobdo->o_valid & OBD_MD_FLFLAGS)
-                 local_flags = lobdo->o_flags & OBD_FL_LOCAL_MASK;
-
-       *lobdo = *wobdo;
-       if (local_flags != 0) {
-               lobdo->o_valid |= OBD_MD_FLFLAGS;
-               lobdo->o_flags &= ~OBD_FL_LOCAL_MASK;
-               lobdo->o_flags |= local_flags;
-       }
-       if (ocd == NULL)
-               return;
-
-       if (unlikely(!(ocd->ocd_connect_flags & OBD_CONNECT_FID)) &&
-           fid_seq_is_echo(wobdo->o_oi.oi.oi_seq)) {
-               /* see above */
-               lobdo->o_oi.oi_fid.f_seq = wobdo->o_oi.oi.oi_seq;
-               lobdo->o_oi.oi_fid.f_oid = wobdo->o_oi.oi.oi_id;
-               lobdo->o_oi.oi_fid.f_ver = 0;
-       }
-}
-
 /* request structure for OST's */
 struct ost_body {
-        struct  obdo oa;
+       struct obdo oa;
 };
 
 /* Key for FIEMAP to be used in get_info calls */
@@ -3543,7 +3499,6 @@ void lustre_print_user_md(unsigned int level, struct lov_user_md *lum,
 /* Functions for dumping PTLRPC fields */
 void dump_rniobuf(struct niobuf_remote *rnb);
 void dump_ioo(struct obd_ioobj *nb);
-void dump_obdo(struct obdo *oa);
 void dump_ost_body(struct ost_body *ob);
 void dump_rcs(__u32 *rc);
 
@@ -3735,11 +3690,14 @@ struct link_ea_entry {
 
 /** fid2path request/reply structure */
 struct getinfo_fid2path {
-        struct lu_fid   gf_fid;
-        __u64           gf_recno;
-        __u32           gf_linkno;
-        __u32           gf_pathlen;
-        char            gf_path[0];
+       struct lu_fid   gf_fid;
+       __u64           gf_recno;
+       __u32           gf_linkno;
+       __u32           gf_pathlen;
+       union {
+               char            gf_path[0];
+               struct lu_fid   gf_root_fid[0];
+       } gf_u;
 } __attribute__((packed));
 
 /** path2parent request/reply structures */
@@ -3857,12 +3815,6 @@ struct object_update_param {
        char    oup_buf[0];
 };
 
-static inline size_t
-object_update_param_size(const struct object_update_param *param)
-{
-       return cfs_size_round(sizeof(*param) + param->oup_len);
-}
-
 /* object update */
 struct object_update {
        __u16           ou_type;                /* enum update_type */
@@ -3902,52 +3854,6 @@ struct out_update_buffer {
        __u32   oub_padding;
 };
 
-static inline size_t
-object_update_params_size(const struct object_update *update)
-{
-       const struct object_update_param *param;
-       size_t                           total_size = 0;
-       unsigned int                     i;
-
-       param = &update->ou_params[0];
-       for (i = 0; i < update->ou_params_count; i++) {
-               size_t size = object_update_param_size(param);
-
-               param = (struct object_update_param *)((char *)param + size);
-               total_size += size;
-       }
-
-       return total_size;
-}
-
-static inline size_t
-object_update_size(const struct object_update *update)
-{
-       return offsetof(struct object_update, ou_params[0]) +
-              object_update_params_size(update);
-}
-
-static inline struct object_update *
-object_update_request_get(const struct object_update_request *our,
-                         unsigned int index, size_t *size)
-{
-       void    *ptr;
-       unsigned int i;
-
-       if (index >= our->ourq_count)
-               return NULL;
-
-       ptr = (void *)&our->ourq_updates[0];
-       for (i = 0; i < index; i++)
-               ptr += object_update_size(ptr);
-
-       if (size != NULL)
-               *size = object_update_size(ptr);
-
-       return ptr;
-}
-
-
 /* the result of object update */
 struct object_update_result {
        __u32   our_rc;
@@ -3967,33 +3873,6 @@ struct object_update_reply {
        __u16   ourp_lens[0];
 };
 
-static inline struct object_update_result *
-object_update_result_get(const struct object_update_reply *reply,
-                        unsigned int index, size_t *size)
-{
-       __u16 count = reply->ourp_count;
-       unsigned int i;
-       void *ptr;
-
-       if (index >= count)
-               return NULL;
-
-       ptr = (char *)reply +
-             cfs_size_round(offsetof(struct object_update_reply,
-                                     ourp_lens[count]));
-       for (i = 0; i < index; i++) {
-               if (reply->ourp_lens[i] == 0)
-                       return NULL;
-
-               ptr += cfs_size_round(reply->ourp_lens[i]);
-       }
-
-       if (size != NULL)
-               *size = reply->ourp_lens[index];
-
-       return ptr;
-}
-
 /* read update result */
 struct out_read_reply {
        __u32   orr_size;
@@ -4002,22 +3881,6 @@ struct out_read_reply {
        char    orr_data[0];
 };
 
-static inline void orr_cpu_to_le(struct out_read_reply *orr_dst,
-                                const struct out_read_reply *orr_src)
-{
-       orr_dst->orr_size = cpu_to_le32(orr_src->orr_size);
-       orr_dst->orr_padding = cpu_to_le32(orr_src->orr_padding);
-       orr_dst->orr_offset = cpu_to_le64(orr_dst->orr_offset);
-}
-
-static inline void orr_le_to_cpu(struct out_read_reply *orr_dst,
-                                const struct out_read_reply *orr_src)
-{
-       orr_dst->orr_size = le32_to_cpu(orr_src->orr_size);
-       orr_dst->orr_padding = le32_to_cpu(orr_src->orr_padding);
-       orr_dst->orr_offset = le64_to_cpu(orr_dst->orr_offset);
-}
-
 /** layout swap request structure
  * fid1 and fid2 are in mdt_body
  */