@@ -252,7 +252,7 @@ struct client_obd {
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_short_io_bytes;
struct obd_histogram cl_read_rpc_hist;
struct obd_histogram cl_write_rpc_hist;
struct obd_histogram cl_read_page_hist;
@@ -374,6 +374,8 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)
*/
cli->cl_max_pages_per_rpc = PTLRPC_MAX_BRW_PAGES;
+ cli->cl_max_short_io_bytes = OBD_MAX_SHORT_IO_BYTES;
+
/*
* set cl_chunkbits default value to PAGE_CACHE_SHIFT,
* it will be updated at OSC connection time.
@@ -1896,7 +1896,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;
}
@@ -1922,7 +1922,7 @@ ssize_t short_io_bytes_store(struct kobject *kobj, struct attribute *attr,
if (rc)
goto out;
- if (val > OBD_MAX_SHORT_IO_BYTES || val < MIN_SHORT_IO_BYTES) {
+ if (val && (val < MIN_SHORT_IO_BYTES || val > OBD_MAX_SHORT_IO_BYTES)) {
rc = -ERANGE;
goto out;
}
@@ -1933,7 +1933,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:
@@ -1321,9 +1321,9 @@ static int osc_brw_prep_request(int cmd, struct client_obd *cli,
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,
@@ -1762,7 +1762,6 @@ static int osc_brw_fini_request(struct ptlrpc_request *req, int rc)
CERROR("Unexpected +ve rc %d\n", rc);
return -EPROTO;
}
- LASSERT(req->rq_bulk->bd_nob == aa->aa_requested_nob);
if (req->rq_bulk &&
sptlrpc_cli_unwrap_bulk_write(req, req->rq_bulk))