Whamcloud - gitweb
LU-1198 idl: move FID VER to DLM resource name[1]
[fs/lustre-release.git] / lustre / include / lustre / lustre_idl.h
index a9e5968..99bbc2f 100644 (file)
@@ -28,9 +28,8 @@
 /*
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
- */
-/*
- * Copyright (c) 2011 Whamcloud, Inc.
+ *
+ * Copyright (c) 2011, 2012, Whamcloud, Inc.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -1105,6 +1104,14 @@ extern void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb);
                                                   * directory hash */
 #define OBD_CONNECT_MAXBYTES     0x8000000000ULL /* max stripe size */
 #define OBD_CONNECT_IMP_RECOV   0x10000000000ULL /* imp recovery support */
+#define OBD_CONNECT_JOBSTATS    0x20000000000ULL /* jobid in ptlrpc_body */
+#define OBD_CONNECT_GRANT_PARAM 0x40000000000ULL /* additional grant parameters
+                                                  * are passed at connect time
+                                                  * to have finer grant space
+                                                  * allocation */
+#define OBD_CONNECT_EINPROGRESS 0x80000000000ULL /* client can handle the
+                                                  * -EINPROGRESS error for write
+                                                  * RPC properly */
 
 #define OCD_HAS_FLAG(ocd, flg)  \
         (!!((ocd)->ocd_connect_flags & OBD_CONNECT_##flg))
@@ -1171,8 +1178,10 @@ struct obd_connect_data_v1 {
         __u32 ocd_index;         /* LOV index to connect to */
         __u32 ocd_brw_size;      /* Maximum BRW size in bytes */
         __u64 ocd_ibits_known;   /* inode bits this client understands */
-        __u32 ocd_nllu;          /* non-local-lustre-user */
-        __u32 ocd_nllg;          /* non-local-lustre-group */
+        __u8  ocd_blocksize;     /* log2 of the backend filesystem blocksize */
+        __u8  ocd_inodespace;    /* log2 of the per-inode space consumption */
+        __u16 ocd_grant_extent;  /* per-extent grant overhead, in 1K blocks */
+        __u32 ocd_unused;        /* also fix lustre_swab_connect */
         __u64 ocd_transno;       /* first transno from client to be replayed */
         __u32 ocd_group;         /* MDS group on OST */
         __u32 ocd_cksum_types;   /* supported checksum algorithms */
@@ -1188,8 +1197,10 @@ struct obd_connect_data {
         __u32 ocd_index;         /* LOV index to connect to */
         __u32 ocd_brw_size;      /* Maximum BRW size in bytes */
         __u64 ocd_ibits_known;   /* inode bits this client understands */
-        __u32 ocd_nllu;          /* non-local-lustre-user */
-        __u32 ocd_nllg;          /* non-local-lustre-group */
+        __u8  ocd_blocksize;     /* log2 of the backend filesystem blocksize */
+        __u8  ocd_inodespace;    /* log2 of the per-inode space consumption */
+        __u16 ocd_grant_extent;  /* per-extent grant overhead, in 1K blocks */
+        __u32 ocd_unused;        /* also fix lustre_swab_connect */
         __u64 ocd_transno;       /* first transno from client to be replayed */
         __u32 ocd_group;         /* MDS group on OST */
         __u32 ocd_cksum_types;   /* supported checksum algorithms */
@@ -1413,6 +1424,8 @@ struct lov_mds_md_v3 {            /* LOV EA mds/wire data (little-endian) */
 #define OBD_MD_FLRMTRSETFACL (0x0004000000000000ULL) /* lfs rsetfacl case */
 #define OBD_MD_FLRMTRGETFACL (0x0008000000000000ULL) /* lfs rgetfacl case */
 
+#define OBD_MD_FLDATAVERSION (0x0010000000000000ULL) /* iversion sum */
+
 #define OBD_MD_FLGETATTR (OBD_MD_FLID    | OBD_MD_FLATIME | OBD_MD_FLMTIME | \
                           OBD_MD_FLCTIME | OBD_MD_FLSIZE  | OBD_MD_FLBLKSZ | \
                           OBD_MD_FLMODE  | OBD_MD_FLTYPE  | OBD_MD_FLUID   | \
@@ -1565,6 +1578,16 @@ extern void lustre_swab_generic_32s (__u32 *val);
 
 extern void lustre_swab_ll_fid (struct ll_fid *fid);
 
+/* NOTE: until Lustre 1.8.7/2.1.1 the fid_ver() was packed into name[2],
+ * but was moved into name[1] along with the OID to avoid consuming the
+ * name[2,3] fields that need to be used for the quota id (also a FID). */
+enum {
+        LUSTRE_RES_ID_SEQ_OFF = 0,
+        LUSTRE_RES_ID_VER_OID_OFF = 1,
+        LUSTRE_RES_ID_WAS_VER_OFF = 2, /* see note above */
+        LUSTRE_RES_ID_HSH_OFF = 3
+};
+
 #define MDS_STATUS_CONN 1
 #define MDS_STATUS_LOV 2
 
@@ -2204,6 +2227,12 @@ struct ldlm_res_id {
 
 extern void lustre_swab_ldlm_res_id (struct ldlm_res_id *id);
 
+static inline int ldlm_res_eq(const struct ldlm_res_id *res0,
+                              const struct ldlm_res_id *res1)
+{
+        return !memcmp(res0, res1, sizeof(*res0));
+}
+
 /* lock types */
 typedef enum {
         LCK_MINMODE = 0,
@@ -2242,6 +2271,13 @@ static inline int ldlm_extent_overlap(struct ldlm_extent *ex1,
         return (ex1->start <= ex2->end) && (ex2->start <= ex1->end);
 }
 
+/* check if @ex1 contains @ex2 */
+static inline int ldlm_extent_contain(struct ldlm_extent *ex1,
+                                      struct ldlm_extent *ex2)
+{
+        return (ex1->start <= ex2->start) && (ex1->end >= ex2->end);
+}
+
 struct ldlm_inodebits {
         __u64 bits;
 };
@@ -2701,12 +2737,17 @@ struct obdo {
         __u64                   o_ioepoch;      /* epoch in ost writes */
         __u32                   o_stripe_idx;   /* holds stripe idx */
         __u32                   o_parent_ver;
-        struct lustre_handle    o_handle;       /* brw: lock handle to prolong locks */
-        struct llog_cookie      o_lcookie;      /* destroy: unlink cookie from MDS */
-
+        struct lustre_handle    o_handle;       /* brw: lock handle to prolong
+                                                 * locks */
+        struct llog_cookie      o_lcookie;      /* destroy: unlink cookie from
+                                                 * MDS */
         __u32                   o_uid_h;
         __u32                   o_gid_h;
-        __u64                   o_padding_3;
+
+        __u64                   o_data_version; /* getattr: sum of iversion for
+                                                 * each stripe.
+                                                 * brw: grant space consumed on
+                                                 * the client for the write */
         __u64                   o_padding_4;
         __u64                   o_padding_5;
         __u64                   o_padding_6;
@@ -2718,6 +2759,7 @@ struct obdo {
 #define o_undirty o_mode
 #define o_dropped o_misc
 #define o_cksum   o_nlink
+#define o_grant_used o_data_version
 
 static inline void lustre_set_wire_obdo(struct obdo *wobdo, struct obdo *lobdo)
 {