*/
/*
* This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
*
* lustre/osp/lproc_osp.c
*
dd_kobj);
struct lu_device *lu = dt2lu_dev(dt);
struct obd_device *obd = lu->ld_obd;
- struct obd_import *imp;
+ struct obd_import *imp, *imp0;
bool val;
int rc;
if (rc)
return rc;
- with_imp_locked(obd, imp, rc) {
- /* opposite senses */
- if (obd->u.cli.cl_import->imp_deactive == val)
- rc = ptlrpc_set_import_active(imp, val);
- else
- CDEBUG(D_CONFIG,
- "activate %u: ignoring repeat request\n",
- (unsigned int)val);
- }
+ with_imp_locked(obd, imp0, rc)
+ imp = class_import_get(imp0);
+ if (rc)
+ return rc;
+ /* opposite senses */
+ if (imp->imp_deactive == val)
+ rc = ptlrpc_set_import_active(imp, val);
+ else
+ CDEBUG(D_CONFIG, "activate %u: ignoring repeat request\n",
+ (unsigned int)val);
+
+ class_import_put(imp);
return rc ?: count;
}
}
LUSTRE_RW_ATTR(sync_changes);
+static ssize_t max_sync_changes_show(struct kobject *kobj,
+ struct attribute *attr, char *buf)
+{
+ struct dt_device *dt = container_of(kobj, struct dt_device,
+ dd_kobj);
+ struct osp_device *osp = dt2osp_dev(dt);
+
+ return sprintf(buf, "%u\n", osp->opd_sync_max_changes);
+}
+
+
+static ssize_t max_sync_changes_store(struct kobject *kobj,
+ struct attribute *attr, const char *buffer, size_t count)
+{
+ struct dt_device *dt = container_of(kobj, struct dt_device,
+ dd_kobj);
+ struct osp_device *osp = dt2osp_dev(dt);
+ int val;
+ int rc;
+
+ rc = kstrtoint(buffer, 0, &val);
+ if (rc)
+ return rc;
+ if (val <= 0)
+ return -ERANGE;
+ osp->opd_sync_max_changes = val;
+ return count;
+}
+
+LUSTRE_RW_ATTR(max_sync_changes);
+
/**
* Show maximum number of RPCs in flight allowed
*
dd_kobj);
struct osp_device *osp = dt2osp_dev(dt);
unsigned int val;
- int rc, i;
+ int rc;
if (!osp->opd_pre)
return -EINVAL;
-
rc = kstrtouint(buffer, 0, &val);
if (rc)
return rc;
* that is the maximum possible number of objects that will
* ever be handled by MDT->OST recovery processing.
*
+ * The OSP enforces the pre_create_count to amaximum of
+ * one half of opd_pre_max_create_count.
+ *
* If the OST ever gets a request to delete more orphans,
* this implies that something has gone badly on the MDT
* and the OST will refuse to delete so much data from the
- * filesystem as a safety measure. */
- if (val < OST_MIN_PRECREATE || val > OST_MAX_PRECREATE)
- return -ERANGE;
- if (val > osp->opd_pre_max_create_count)
+ * filesystem as a safety measure.
+ */
+ if (val < OST_MIN_PRECREATE)
return -ERANGE;
+ if (val > osp->opd_pre_max_create_count / 2)
+ val = osp->opd_pre_max_create_count / 2;
- for (i = 1; (i << 1) <= val; i <<= 1)
- ;
- osp->opd_pre_create_count = i;
+ /* set to largest value <= 32, 64, 128 or a multiple of 256 */
+ if (val > 256)
+ osp->opd_pre_create_count = val & 0xffffff00;
+ else
+ osp->opd_pre_create_count = rounddown_pow_of_two(val);
return count;
}
dd_kobj);
struct lu_device *lu = dt2lu_dev(dt);
struct obd_device *obd = lu->ld_obd;
- struct obd_import *imp;
int rc;
- with_imp_locked(obd, imp, rc)
- rc = ptlrpc_obd_ping(obd);
+ rc = ptlrpc_obd_ping(obd);
return rc;
}
LDEBUGFS_SEQ_FOPS_RO_TYPE(osp, server_uuid);
LDEBUGFS_SEQ_FOPS_RO_TYPE(osp, timeouts);
-LPROC_SEQ_FOPS_RW_TYPE(osp, import);
+LDEBUGFS_SEQ_FOPS_RW_TYPE(osp, import);
LDEBUGFS_SEQ_FOPS_RO_TYPE(osp, state);
/**
}
LUSTRE_WO_ATTR(force_sync);
-static struct lprocfs_vars lprocfs_osp_obd_vars[] = {
+static struct ldebugfs_vars ldebugfs_osp_obd_vars[] = {
{ .name = "connect_flags",
.fops = &osp_connect_flags_fops },
{ .name = "ost_server_uuid",
{ NULL }
};
-static struct lprocfs_vars lprocfs_osp_md_vars[] = {
+static struct ldebugfs_vars ldebugfs_osp_md_vars[] = {
{ .name = "connect_flags",
.fops = &osp_connect_flags_fops },
{ .name = "mdt_server_uuid",
&lustre_attr_sync_in_flight.attr,
&lustre_attr_sync_in_progress.attr,
&lustre_attr_sync_changes.attr,
+ &lustre_attr_max_sync_changes.attr,
&lustre_attr_force_sync.attr,
&lustre_attr_old_sync_processed.attr,
&lustre_attr_create_count.attr,
if (osp->opd_connect_mdt) {
osp->opd_dt_dev.dd_ktype.default_attrs = osp_md_attrs;
- obd->obd_vars = lprocfs_osp_md_vars;
+ obd->obd_debugfs_vars = ldebugfs_osp_md_vars;
} else {
osp->opd_dt_dev.dd_ktype.default_attrs = osp_obd_attrs;
- obd->obd_vars = lprocfs_osp_obd_vars;
+ obd->obd_debugfs_vars = ldebugfs_osp_obd_vars;
}
rc = dt_tunables_init(&osp->opd_dt_dev, obd->obd_type, obd->obd_name,
/* Since we register the obd device with ptlrpc / sptlrpc we
* have to register debugfs with obd_device
*/
- obd->obd_debugfs_entry = ldebugfs_register(obd->obd_name,
- obd->obd_type->typ_debugfs_entry,
- obd->obd_vars, obd);
- if (IS_ERR_OR_NULL(obd->obd_debugfs_entry)) {
- rc = obd->obd_debugfs_entry ? PTR_ERR(obd->obd_debugfs_entry)
- : -ENOMEM;
- CERROR("%s: error %d setting up debugfs\n",
- obd->obd_name, rc);
- obd->obd_debugfs_entry = NULL;
- dt_tunables_fini(&osp->opd_dt_dev);
- return;
- }
+ obd->obd_debugfs_entry = debugfs_create_dir(
+ obd->obd_name, obd->obd_type->typ_debugfs_entry);
+ ldebugfs_add_vars(obd->obd_debugfs_entry, obd->obd_debugfs_vars, obd);
sptlrpc_lprocfs_cliobd_attach(obd);
ptlrpc_lprocfs_register_obd(obd);