struct obd_device *obd = container_of(kobj, struct obd_device,
obd_kset.kobj);
struct client_obd *cli = &obd->u.cli;
- ssize_t len;
- spin_lock(&cli->cl_loi_list_lock);
- len = sprintf(buf, "%u\n", cli->cl_max_rpcs_in_flight);
- spin_unlock(&cli->cl_loi_list_lock);
- return len;
+ return scnprintf(buf, PAGE_SIZE, "%u\n", cli->cl_max_rpcs_in_flight);
}
static ssize_t max_rpcs_in_flight_store(struct kobject *kobj,
struct obd_device *obd = container_of(kobj, struct obd_device,
obd_kset.kobj);
struct client_obd *cli = &obd->u.cli;
- unsigned long val;
- spin_lock(&cli->cl_loi_list_lock);
- val = PAGES_TO_MiB(cli->cl_dirty_max_pages);
- spin_unlock(&cli->cl_loi_list_lock);
-
- return sprintf(buf, "%lu\n", val);
+ return scnprintf(buf, PAGE_SIZE, "%lu\n",
+ PAGES_TO_MiB(cli->cl_dirty_max_pages));
}
static ssize_t max_dirty_mb_store(struct kobject *kobj,
struct obd_device *obd = container_of(kobj, struct obd_device,
obd_kset.kobj);
struct client_obd *cli = &obd->u.cli;
- ssize_t len;
- spin_lock(&cli->cl_loi_list_lock);
- len = sprintf(buf, "%lu\n", cli->cl_dirty_pages << PAGE_SHIFT);
- spin_unlock(&cli->cl_loi_list_lock);
-
- return len;
+ return scnprintf(buf, PAGE_SIZE, "%lu\n",
+ cli->cl_dirty_pages << PAGE_SHIFT);
}
LUSTRE_RO_ATTR(cur_dirty_bytes);
struct obd_device *obd = m->private;
struct client_obd *cli = &obd->u.cli;
- spin_lock(&cli->cl_loi_list_lock);
seq_printf(m, "%lu\n", cli->cl_avail_grant);
- spin_unlock(&cli->cl_loi_list_lock);
return 0;
}
return rc;
/* this is only for shrinking grant */
- spin_lock(&cli->cl_loi_list_lock);
- if (val >= cli->cl_avail_grant) {
- spin_unlock(&cli->cl_loi_list_lock);
+ if (val >= cli->cl_avail_grant)
return 0;
- }
-
- spin_unlock(&cli->cl_loi_list_lock);
with_imp_locked(obd, imp, rc)
if (imp->imp_state == LUSTRE_IMP_FULL)
struct obd_device *obd = container_of(kobj, struct obd_device,
obd_kset.kobj);
struct client_obd *cli = &obd->u.cli;
- ssize_t len;
- spin_lock(&cli->cl_loi_list_lock);
- len = sprintf(buf, "%lu\n", cli->cl_lost_grant);
- spin_unlock(&cli->cl_loi_list_lock);
- return len;
+ return scnprintf(buf, PAGE_SIZE, "%lu\n", cli->cl_lost_grant);
}
LUSTRE_RO_ATTR(cur_lost_grant_bytes);
+static ssize_t cur_dirty_grant_bytes_show(struct kobject *kobj,
+ struct attribute *attr,
+ char *buf)
+{
+ struct obd_device *obd = container_of(kobj, struct obd_device,
+ obd_kset.kobj);
+ struct client_obd *cli = &obd->u.cli;
+
+ return scnprintf(buf, PAGE_SIZE, "%lu\n", cli->cl_dirty_grant);
+}
+LUSTRE_RO_ATTR(cur_dirty_grant_bytes);
+
static ssize_t grant_shrink_interval_show(struct kobject *kobj,
struct attribute *attr,
char *buf)
&lustre_attr_contention_seconds.attr,
&lustre_attr_cur_dirty_bytes.attr,
&lustre_attr_cur_lost_grant_bytes.attr,
+ &lustre_attr_cur_dirty_grant_bytes.attr,
&lustre_attr_destroys_in_flight.attr,
&lustre_attr_grant_shrink_interval.attr,
&lustre_attr_lockless_truncate.attr,