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_mode;
+ u64 mfd_open_flags;
/** protected by med_open_lock */
struct list_head mfd_list;
/** xid of the open request */
struct lu_env cdt_env; /**< coordinator lustre
* env */
struct lu_context cdt_session; /** session for lu_ucred */
- struct proc_dir_entry *cdt_proc_dir; /**< cdt /proc directory */
+ struct dentry *cdt_debugfs_dir; /**< cdt debugfs directory */
+ struct completion cdt_kobj_unregister;
+ struct kobject cdt_hsm_kobj; /* hsm sysfs object */
__u64 cdt_policy; /**< policy flags */
enum cdt_states cdt_state; /**< state */
struct mutex cdt_state_lock; /**< cdt_state lock */
* list */
struct mutex cdt_restore_lock; /**< protect restore
* list */
- time64_t cdt_loop_period; /**< llog scan period */
- time64_t cdt_grace_delay; /**< request grace
+ time_t cdt_loop_period; /**< llog scan period */
+ time_t cdt_grace_delay; /**< request grace
* delay */
- time64_t cdt_active_req_timeout; /**< request timeout */
+ time_t cdt_active_req_timeout; /**< request timeout */
__u32 cdt_default_archive_id; /**< archive id used
* when none are
* specified */
- __u64 cdt_max_requests; /**< max count of started
+ u64 cdt_max_requests; /**< max count of started
* requests */
/** Current count of active requests */
atomic_t cdt_request_count; /** total */
unsigned int mdt_capa_conf:1,
/* Enable remote dir on non-MDT0 */
mdt_enable_remote_dir:1,
- mdt_skip_lfsck:1;
-
+ mdt_enable_striped_dir:1,
+ mdt_enable_dir_migration:1,
+ mdt_enable_remote_rename:1,
+ mdt_skip_lfsck:1,
+ mdt_readonly:1;
+
+ /* user with gid can create remote/striped
+ * dir, and set default dir stripe */
gid_t mdt_enable_remote_dir_gid;
/* lock for osfs and md_root */
void *rr_eadata;
int rr_eadatalen;
__u32 rr_flags;
+ __u16 rr_mirror_id;
};
enum mdt_reint_flag {
* 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.
- */
- struct md_attr mti_attr;
- /*
- * 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? */
+ /*
+ * 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? */
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;
+ } 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)
le16_to_cpu(lcm->lcm_mirror_count) > 0;
}
+static inline bool lmm_is_overstriping(struct lov_mds_md *lmm)
+{
+ if (le32_to_cpu(lmm->lmm_magic) == LOV_MAGIC_V1 ||
+ le32_to_cpu(lmm->lmm_magic) == LOV_MAGIC_V3)
+ return le16_to_cpu(lmm->lmm_pattern) & LOV_PATTERN_OVERSTRIPING;
+
+ return false;
+}
+
+static inline bool mdt_lmm_comp_overstriping(struct lov_mds_md *lmm)
+{
+ struct lov_comp_md_v1 *comp_v1;
+ struct lov_mds_md *v1;
+ __u32 off;
+ int i;
+
+ comp_v1 = (struct lov_comp_md_v1 *)lmm;
+
+ for (i = 1; i < le16_to_cpu(comp_v1->lcm_entry_count); i++) {
+ off = le32_to_cpu(comp_v1->lcm_entries[i].lcme_offset);
+ v1 = (struct lov_mds_md *)((char *)comp_v1 + off);
+
+ if (lmm_is_overstriping(v1))
+ return true;
+ }
+
+ return false;
+}
+
+static inline bool mdt_lmm_is_overstriping(struct lov_mds_md *lmm)
+{
+ if (le32_to_cpu(lmm->lmm_magic) == LOV_MAGIC_COMP_V1)
+ return mdt_lmm_comp_overstriping(lmm);
+
+ return lmm_is_overstriping(lmm);
+}
+
static inline bool mdt_is_sum_statfs_client(struct obd_export *exp)
{
return exp_connect_flags(exp) & OBD_CONNECT_FLAGS2 &&
void *client_nid);
int mdt_lock_new_child(struct mdt_thread_info *info,
- struct mdt_object *o,
- struct mdt_lock_handle *child_lockh);
-
-void mdt_mfd_set_mode(struct mdt_file_data *mfd,
- __u64 mode);
-
-int mdt_reint_open(struct mdt_thread_info *info,
- struct mdt_lock_handle *lhc);
-
+ struct mdt_object *o,
+ struct mdt_lock_handle *child_lockh);
+void mdt_mfd_set_mode(struct mdt_file_data *mfd, u64 open_flags);
+int mdt_reint_open(struct mdt_thread_info *info, struct mdt_lock_handle *lhc);
struct mdt_file_data *mdt_open_handle2mfd(struct mdt_export_data *med,
const struct lustre_handle *open_handle,
bool is_replay);
+int mdt_revoke_remote_lookup_lock(struct mdt_thread_info *info,
+ struct mdt_object *pobj,
+ struct mdt_object *obj);
int mdt_get_info(struct tgt_session_info *tsi);
int mdt_attr_get_complex(struct mdt_thread_info *info,
struct mdt_lock_handle *lh,
__u64 flags, int result);
+int hsm_init_ucred(struct lu_ucred *uc);
int mdt_hsm_attr_set(struct mdt_thread_info *info, struct mdt_object *obj,
const struct md_hsm *mh);
struct linkea_data *ldata);
int mdt_close_internal(struct mdt_thread_info *info, struct ptlrpc_request *req,
struct mdt_body *repbody);
-int mdt_remote_permission(struct mdt_thread_info *info);
+void mdt_pack_secctx_in_reply(struct mdt_thread_info *info,
+ struct mdt_object *child);
static inline struct mdt_device *mdt_dev(struct lu_device *d)
{
cdt->cdt_event = true;
}
-/* coordinator control /proc interface */
-ssize_t mdt_hsm_cdt_control_seq_write(struct file *file,
- const char __user *buffer,
- size_t count, loff_t *off);
-int mdt_hsm_cdt_control_seq_show(struct seq_file *m, void *data);
-int hsm_cdt_procfs_init(struct mdt_device *mdt);
-void hsm_cdt_procfs_fini(struct mdt_device *mdt);
-struct lprocfs_vars *hsm_cdt_get_proc_vars(void);
+/* coordinator control sysfs interface */
+ssize_t hsm_control_show(struct kobject *kobj, struct attribute *attr,
+ char *buf);
+ssize_t hsm_control_store(struct kobject *kobj, struct attribute *attr,
+ const char *buffer, size_t count);
+int hsm_cdt_tunables_init(struct mdt_device *mdt);
+void hsm_cdt_tunables_fini(struct mdt_device *mdt);
/* md_hsm helpers */
struct mdt_object *mdt_hsm_get_md_hsm(struct mdt_thread_info *mti,
const struct lu_fid *fid,
static inline bool mdt_rdonly(struct obd_export *exp)
{
- if (exp_connect_flags(exp) & OBD_CONNECT_RDONLY ||
- mdt_exp2dev(exp)->mdt_bottom->dd_rdonly)
- return true;
- return false;
+ return (exp_connect_flags(exp) & OBD_CONNECT_RDONLY ||
+ mdt_exp2dev(exp)->mdt_bottom->dd_rdonly ||
+ mdt_exp2dev(exp)->mdt_readonly);
}
typedef void (*mdt_reconstruct_t)(struct mdt_thread_info *mti,
}
/* Issues dlm lock on passed @ns, @f stores it lock handle into @lh. */
-static inline int mdt_fid_lock(struct ldlm_namespace *ns,
+static inline int mdt_fid_lock(const struct lu_env *env,
+ struct ldlm_namespace *ns,
struct lustre_handle *lh, enum ldlm_mode mode,
union ldlm_policy_data *policy,
const struct ldlm_res_id *res_id,
LASSERT(ns != NULL);
LASSERT(lh != NULL);
- rc = ldlm_cli_enqueue_local(ns, res_id, LDLM_IBITS, policy,
+ rc = ldlm_cli_enqueue_local(env, ns, res_id, LDLM_IBITS, policy,
mode, &flags, mdt_blocking_ast,
ldlm_completion_ast,
glimpse ? mdt_dom_glimpse_ast : NULL,
void mdt_counter_incr(struct ptlrpc_request *req, int opcode);
void mdt_stats_counter_init(struct lprocfs_stats *stats);
-int mdt_procfs_init(struct mdt_device *mdt, const char *name);
-void mdt_procfs_fini(struct mdt_device *mdt);
+int mdt_tunables_init(struct mdt_device *mdt, const char *name);
+void mdt_tunables_fini(struct mdt_device *mdt);
/* lustre/mdt_mdt_lproc.c */
int lprocfs_mdt_open_files_seq_open(struct inode *inode,
struct ldlm_lock **lockp, __u64 flags);
int mdt_dom_read_on_open(struct mdt_thread_info *mti, struct mdt_device *mdt,
struct lustre_handle *lh);
-void mdt_dom_discard_data(struct mdt_thread_info *info,
- const struct lu_fid *fid);
+void mdt_dom_discard_data(struct mdt_thread_info *info, struct mdt_object *mo);
int mdt_dom_disk_lvbo_update(const struct lu_env *env, struct mdt_object *mo,
struct ldlm_resource *res, bool increase_only);
void mdt_dom_obj_lvb_update(const struct lu_env *env, struct mdt_object *mo,