struct mdc_rpc_lock *cl_rpc_lock;
struct mdc_rpc_lock *cl_close_lock;
+ /* modify rpcs in flight
+ * currently used for metadata only */
+ spinlock_t cl_mod_rpcs_lock;
+ __u16 cl_max_mod_rpcs_in_flight;
+
/* mgc datastruct */
struct mutex cl_mgc_mutex;
struct local_oid_storage *cl_mgc_los;
void obd_put_request_slot(struct client_obd *cli);
__u32 obd_get_max_rpcs_in_flight(struct client_obd *cli);
int obd_set_max_rpcs_in_flight(struct client_obd *cli, __u32 max);
+__u16 obd_get_max_mod_rpcs_in_flight(struct client_obd *cli);
+int obd_set_max_mod_rpcs_in_flight(struct client_obd *cli, __u16 max);
struct llog_handle;
struct llog_rec_hdr;
}
LPROC_SEQ_FOPS(mdc_max_rpcs_in_flight);
+
+static int mdc_max_mod_rpcs_in_flight_seq_show(struct seq_file *m, void *v)
+{
+ struct obd_device *dev = m->private;
+ __u16 max;
+ int rc;
+
+ max = obd_get_max_mod_rpcs_in_flight(&dev->u.cli);
+ rc = seq_printf(m, "%hu\n", max);
+
+ return rc;
+}
+
+static ssize_t mdc_max_mod_rpcs_in_flight_seq_write(struct file *file,
+ const char *buffer,
+ size_t count,
+ loff_t *off)
+{
+ struct obd_device *dev =
+ ((struct seq_file *)file->private_data)->private;
+ int val;
+ int rc;
+
+ rc = lprocfs_write_helper(buffer, count, &val);
+ if (rc != 0)
+ return rc;
+
+ if (val < 0 || val > USHRT_MAX)
+ return -ERANGE;
+
+ rc = obd_set_max_mod_rpcs_in_flight(&dev->u.cli, val);
+ if (rc != 0)
+ count = rc;
+
+ return count;
+}
+LPROC_SEQ_FOPS(mdc_max_mod_rpcs_in_flight);
+
LPROC_SEQ_FOPS_WO_TYPE(mdc, ping);
LPROC_SEQ_FOPS_RO_TYPE(mdc, uuid);
.fops = &mdc_obd_max_pages_per_rpc_fops },
{ .name = "max_rpcs_in_flight",
.fops = &mdc_max_rpcs_in_flight_fops },
+ { .name = "max_mod_rpcs_in_flight",
+ .fops = &mdc_max_mod_rpcs_in_flight_fops },
{ .name = "timeouts",
.fops = &mdc_timeouts_fops },
{ .name = "import",
if (rc) {
mdc_cleanup(obd);
CERROR("failed to setup llogging subsystems\n");
+ RETURN(rc);
}
+ spin_lock_init(&cli->cl_mod_rpcs_lock);
+ cli->cl_max_mod_rpcs_in_flight = OBD_MAX_RIF_DEFAULT - 1;
+
RETURN(rc);
err_close_lock:
__u32 old;
int diff;
int i;
+ char *typ_name;
+ int rc;
if (max > OBD_MAX_RIF_MAX || max < 1)
return -ERANGE;
+ typ_name = cli->cl_import->imp_obd->obd_type->typ_name;
+ if (strcmp(typ_name, LUSTRE_MDC_NAME) == 0) {
+ /* adjust max_mod_rpcs_in_flight to ensure it is always
+ * strictly lower that max_rpcs_in_flight */
+ if (max < 2) {
+ CERROR("%s: cannot set max_rpcs_in_flight to 1 "
+ "because it must be higher than "
+ "max_mod_rpcs_in_flight value",
+ cli->cl_import->imp_obd->obd_name);
+ return -ERANGE;
+ }
+ if (max <= cli->cl_max_mod_rpcs_in_flight) {
+ rc = obd_set_max_mod_rpcs_in_flight(cli, max - 1);
+ if (rc != 0)
+ return rc;
+ }
+ }
+
spin_lock(&cli->cl_loi_list_lock);
old = cli->cl_max_rpcs_in_flight;
cli->cl_max_rpcs_in_flight = max;
return 0;
}
EXPORT_SYMBOL(obd_set_max_rpcs_in_flight);
+
+__u16 obd_get_max_mod_rpcs_in_flight(struct client_obd *cli)
+{
+ return cli->cl_max_mod_rpcs_in_flight;
+}
+EXPORT_SYMBOL(obd_get_max_mod_rpcs_in_flight);
+
+int obd_set_max_mod_rpcs_in_flight(struct client_obd *cli, __u16 max)
+{
+ struct obd_connect_data *ocd;
+ __u16 maxmodrpcs;
+
+ if (max > OBD_MAX_RIF_MAX || max < 1)
+ return -ERANGE;
+
+ /* cannot exceed or equal max_rpcs_in_flight */
+ if (max >= cli->cl_max_rpcs_in_flight) {
+ CERROR("%s: can't set max_mod_rpcs_in_flight to a value (%hu) "
+ "higher or equal to max_rpcs_in_flight value (%u)\n",
+ cli->cl_import->imp_obd->obd_name,
+ max, cli->cl_max_rpcs_in_flight);
+ return -ERANGE;
+ }
+
+ /* cannot exceed max modify RPCs in flight supported by the server */
+ ocd = &cli->cl_import->imp_connect_data;
+ if (ocd->ocd_connect_flags & OBD_CONNECT_MULTIMODRPCS)
+ maxmodrpcs = ocd->ocd_maxmodrpcs;
+ else
+ maxmodrpcs = 1;
+ if (max > maxmodrpcs) {
+ CERROR("%s: can't set max_mod_rpcs_in_flight to a value (%hu) "
+ "higher than max_mod_rpcs_per_client value (%hu) "
+ "returned by the server at connection\n",
+ cli->cl_import->imp_obd->obd_name,
+ max, maxmodrpcs);
+ return -ERANGE;
+ }
+
+ cli->cl_max_mod_rpcs_in_flight = max;
+
+ /* will have to wakeup waiters if max has been increased */
+
+ return 0;
+}
+EXPORT_SYMBOL(obd_set_max_mod_rpcs_in_flight);
+
client_adjust_max_dirty(cli);
+ /* Update client max modify RPCs in flight with value returned
+ * by the server */
+ if (ocd->ocd_connect_flags & OBD_CONNECT_MULTIMODRPCS)
+ cli->cl_max_mod_rpcs_in_flight = min(
+ cli->cl_max_mod_rpcs_in_flight,
+ ocd->ocd_maxmodrpcs);
+ else
+ cli->cl_max_mod_rpcs_in_flight = 1;
/* Reset ns_connect_flags only for initial connect. It might be
* changed in while using FS and if we reset it in reconnect