static ssize_t active_show(struct kobject *kobj, struct attribute *attr,
char *buf)
{
- struct obd_device *dev = container_of(kobj, struct obd_device,
+ struct obd_device *obd = container_of(kobj, struct obd_device,
obd_kset.kobj);
+ struct obd_import *imp;
ssize_t len;
- LPROCFS_CLIMP_CHECK(dev);
- len = sprintf(buf, "%d\n", !dev->u.cli.cl_import->imp_deactive);
- LPROCFS_CLIMP_EXIT(dev);
+ with_imp_locked(obd, imp, len)
+ len = sprintf(buf, "%d\n", !imp->imp_deactive);
return len;
}
static ssize_t active_store(struct kobject *kobj, struct attribute *attr,
const char *buffer, size_t count)
{
- struct obd_device *dev = container_of(kobj, struct obd_device,
+ struct obd_device *obd = container_of(kobj, struct obd_device,
obd_kset.kobj);
bool val;
int rc;
return rc;
/* opposite senses */
- if (dev->u.cli.cl_import->imp_deactive == val)
- rc = ptlrpc_set_import_active(dev->u.cli.cl_import, val);
+ if (obd->u.cli.cl_import->imp_deactive == val)
+ rc = ptlrpc_set_import_active(obd->u.cli.cl_import, val);
else
CDEBUG(D_CONFIG, "activate %u: ignoring repeat request\n",
val);
struct attribute *attr,
char *buf)
{
- struct obd_device *dev = container_of(kobj, struct obd_device,
+ struct obd_device *obd = container_of(kobj, struct obd_device,
obd_kset.kobj);
ssize_t len;
u32 max;
- max = obd_get_max_rpcs_in_flight(&dev->u.cli);
+ max = obd_get_max_rpcs_in_flight(&obd->u.cli);
len = sprintf(buf, "%u\n", max);
return len;
const char *buffer,
size_t count)
{
- struct obd_device *dev = container_of(kobj, struct obd_device,
+ struct obd_device *obd = container_of(kobj, struct obd_device,
obd_kset.kobj);
unsigned int val;
int rc;
if (rc)
return rc;
- rc = obd_set_max_rpcs_in_flight(&dev->u.cli, val);
+ rc = obd_set_max_rpcs_in_flight(&obd->u.cli, val);
if (rc)
count = rc;
struct attribute *attr,
char *buf)
{
- struct obd_device *dev = container_of(kobj, struct obd_device,
+ struct obd_device *obd = container_of(kobj, struct obd_device,
obd_kset.kobj);
u16 max;
- max = obd_get_max_mod_rpcs_in_flight(&dev->u.cli);
+ max = obd_get_max_mod_rpcs_in_flight(&obd->u.cli);
return sprintf(buf, "%hu\n", max);
}
const char *buffer,
size_t count)
{
- struct obd_device *dev = container_of(kobj, struct obd_device,
+ struct obd_device *obd = container_of(kobj, struct obd_device,
obd_kset.kobj);
u16 val;
int rc;
if (rc)
return rc;
- rc = obd_set_max_mod_rpcs_in_flight(&dev->u.cli, val);
+ rc = obd_set_max_mod_rpcs_in_flight(&obd->u.cli, val);
if (rc)
count = rc;
static int mdc_max_dirty_mb_seq_show(struct seq_file *m, void *v)
{
- struct obd_device *dev = m->private;
- struct client_obd *cli = &dev->u.cli;
- unsigned long val;
+ struct obd_device *obd = m->private;
+ struct client_obd *cli = &obd->u.cli;
- spin_lock(&cli->cl_loi_list_lock);
- val = PAGES_TO_MiB(cli->cl_dirty_max_pages);
- spin_unlock(&cli->cl_loi_list_lock);
-
- seq_printf(m, "%lu\n", val);
+ seq_printf(m, "%lu\n", PAGES_TO_MiB(cli->cl_dirty_max_pages));
return 0;
}
size_t count, loff_t *off)
{
struct seq_file *sfl = file->private_data;
- struct obd_device *dev = sfl->private;
- struct client_obd *cli = &dev->u.cli;
+ struct obd_device *obd = sfl->private;
+ struct client_obd *cli = &obd->u.cli;
char kernbuf[22] = "";
u64 pages_number;
int rc;
static int mdc_cached_mb_seq_show(struct seq_file *m, void *v)
{
- struct obd_device *dev = m->private;
- struct client_obd *cli = &dev->u.cli;
+ struct obd_device *obd = m->private;
+ struct client_obd *cli = &obd->u.cli;
int shift = 20 - PAGE_SHIFT;
seq_printf(m, "used_mb: %ld\n"
size_t count, loff_t *off)
{
struct seq_file *sfl = file->private_data;
- struct obd_device *dev = sfl->private;
- struct client_obd *cli = &dev->u.cli;
+ struct obd_device *obd = sfl->private;
+ struct client_obd *cli = &obd->u.cli;
u64 pages_number;
const char *tmp;
long rc;
static int mdc_unstable_stats_seq_show(struct seq_file *m, void *v)
{
- struct obd_device *dev = m->private;
- struct client_obd *cli = &dev->u.cli;
+ struct obd_device *obd = m->private;
+ struct client_obd *cli = &obd->u.cli;
long pages;
int mb;
size_t len, loff_t *off)
{
struct seq_file *seq = file->private_data;
- struct obd_device *dev = seq->private;
- struct client_obd *cli = &dev->u.cli;
+ struct obd_device *obd = seq->private;
+ struct client_obd *cli = &obd->u.cli;
lprocfs_oh_clear(&cli->cl_mod_rpcs_hist);
static int mdc_rpc_stats_seq_show(struct seq_file *seq, void *v)
{
- struct obd_device *dev = seq->private;
- struct client_obd *cli = &dev->u.cli;
+ struct obd_device *obd = seq->private;
+ struct client_obd *cli = &obd->u.cli;
unsigned long read_tot = 0, write_tot = 0, read_cum, write_cum;
int i;
- obd_mod_rpc_stats_seq_show(&dev->u.cli, seq);
+ obd_mod_rpc_stats_seq_show(cli, seq);
spin_lock(&cli->cl_loi_list_lock);
read_cum = 0;
write_cum = 0;
- for (i = 0; i < OBD_HIST_MAX; i++) {
+ for (i = 1; i < OBD_HIST_MAX; i++) {
unsigned long r = cli->cl_read_rpc_hist.oh_buckets[i];
unsigned long w = cli->cl_write_rpc_hist.oh_buckets[i];
static int mdc_stats_seq_show(struct seq_file *seq, void *v)
{
struct timespec64 now;
- struct obd_device *dev = seq->private;
- struct osc_stats *stats = &obd2osc_dev(dev)->od_stats;
+ struct obd_device *obd = seq->private;
+ struct osc_stats *stats = &obd2osc_dev(obd)->od_stats;
ktime_get_real_ts64(&now);
size_t len, loff_t *off)
{
struct seq_file *seq = file->private_data;
- struct obd_device *dev = seq->private;
- struct osc_stats *stats = &obd2osc_dev(dev)->od_stats;
+ struct obd_device *obd = seq->private;
+ struct osc_stats *stats = &obd2osc_dev(obd)->od_stats;
memset(stats, 0, sizeof(*stats));
return len;
static int mdc_dom_min_repsize_seq_show(struct seq_file *m, void *v)
{
- struct obd_device *dev = m->private;
+ struct obd_device *obd = m->private;
- seq_printf(m, "%u\n", dev->u.cli.cl_dom_min_inline_repsize);
+ seq_printf(m, "%u\n", obd->u.cli.cl_dom_min_inline_repsize);
return 0;
}
size_t count, loff_t *off)
{
struct seq_file *m = file->private_data;
- struct obd_device *dev = m->private;
+ struct obd_device *obd = m->private;
unsigned int val;
int rc;
if (val > MDC_DOM_MAX_INLINE_REPSIZE)
return -ERANGE;
- dev->u.cli.cl_dom_min_inline_repsize = val;
+ obd->u.cli.cl_dom_min_inline_repsize = val;
return count;
}
LPROC_SEQ_FOPS(mdc_dom_min_repsize);