From patchwork Thu Feb 27 21:10:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11409901 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4EE06138D for ; Thu, 27 Feb 2020 21:25:16 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 372A0246A0 for ; Thu, 27 Feb 2020 21:25:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 372A0246A0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lustre-devel-bounces@lists.lustre.org Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 43B10348E12; Thu, 27 Feb 2020 13:22:45 -0800 (PST) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id BA3E721FB50 for ; Thu, 27 Feb 2020 13:18:58 -0800 (PST) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id D5C6213CB; Thu, 27 Feb 2020 16:18:14 -0500 (EST) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id D473D46F; Thu, 27 Feb 2020 16:18:14 -0500 (EST) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Thu, 27 Feb 2020 16:10:04 -0500 Message-Id: <1582838290-17243-137-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> References: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 136/622] lustre: osc: clarify short_io_bytes is maximum value X-BeenThere: lustre-devel@lists.lustre.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "For discussing Lustre software development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: Andreas Dilger 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 /sysfs functions in a similar manner but that also changes the /sysfs tunable name (via LUSTRE_RW_ATTR() macro) and has compatibility implications for sites that may have changed this value. WC-bug-id: https://jira.whamcloud.com/browse/LU-1757 Lustre-commit: b90812a674f6 ("LU-1757 osc: clarify short_io_bytes is maximum value") Signed-off-by: Andreas Dilger Reviewed-on: https://review.whamcloud.com/33173 Reviewed-by: Mike Pershin Reviewed-by: Patrick Farrell Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/include/obd.h | 2 +- fs/lustre/ldlm/ldlm_lib.c | 2 ++ fs/lustre/obdclass/lprocfs_status.c | 6 +++--- fs/lustre/osc/osc_request.c | 7 +++---- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/fs/lustre/include/obd.h b/fs/lustre/include/obd.h index 7cf9745..2587136 100644 --- a/fs/lustre/include/obd.h +++ b/fs/lustre/include/obd.h @@ -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; diff --git a/fs/lustre/ldlm/ldlm_lib.c b/fs/lustre/ldlm/ldlm_lib.c index 838ddb3..5fe5711 100644 --- a/fs/lustre/ldlm/ldlm_lib.c +++ b/fs/lustre/ldlm/ldlm_lib.c @@ -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. diff --git a/fs/lustre/obdclass/lprocfs_status.c b/fs/lustre/obdclass/lprocfs_status.c index 747baff..b3dbe85 100644 --- a/fs/lustre/obdclass/lprocfs_status.c +++ b/fs/lustre/obdclass/lprocfs_status.c @@ -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: diff --git a/fs/lustre/osc/osc_request.c b/fs/lustre/osc/osc_request.c index e968360..4524a98 100644 --- a/fs/lustre/osc/osc_request.c +++ b/fs/lustre/osc/osc_request.c @@ -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))