From: Andreas Dilger Date: Sat, 15 Sep 2018 18:39:07 +0000 (-0600) Subject: LU-1757 osc: clarify short_io_bytes is maximum value X-Git-Tag: 2.12.0-RC1~184 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=b90812a674f6ebaa9de592a4a4d97a35ed38a24e LU-1757 osc: clarify short_io_bytes is maximum value Clarify in the code that the "osc.*.short_io_bytes" parameter is the maximum IO size to pack into request/reply not the minimum. Allow short_io to be disabled completely if it is set to zero. It would be nice to also change the name of the /proc functions in a similar manner but that also changes the /proc tunable name (via LUSTRE_RW_ATTR() macro) and has compatibility implications for sites that may have changed this value. Signed-off-by: Andreas Dilger Change-Id: I3a91420d7e0405445558ba9203233d7f977cab07 Reviewed-on: https://review.whamcloud.com/33173 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Mike Pershin Reviewed-by: Patrick Farrell Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/obd.h b/lustre/include/obd.h index b35b3fa..78cb375 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -257,9 +257,9 @@ struct client_obd { /* just a sum of the loi/lop pending numbers to be exported by /proc */ atomic_t cl_pending_w_pages; atomic_t cl_pending_r_pages; - __u32 cl_max_pages_per_rpc; - __u32 cl_max_rpcs_in_flight; - __u32 cl_short_io_bytes; + u32 cl_max_pages_per_rpc; + u32 cl_max_rpcs_in_flight; + u32 cl_max_short_io_bytes; struct obd_histogram cl_read_rpc_hist; struct obd_histogram cl_write_rpc_hist; struct obd_histogram cl_read_page_hist; diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 6a5daf7..de66aa3 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -416,7 +416,7 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg) * from OFD after connecting. */ cli->cl_max_pages_per_rpc = PTLRPC_MAX_BRW_PAGES; - cli->cl_short_io_bytes = OBD_MAX_SHORT_IO_BYTES; + cli->cl_max_short_io_bytes = OBD_MAX_SHORT_IO_BYTES; /* set cl_chunkbits default value to PAGE_SHIFT, * it will be updated at OSC connection time. */ diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index e98ca6b..1f064ff 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -2381,7 +2381,7 @@ ssize_t short_io_bytes_show(struct kobject *kobj, struct attribute *attr, int rc; spin_lock(&cli->cl_loi_list_lock); - rc = sprintf(buf, "%d\n", cli->cl_short_io_bytes); + rc = sprintf(buf, "%d\n", cli->cl_max_short_io_bytes); spin_unlock(&cli->cl_loi_list_lock); return rc; } @@ -2405,7 +2405,7 @@ ssize_t short_io_bytes_store(struct kobject *kobj, struct attribute *attr, if (rc) GOTO(out, rc); - if (val < MIN_SHORT_IO_BYTES || val > OBD_MAX_SHORT_IO_BYTES) + if (val && (val < MIN_SHORT_IO_BYTES || val > OBD_MAX_SHORT_IO_BYTES)) GOTO(out, rc = -ERANGE); rc = count; @@ -2414,7 +2414,7 @@ ssize_t short_io_bytes_store(struct kobject *kobj, struct attribute *attr, if (val > (cli->cl_max_pages_per_rpc << PAGE_SHIFT)) rc = -ERANGE; else - cli->cl_short_io_bytes = val; + cli->cl_max_short_io_bytes = val; spin_unlock(&cli->cl_loi_list_lock); out: diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 3ca65ba..ffa7912 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -1317,9 +1317,9 @@ osc_brw_prep_request(int cmd, struct client_obd *cli, struct obdo *oa, for (i = 0; i < page_count; i++) short_io_size += pga[i]->count; - /* Check if we can do a short io. */ - if (!(short_io_size <= cli->cl_short_io_bytes && niocount == 1 && - imp_connect_shortio(cli->cl_import))) + /* Check if read/write is small enough to be a short io. */ + if (short_io_size > cli->cl_max_short_io_bytes || niocount > 1 || + !imp_connect_shortio(cli->cl_import)) short_io_size = 0; req_capsule_set_size(pill, &RMF_SHORT_IO, RCL_CLIENT,