From patchwork Sun Oct 14 18:57:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 10640813 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CB31B17E3 for ; Sun, 14 Oct 2018 18:58:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C03E29522 for ; Sun, 14 Oct 2018 18:58:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6CE0B29527; Sun, 14 Oct 2018 18:58:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1232929527 for ; Sun, 14 Oct 2018 18:58:40 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id E131221FA9A; Sun, 14 Oct 2018 11:58:35 -0700 (PDT) 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 3F14A21F24F for ; Sun, 14 Oct 2018 11:58:24 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 37FE52239; Sun, 14 Oct 2018 14:58:21 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 325432BD; Sun, 14 Oct 2018 14:58:21 -0400 (EDT) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Sun, 14 Oct 2018 14:57:57 -0400 Message-Id: <1539543498-29105-8-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1539543498-29105-1-git-send-email-jsimmons@infradead.org> References: <1539543498-29105-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 07/28] lustre: llite: pipeline readahead better with large I/O 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" X-Virus-Scanned: ClamAV using ClamSMTP From: Jinshan Xiong Fixed a bug where next readahead is not set correctly when appplication issues large I/O; Extend the readahead window length to at least cover the size of current I/O. Signed-off-by: Jinshan Xiong WC-bug-id: https://jira.whamcloud.com/browse/LU-9574 Reviewed-on: https://review.whamcloud.com/27388 Reviewed-by: Bobi Jam Reviewed-by: Patrick Farrell Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/rw.c | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/rw.c b/drivers/staging/lustre/lustre/llite/rw.c index 82d874a..9cc0d4fe 100644 --- a/drivers/staging/lustre/lustre/llite/rw.c +++ b/drivers/staging/lustre/lustre/llite/rw.c @@ -494,10 +494,8 @@ static int ll_readahead(const struct lu_env *env, struct cl_io *io, end = end_index; ria->ria_eof = true; } - - ras->ras_next_readahead = max(end, end + 1); - RAS_CDEBUG(ras); } + ria->ria_start = start; ria->ria_end = end; /* If stride I/O mode is detected, get stride window*/ @@ -518,6 +516,7 @@ static int ll_readahead(const struct lu_env *env, struct cl_io *io, return 0; } + RAS_CDEBUG(ras); CDEBUG(D_READA, DFID ": ria: %lu/%lu, bead: %lu/%lu, hit: %d\n", PFID(lu_object_fid(&clob->co_lu)), ria->ria_start, ria->ria_end, @@ -555,25 +554,20 @@ static int ll_readahead(const struct lu_env *env, struct cl_io *io, if (ra_end == end && ra_end == (kms >> PAGE_SHIFT)) ll_ra_stats_inc(inode, RA_STAT_EOF); - /* if we didn't get to the end of the region we reserved from - * the ras we need to go back and update the ras so that the - * next read-ahead tries from where we left off. we only do so - * if the region we failed to issue read-ahead on is still ahead - * of the app and behind the next index to start read-ahead from - */ CDEBUG(D_READA, "ra_end = %lu end = %lu stride end = %lu pages = %d\n", ra_end, end, ria->ria_end, ret); - if (ra_end > 0 && ra_end != end) { + if (ra_end != end) ll_ra_stats_inc(inode, RA_STAT_FAILED_REACH_END); + + if (ra_end > 0) { + /* update the ras so that the next read-ahead tries from + * where we left off. + */ spin_lock(&ras->ras_lock); - if (ra_end <= ras->ras_next_readahead && - index_in_window(ra_end, ras->ras_window_start, 0, - ras->ras_window_len)) { - ras->ras_next_readahead = ra_end + 1; - RAS_CDEBUG(ras); - } + ras->ras_next_readahead = ra_end + 1; spin_unlock(&ras->ras_lock); + RAS_CDEBUG(ras); } return ret; @@ -857,7 +851,8 @@ static void ras_update(struct ll_sb_info *sbi, struct inode *inode, * of read-ahead, so we use original offset here, * instead of ras_window_start, which is RPC aligned */ - ras->ras_next_readahead = max(index, ras->ras_next_readahead); + ras->ras_next_readahead = max(index + 1, + ras->ras_next_readahead); ras->ras_window_start = max(ras->ras_stride_offset, ras->ras_window_start); } else {