From patchwork Thu Feb 27 21:12:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11410323 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 BE73292A for ; Thu, 27 Feb 2020 21:35:01 +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 A644924677 for ; Thu, 27 Feb 2020 21:35:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A644924677 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 779C434A031; Thu, 27 Feb 2020 13:29:27 -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 3826721FDF1 for ; Thu, 27 Feb 2020 13:19:41 -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 830ED8A22; Thu, 27 Feb 2020 16:18:16 -0500 (EST) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 800A846A; Thu, 27 Feb 2020 16:18:16 -0500 (EST) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Thu, 27 Feb 2020 16:12:19 -0500 Message-Id: <1582838290-17243-272-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 271/622] lustre: llite: improve max_readahead console messages 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 Improve the max_readahead_mb, max_readahead_per_file_mb, and max_read_ahead_whole_mb console error messages to print the parameters properly in MB instead of PAGE_SIZE units, and include the filesystem name and bad parameters in the output. WC-bug-id: https://jira.whamcloud.com/browse/LU-1095 Lustre-commit: 48a0697d7910 ("LU-1095 llite: improve max_readahead console messages") Signed-off-by: Andreas Dilger Reviewed-on: http://review.whamcloud.com/12399 Reviewed-by: Dmitry Eremin Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin green@whamcloud.com> Signed-off-by: James Simmons --- fs/lustre/llite/lproc_llite.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/fs/lustre/llite/lproc_llite.c b/fs/lustre/llite/lproc_llite.c index 197c09c..cc9f80e 100644 --- a/fs/lustre/llite/lproc_llite.c +++ b/fs/lustre/llite/lproc_llite.c @@ -346,16 +346,19 @@ static ssize_t max_read_ahead_mb_store(struct kobject *kobj, ll_kset.kobj); int rc; unsigned long pages_number; + int pages_shift; + pages_shift = 20 - PAGE_SHIFT; rc = kstrtoul(buffer, 10, &pages_number); if (rc) return rc; - pages_number *= 1 << (20 - PAGE_SHIFT); /* MB -> pages */ + pages_number <<= pages_shift; /* MB -> pages */ if (pages_number > totalram_pages() / 2) { - CERROR("can't set file readahead more than %lu MB\n", - totalram_pages() >> (20 - PAGE_SHIFT + 1)); /*1/2 of RAM*/ + CERROR("%s: can't set max_readahead_mb=%lu > %luMB\n", + sbi->ll_fsname, pages_number >> pages_shift, + totalram_pages() >> (pages_shift + 1)); /*1/2 of RAM*/ return -ERANGE; } @@ -393,14 +396,20 @@ static ssize_t max_read_ahead_per_file_mb_store(struct kobject *kobj, ll_kset.kobj); int rc; unsigned long pages_number; + int pages_shift; + pages_shift = 20 - PAGE_SHIFT; rc = kstrtoul(buffer, 10, &pages_number); if (rc) return rc; + pages_number <<= pages_shift; /* MB -> pages */ + if (pages_number > sbi->ll_ra_info.ra_max_pages) { - CERROR("can't set file readahead more than max_read_ahead_mb %lu MB\n", - sbi->ll_ra_info.ra_max_pages); + CERROR("%s: can't set max_readahead_per_file_mb=%lu > max_read_ahead_mb=%lu\n", + sbi->ll_fsname, + pages_number >> pages_shift, + sbi->ll_ra_info.ra_max_pages >> pages_shift); return -ERANGE; } @@ -438,17 +447,22 @@ static ssize_t max_read_ahead_whole_mb_store(struct kobject *kobj, ll_kset.kobj); int rc; unsigned long pages_number; + int pages_shift; + pages_shift = 20 - PAGE_SHIFT; rc = kstrtoul(buffer, 10, &pages_number); if (rc) return rc; + pages_number <<= pages_shift; /* MB -> pages */ /* Cap this at the current max readahead window size, the readahead * algorithm does this anyway so it's pointless to set it larger. */ if (pages_number > sbi->ll_ra_info.ra_max_pages_per_file) { - CERROR("can't set max_read_ahead_whole_mb more than max_read_ahead_per_file_mb: %lu\n", - sbi->ll_ra_info.ra_max_pages_per_file >> (20 - PAGE_SHIFT)); + CERROR("%s: can't set max_read_ahead_whole_mb=%lu > max_read_ahead_per_file_mb=%lu\n", + sbi->ll_fsname, + pages_number >> pages_shift, + sbi->ll_ra_info.ra_max_pages_per_file >> pages_shift); return -ERANGE; }