/*
* 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/
__u32 pb_op_flags;
__u32 pb_conn_cnt;
__u32 pb_timeout; /* for req, the deadline, for rep, the service est */
- __u32 pb_service_time; /* for rep, actual service time */
+ __u32 pb_service_time; /* for rep, actual service time, also used for
+ net_latency of req */
__u32 pb_limit;
__u64 pb_slv;
/* VBR: pre-versions */
* 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))
OBD_CONNECT_CANCELSET | OBD_CONNECT_AT | \
LRU_RESIZE_CONNECT_FLAG | OBD_CONNECT_CKSUM | \
OBD_CONNECT_CHANGE_QS | \
- OBD_CONNECT_OSS_CAPA | OBD_CONNECT_RMT_CLIENT | \
+ OBD_CONNECT_OSS_CAPA | \
+ 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 | \
__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 */
__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 */
__u64 lmm_object_id; /* LOV object ID */
__u64 lmm_object_seq; /* LOV object seq number */
__u32 lmm_stripe_size; /* size of stripe in bytes */
- __u32 lmm_stripe_count; /* num stripes in use for this object */
+ /* lmm_stripe_count used to be __u32 */
+ __u16 lmm_stripe_count; /* num stripes in use for this object */
+ __u16 lmm_layout_gen; /* layout generation number */
struct lov_ost_data_v1 lmm_objects[0]; /* per-stripe data */
};
#define XATTR_NAME_LMA "trusted.lma"
#define XATTR_NAME_LMV "trusted.lmv"
#define XATTR_NAME_LINK "trusted.link"
+#define XATTR_NAME_VERSION "trusted.version"
struct lov_mds_md_v3 { /* LOV EA mds/wire data (little-endian) */
__u64 lmm_object_id; /* LOV object ID */
__u64 lmm_object_seq; /* LOV object seq number */
__u32 lmm_stripe_size; /* size of stripe in bytes */
- __u32 lmm_stripe_count; /* num stripes in use for this object */
+ /* lmm_stripe_count used to be __u32 */
+ __u16 lmm_stripe_count; /* num stripes in use for this object */
+ __u16 lmm_layout_gen; /* layout generation number */
char lmm_pool_name[LOV_MAXPOOLNAME]; /* must be 32bit aligned */
struct lov_ost_data_v1 lmm_objects[0]; /* per-stripe data */
};
#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 | \
#define MDS_INODELOCK_LOOKUP 0x000001 /* dentry, mode, owner, group */
#define MDS_INODELOCK_UPDATE 0x000002 /* size, links, timestamps */
#define MDS_INODELOCK_OPEN 0x000004 /* For opened files */
+#define MDS_INODELOCK_LAYOUT 0x000008 /* for layout */
-/* Do not forget to increase MDS_INODELOCK_MAXSHIFT when adding new bits */
+/* Do not forget to increase MDS_INODELOCK_MAXSHIFT when adding new bits
+ * XXX: MDS_INODELOCK_MAXSHIFT should be increased to 3 once the layout lock is
+ * supported */
#define MDS_INODELOCK_MAXSHIFT 2
/* This FULL lock is useful to take on unlink sort of operations */
#define MDS_INODELOCK_FULL ((1<<(MDS_INODELOCK_MAXSHIFT+1))-1)
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
*
* (max buffer size - lov+rpc header) / sizeof(struct lov_ost_data_v1) */
#define LOV_MAX_STRIPE_COUNT 2000 /* ((12 * 4096 - 256) / 24) */
+#define LOV_ALL_STRIPES 0xffff /* only valid for directories */
#define LOV_V1_INSANE_STRIPE_COUNT 65532 /* maximum stripe count bz13933 */
#define LOV_MAX_UUID_BUFFER_SIZE 8192
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,
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;
};
__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;
#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)
{