mdd->mdd_changelog_min_gc_interval = CHLOG_MIN_GC_INTERVAL;
/* with a very few number of free catalog entries */
mdd->mdd_changelog_min_free_cat_entries = CHLOG_MIN_FREE_CAT_ENTRIES;
+ /* special default striping for files created with O_APPEND */
+ mdd->mdd_append_stripe_count = 1;
+ mdd->mdd_append_pool[0] = '\0';
dt_conf_get(env, mdd->mdd_child, &mdd->mdd_dt_conf);
RETURN(rc);
}
-static struct llog_operations changelog_orig_logops;
-
static int
mdd_changelog_write_header(const struct lu_env *env, struct mdd_device *mdd,
int markerflags);
OBD_SET_CTXT_MAGIC(&obd->obd_lvfs_ctxt);
obd->obd_lvfs_ctxt.dt = mdd->mdd_bottom;
rc = llog_setup(env, obd, &obd->obd_olg, LLOG_CHANGELOG_ORIG_CTXT,
- obd, &changelog_orig_logops);
+ obd, &llog_common_cat_ops);
if (rc) {
CERROR("%s: changelog llog setup failed: rc = %d\n",
obd->obd_name, rc);
/* setup user changelog */
rc = llog_setup(env, obd, &obd->obd_olg, LLOG_CHANGELOG_USER_ORIG_CTXT,
- obd, &changelog_orig_logops);
+ obd, &llog_common_cat_ops);
if (rc) {
CERROR("%s: changelog users llog setup failed: rc = %d\n",
obd->obd_name, rc);
if (rc)
GOTO(out_ucleanup, rc);
- uctxt->loc_handle->lgh_logops->lop_add = llog_cat_add_rec;
- uctxt->loc_handle->lgh_logops->lop_declare_add = llog_cat_declare_add_rec;
-
rc = llog_init_handle(env, uctxt->loc_handle, LLOG_F_IS_CAT, NULL);
if (rc)
GOTO(out_uclose, rc);
return -EPERM;
}
+int mdd_create(const struct lu_env *env, struct md_object *pobj,
+ const struct lu_name *lname, struct md_object *child,
+ struct md_op_spec *spec, struct md_attr *ma);
+static int mdd_obf_create(const struct lu_env *env, struct md_object *pobj,
+ const struct lu_name *lname, struct md_object *child,
+ struct md_op_spec *spec, struct md_attr *ma)
+{
+ if (spec->sp_cr_flags & MDS_OPEN_VOLATILE)
+ return mdd_create(env, pobj, lname, child, spec, ma);
+ RETURN(-EPERM);
+}
+
static struct md_dir_operations mdd_obf_dir_ops = {
.mdo_lookup = obf_lookup,
- .mdo_create = mdd_dummy_create,
+ .mdo_create = mdd_obf_create,
.mdo_rename = mdd_dummy_rename,
.mdo_link = mdd_dummy_link,
.mdo_unlink = mdd_dummy_unlink
return rc;
}
-
-static struct llog_operations hsm_actions_logops;
-
/**
* set llog methods and create LLOG_AGENT_ORIG_CTXT llog
* object in obd_device
obd->obd_lvfs_ctxt.dt = m->mdd_bottom;
rc = llog_setup(env, obd, &obd->obd_olg, LLOG_AGENT_ORIG_CTXT,
- obd, &hsm_actions_logops);
+ obd, &llog_common_cat_ops);
if (rc) {
CERROR("%s: hsm actions llog setup failed: rc = %d\n",
obd->obd_name, rc);
switch (cfg->lcfg_command) {
case LCFG_PARAM: {
- struct obd_device *obd = mdd2obd_dev(m);
+ ssize_t count;
- rc = class_process_proc_param(PARAM_MDD, obd->obd_vars, cfg, m);
- if (rc > 0 || rc == -ENOSYS)
+ count = class_modify_config(cfg, PARAM_MDD, &m->mdd_kobj);
+ rc = count > 0 ? 0 : count;
+ if (rc)
/* we don't understand; pass it on */
rc = next->ld_ops->ldo_process_config(env, next, cfg);
break;
ENTRY;
- rc = mdd_child_ops(mdd)->dt_statfs(env, mdd->mdd_child, sfs);
+ rc = mdd_child_ops(mdd)->dt_statfs(env, mdd->mdd_child, sfs, NULL);
sfs->os_namelen = min_t(__u32, sfs->os_namelen, NAME_MAX);
mdd_changelog_user_purge_cb, &mcup,
0, 0);
+ OBD_FAIL_TIMEOUT(OBD_FAIL_LLOG_PURGE_DELAY, cfs_fail_val);
+
if ((rc == 0) && (mcup.mcup_usercount == 0)) {
spin_lock(&mdd->mdd_cl.mc_user_lock);
if (mdd->mdd_cl.mc_users == 0) {
if (unlikely(!barrier_entry(mdd->mdd_bottom)))
RETURN(-EINPROGRESS);
- rc = mdd_changelog_user_purge(env, mdd, data->ioc_u32_1);
+ /* explicitly clear changelog first, to protect from crash in
+ * the middle of purge that would lead to unregistered consumer
+ * but pending changelog entries
+ */
+ rc = mdd_changelog_clear(env, mdd, data->ioc_u32_1, 0);
+ if (!rc)
+ rc = mdd_changelog_user_purge(env,
+ mdd, data->ioc_u32_1);
+
barrier_exit(mdd->mdd_bottom);
break;
default:
if (rc)
return rc;
- changelog_orig_logops = llog_osd_ops;
- changelog_orig_logops.lop_add = llog_cat_add_rec;
- changelog_orig_logops.lop_declare_add = llog_cat_declare_add_rec;
-
- hsm_actions_logops = llog_osd_ops;
- hsm_actions_logops.lop_add = llog_cat_add_rec;
- hsm_actions_logops.lop_declare_add = llog_cat_declare_add_rec;
-
- rc = class_register_type(&mdd_obd_device_ops, NULL, true, NULL,
+ rc = class_register_type(&mdd_obd_device_ops, NULL, false, NULL,
LUSTRE_MDD_NAME, &mdd_device_type);
if (rc)
lu_kmem_fini(mdd_caches);