struct mdt_file_data {
/** portals handle must be first */
struct portals_handle mfd_open_handle;
+ /* export data of portals_handle */
+ const struct mdt_export_data *mfd_owner;
/** open mode provided by client */
u64 mfd_open_flags;
/** protected by med_open_lock */
* reduce stack consumption.
*/
struct mdt_thread_info {
- /*
- * XXX: Part One:
- * The following members will be filled explicitly
- * with specific data in mdt_thread_info_init().
- */
- /* TODO: move this into mdt_session_key(with LCT_SESSION), because
- * request handling may migrate from one server thread to another.
- */
- struct req_capsule *mti_pill;
-
- /* although we have export in req, there are cases when it is not
- * available, e.g. closing files upon export destroy */
- struct obd_export *mti_exp;
- /*
- * A couple of lock handles.
- */
- struct mdt_lock_handle mti_lh[MDT_LH_NR];
-
- struct mdt_device *mti_mdt;
- const struct lu_env *mti_env;
-
- /* transaction number of current request */
- __u64 mti_transno;
-
-
- /*
- * XXX: Part Two:
- * The following members will be filled expilictly
- * with zero in mdt_thread_info_init(). These members may be used
- * by all requests.
- */
-
- /*
- * Object attributes.
- */
+ /*
+ * XXX: Part One:
+ * The following members will be filled explicitly
+ * with specific data in mdt_thread_info_init().
+ */
+ /* TODO: move this into mdt_session_key(with LCT_SESSION), because
+ * request handling may migrate from one server thread to another.
+ */
+ struct req_capsule *mti_pill;
+
+ /* although we have export in req, there are cases when it is not
+ * available, e.g. closing files upon export destroy */
+ struct obd_export *mti_exp;
+ /*
+ * A couple of lock handles.
+ */
+ struct mdt_lock_handle mti_lh[MDT_LH_NR];
+
+ struct mdt_device *mti_mdt;
+ const struct lu_env *mti_env;
+
+ /* transaction number of current request */
+ __u64 mti_transno;
+
+ /*
+ * XXX: Part Two:
+ * The following members will be filled expilictly
+ * with zero in mdt_thread_info_init(). These members may be used
+ * by all requests.
+ */
+
+ /*
+ * Object attributes.
+ */
struct md_attr mti_attr;
struct md_attr mti_attr2; /* mdt_lvb.c */
- /*
- * Body for "habeo corpus" operations.
- */
- const struct mdt_body *mti_body;
- /*
- * Host object. This is released at the end of mdt_handler().
- */
- struct mdt_object *mti_object;
- /*
- * Lock request for "habeo clavis" operations.
- */
- const struct ldlm_request *mti_dlm_req;
-
- __u32 mti_has_trans:1, /* has txn already? */
+ /*
+ * Body for "habeo corpus" operations.
+ */
+ const struct mdt_body *mti_body;
+ /*
+ * Host object. This is released at the end of mdt_handler().
+ */
+ struct mdt_object *mti_object;
+ /*
+ * Lock request for "habeo clavis" operations.
+ */
+ const struct ldlm_request *mti_dlm_req;
+
+ __u32 mti_has_trans:1, /* has txn already? */
mti_cross_ref:1,
/* big_lmm buffer was used and must be used in reply */
mti_big_lmm_used:1,
mti_big_acl_used:1,
mti_som_valid:1;
- /* opdata for mdt_reint_open(), has the same as
- * ldlm_reply:lock_policy_res1. mdt_update_last_rcvd() stores this
- * value onto disk for recovery when mdt_trans_stop_cb() is called.
- */
- __u64 mti_opdata;
-
- /*
- * XXX: Part Three:
- * The following members will be filled explicitly
- * with zero in mdt_reint_unpack(), because they are only used
- * by reint requests (including mdt_reint_open()).
- */
-
- /*
- * reint record. contains information for reint operations.
- */
- struct mdt_reint_record mti_rr;
-
- __u64 mti_ver[PTLRPC_NUM_VERSIONS];
- /*
- * Operation specification (currently create and lookup)
- */
- struct md_op_spec mti_spec;
-
- /*
- * XXX: Part Four:
- * The following members will _NOT_ be initialized at all.
- * DO NOT expect them to contain any valid value.
- * They should be initialized explicitly by the user themselves.
- */
+ /* opdata for mdt_reint_open(), has the same as
+ * ldlm_reply:lock_policy_res1. mdt_update_last_rcvd() stores this
+ * value onto disk for recovery when mdt_trans_stop_cb() is called.
+ */
+ __u64 mti_opdata;
+
+ /*
+ * XXX: Part Three:
+ * The following members will be filled explicitly
+ * with zero in mdt_reint_unpack(), because they are only used
+ * by reint requests (including mdt_reint_open()).
+ */
+
+ /*
+ * reint record. contains information for reint operations.
+ */
+ struct mdt_reint_record mti_rr;
+
+ __u64 mti_ver[PTLRPC_NUM_VERSIONS];
+ /*
+ * Operation specification (currently create and lookup)
+ */
+ struct md_op_spec mti_spec;
+
+ /*
+ * XXX: Part Four:
+ * The following members will _NOT_ be initialized at all.
+ * DO NOT expect them to contain any valid value.
+ * They should be initialized explicitly by the user themselves.
+ */
/* XXX: If something is in a union, make sure they do not conflict */
struct lu_fid mti_tmp_fid1;
char ns_name[48];/* for mdt_init0() */
struct lustre_cfg_bufs bufs; /* for mdt_stack_fini() */
struct obd_statfs osfs; /* for mdt_statfs() */
- struct {
- /* for mdt_readpage() */
- struct lu_rdpg mti_rdpg;
- /* for mdt_sendpage() */
- struct l_wait_info mti_wait_info;
- } rdpg;
+ struct {
+ /* for mdt_readpage() */
+ struct lu_rdpg mti_rdpg;
+ /* for mdt_sendpage() */
+ struct l_wait_info mti_wait_info;
+ } rdpg;
struct {
struct md_attr attr;
} hsm;
struct lu_buf mti_buf;
struct lu_buf mti_big_buf;
- /* Ops object filename */
- struct lu_name mti_name;
+ /* Ops object filename */
+ struct lu_name mti_name;
char mti_filename[NAME_MAX + 1];
/* per-thread values, can be re-used, may be vmalloc'd */
void *mti_big_lmm;
struct lov_comp_md_v1 *comp_v1;
struct lov_mds_md *v1;
__u32 off;
+ bool has_dom = true;
int i;
if (le32_to_cpu(lmm->lmm_magic) != LOV_MAGIC_COMP_V1)
v1 = (struct lov_mds_md *)((char *)comp_v1 + off);
/* DoM entry is the first entry always */
- if (lov_pattern(le32_to_cpu(v1->lmm_pattern)) != LOV_PATTERN_MDT)
+ if (lov_pattern(le32_to_cpu(v1->lmm_pattern)) != LOV_PATTERN_MDT &&
+ le16_to_cpu(comp_v1->lcm_mirror_count) == 0)
return LMM_NO_DOM;
- for (i = 1; i < le16_to_cpu(comp_v1->lcm_entry_count); i++) {
+ for (i = 0; i < le16_to_cpu(comp_v1->lcm_entry_count); i++) {
int j;
off = le32_to_cpu(comp_v1->lcm_entries[i].lcme_offset);
v1 = (struct lov_mds_md *)((char *)comp_v1 + off);
+ if (lov_pattern(le32_to_cpu(v1->lmm_pattern)) ==
+ LOV_PATTERN_MDT)
+ has_dom = true;
+
for (j = 0; j < le16_to_cpu(v1->lmm_stripe_count); j++) {
/* if there is any object on OST */
if (le32_to_cpu(v1->lmm_objects[j].l_ost_idx) !=
return LMM_DOM_OST;
}
}
- return LMM_DOM_ONLY;
+ return has_dom ? LMM_DOM_ONLY : LMM_NO_DOM;
}
static inline bool mdt_lmm_is_flr(struct lov_mds_md *lmm)