}
LUSTRE_RW_ATTR(max_dirty_mb);
+LUSTRE_ATTR(ost_conn_uuid, 0444, conn_uuid_show, NULL);
LUSTRE_RO_ATTR(conn_uuid);
-LUSTRE_WO_ATTR(ping);
+LUSTRE_RW_ATTR(ping);
static int osc_cached_mb_seq_show(struct seq_file *m, void *v)
{
}
LPROC_SEQ_FOPS_RO(osc_unstable_stats);
-static int osc_idle_timeout_seq_show(struct seq_file *m, void *v)
+static ssize_t idle_timeout_show(struct kobject *kobj, struct attribute *attr,
+ char *buf)
{
- struct obd_device *obd = m->private;
+ struct obd_device *obd = container_of(kobj, struct obd_device,
+ obd_kset.kobj);
struct client_obd *cli = &obd->u.cli;
+ int ret;
- seq_printf(m, "%u\n", cli->cl_import->imp_idle_timeout);
- return 0;
+ LPROCFS_CLIMP_CHECK(obd);
+ ret = sprintf(buf, "%u\n", cli->cl_import->imp_idle_timeout);
+ LPROCFS_CLIMP_EXIT(obd);
+
+ return ret;
}
-static ssize_t osc_idle_timeout_seq_write(struct file *f,
- const char __user *buffer,
- size_t count, loff_t *off)
+static ssize_t idle_timeout_store(struct kobject *kobj, struct attribute *attr,
+ const char *buffer, size_t count)
{
- struct obd_device *dev = ((struct seq_file *)f->private_data)->private;
+ struct obd_device *dev = container_of(kobj, struct obd_device,
+ obd_kset.kobj);
struct client_obd *cli = &dev->u.cli;
struct ptlrpc_request *req;
- __s64 val;
+ unsigned int idle_debug = 0;
+ unsigned int val;
int rc;
- rc = lprocfs_str_with_units_to_s64(buffer, count, &val, '1');
- if (rc)
- return rc;
- if (val < 0 || val > 1)
- return -ERANGE;
-
- cli->cl_import->imp_idle_timeout = val;
+ if (strncmp(buffer, "debug", 5) == 0) {
+ idle_debug = D_CONSOLE;
+ } else if (strncmp(buffer, "nodebug", 6) == 0) {
+ idle_debug = D_HA;
+ } else {
+ rc = kstrtouint(buffer, 10, &val);
+ if (rc)
+ return rc;
+
+ if (val > CONNECTION_SWITCH_MAX)
+ return -ERANGE;
+ }
- /* to initiate the connection if it's in IDLE state */
- if (!val) {
- req = ptlrpc_request_alloc(cli->cl_import, &RQF_OST_STATFS);
- if (req != NULL)
- ptlrpc_req_finished(req);
+ LPROCFS_CLIMP_CHECK(dev);
+ if (idle_debug) {
+ cli->cl_import->imp_idle_debug = idle_debug;
+ } else {
+ if (!val) {
+ /* initiate the connection if it's in IDLE state */
+ req = ptlrpc_request_alloc(cli->cl_import,
+ &RQF_OST_STATFS);
+ if (req != NULL)
+ ptlrpc_req_finished(req);
+ }
+ cli->cl_import->imp_idle_timeout = val;
}
+ LPROCFS_CLIMP_EXIT(dev);
return count;
}
-LPROC_SEQ_FOPS(osc_idle_timeout);
+LUSTRE_RW_ATTR(idle_timeout);
-static int osc_idle_connect_seq_show(struct seq_file *m, void *v)
+static ssize_t idle_connect_store(struct kobject *kobj, struct attribute *attr,
+ const char *buffer, size_t count)
{
- return 0;
-}
-
-static ssize_t osc_idle_connect_seq_write(struct file *f,
- const char __user *buffer,
- size_t count, loff_t *off)
-{
- struct obd_device *dev = ((struct seq_file *)f->private_data)->private;
+ struct obd_device *dev = container_of(kobj, struct obd_device,
+ obd_kset.kobj);
struct client_obd *cli = &dev->u.cli;
struct ptlrpc_request *req;
+ LPROCFS_CLIMP_CHECK(dev);
/* to initiate the connection if it's in IDLE state */
req = ptlrpc_request_alloc(cli->cl_import, &RQF_OST_STATFS);
- if (req != NULL)
+ if (req)
ptlrpc_req_finished(req);
ptlrpc_pinger_force(cli->cl_import);
+ LPROCFS_CLIMP_EXIT(dev);
return count;
}
-LPROC_SEQ_FOPS(osc_idle_connect);
+LUSTRE_WO_ATTR(idle_connect);
+
+static ssize_t grant_shrink_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;
+ struct obd_connect_data *ocd;
+ ssize_t len;
+
+ LPROCFS_CLIMP_CHECK(obd);
+ ocd = &cli->cl_import->imp_connect_data;
+
+ len = snprintf(buf, PAGE_SIZE, "%d\n",
+ !!OCD_HAS_FLAG(ocd, GRANT_SHRINK));
+ LPROCFS_CLIMP_EXIT(obd);
+
+ return len;
+}
+
+static ssize_t grant_shrink_store(struct kobject *kobj, struct attribute *attr,
+ const char *buffer, size_t count)
+{
+ struct obd_device *dev = container_of(kobj, struct obd_device,
+ obd_kset.kobj);
+ struct client_obd *cli = &dev->u.cli;
+ struct obd_connect_data *ocd;
+ bool val;
+ int rc;
+
+ if (dev == NULL)
+ return 0;
+
+ rc = kstrtobool(buffer, &val);
+ if (rc)
+ return rc;
+
+ LPROCFS_CLIMP_CHECK(dev);
+ ocd = &cli->cl_import->imp_connect_data;
+
+ if (!val) {
+ if (OCD_HAS_FLAG(ocd, GRANT_SHRINK))
+ ocd->ocd_connect_flags &= ~OBD_CONNECT_GRANT_SHRINK;
+ } else {
+ /**
+ * server replied obd_connect_data is always bigger, so
+ * client's imp_connect_flags_orig are always supported
+ * by the server
+ */
+ if (!OCD_HAS_FLAG(ocd, GRANT_SHRINK) &&
+ cli->cl_import->imp_connect_flags_orig &
+ OBD_CONNECT_GRANT_SHRINK)
+ ocd->ocd_connect_flags |= OBD_CONNECT_GRANT_SHRINK;
+ }
+
+ LPROCFS_CLIMP_EXIT(dev);
+
+ return count;
+}
+LUSTRE_RW_ATTR(grant_shrink);
LPROC_SEQ_FOPS_RO_TYPE(osc, connect_flags);
LPROC_SEQ_FOPS_RO_TYPE(osc, server_uuid);
.fops = &osc_pinger_recov_fops },
{ .name = "unstable_stats",
.fops = &osc_unstable_stats_fops },
- { .name = "idle_timeout",
- .fops = &osc_idle_timeout_fops },
- { .name = "idle_connect",
- .fops = &osc_idle_connect_fops },
{ NULL }
};
-#define pct(a,b) (b ? a * 100 / b : 0)
-
static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v)
{
struct timespec64 now;
read_cum += r;
write_cum += w;
- seq_printf(seq, "%d:\t\t%10lu %3lu %3lu | %10lu %3lu %3lu\n",
+ seq_printf(seq, "%d:\t\t%10lu %3u %3u | %10lu %3u %3u\n",
1 << i, r, pct(r, read_tot),
pct(read_cum, read_tot), w,
pct(w, write_tot),
unsigned long w = cli->cl_write_rpc_hist.oh_buckets[i];
read_cum += r;
write_cum += w;
- seq_printf(seq, "%d:\t\t%10lu %3lu %3lu | %10lu %3lu %3lu\n",
+ seq_printf(seq, "%d:\t\t%10lu %3u %3u | %10lu %3u %3u\n",
i, r, pct(r, read_tot),
pct(read_cum, read_tot), w,
pct(w, write_tot),
unsigned long w = cli->cl_write_offset_hist.oh_buckets[i];
read_cum += r;
write_cum += w;
- seq_printf(seq, "%d:\t\t%10lu %3lu %3lu | %10lu %3lu %3lu\n",
- (i == 0) ? 0 : 1 << (i - 1),
- r, pct(r, read_tot), pct(read_cum, read_tot),
- w, pct(w, write_tot), pct(write_cum, write_tot));
+ seq_printf(seq, "%d:\t\t%10lu %3u %3u | %10lu %3u %3u\n",
+ (i == 0) ? 0 : 1 << (i - 1),
+ r, pct(r, read_tot), pct(read_cum, read_tot),
+ w, pct(w, write_tot), pct(write_cum, write_tot));
if (read_cum == read_tot && write_cum == write_tot)
break;
}
return 0;
}
-#undef pct
static ssize_t osc_rpc_stats_seq_write(struct file *file,
const char __user *buf,
&lustre_attr_max_rpcs_in_flight.attr,
&lustre_attr_short_io_bytes.attr,
&lustre_attr_resend_count.attr,
+ &lustre_attr_ost_conn_uuid.attr,
&lustre_attr_conn_uuid.attr,
&lustre_attr_ping.attr,
+ &lustre_attr_idle_timeout.attr,
+ &lustre_attr_idle_connect.attr,
+ &lustre_attr_grant_shrink.attr,
NULL,
};