From patchwork Fri Mar 1 23:27:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10836219 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 7F67C1575 for ; Fri, 1 Mar 2019 23:27:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62AE12F050 for ; Fri, 1 Mar 2019 23:27:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4FC342F0AF; Fri, 1 Mar 2019 23:27:32 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8F322F050 for ; Fri, 1 Mar 2019 23:27:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726632AbfCAX1a (ORCPT ); Fri, 1 Mar 2019 18:27:30 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:45896 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725958AbfCAX13 (ORCPT ); Fri, 1 Mar 2019 18:27:29 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x21NOK8m123071 for ; Fri, 1 Mar 2019 23:27:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=F3nve9a9otUdCGhNveVCT7V8l/1YFNvIYgABm8e5ebE=; b=rwJFjks7d5Wl/NItMOevcJ4Sei5awXTDADKpjGdBgCjJaU3/gGENxhilVlMNAEXLgTFO i9Gf4XN7GTOEkceuWPAk250mFWLpkKYYUWhjlc/qE+TsMix2zgiAVlpCfcq3+4ZuNSWY P+RVyueW/y0PFlIhIbQFUavXYmPW+TnClboZaq9ScHGTou+LhWQFbWocrUeu9l/KIa+j cs4QpINwTp+2K6Pg1mJH9+aHJNYuuLAIjrVrUUgKN/rhdS2hqOzy/tXoER4ZlQvFZtTE EiZgvFyc7mQYvreh9XU5QvMQD4rFD+inm95r4XD1WMk/cjHuAxugbViOH6QBl9+pyLO8 Ig== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2qtwkut8y9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 01 Mar 2019 23:27:27 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x21NRQ5A031740 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 1 Mar 2019 23:27:27 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x21NRQxt020845 for ; Fri, 1 Mar 2019 23:27:26 GMT Received: from localhost (/10.159.229.175) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 01 Mar 2019 15:27:26 -0800 Subject: [PATCH 06/23] xfs_scrub: rename the global nr_threads From: "Darrick J. Wong" To: darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Fri, 01 Mar 2019 15:27:25 -0800 Message-ID: <155148284558.16677.15018253328352883955.stgit@magnolia> In-Reply-To: <155148280859.16677.6057998944865066232.stgit@magnolia> References: <155148280859.16677.6057998944865066232.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9182 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903010161 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong Various functions have nr_threads local variables that shadow the global one. Since the global one forces the number of threads we use, change its name to remove this ambiguity and reflect what it really does. Signed-off-by: Darrick J. Wong --- scrub/common.c | 4 ++-- scrub/disk.c | 4 ++-- scrub/xfs_scrub.c | 6 +++--- scrub/xfs_scrub.h | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scrub/common.c b/scrub/common.c index 78afc4bf..c877c7c8 100644 --- a/scrub/common.c +++ b/scrub/common.c @@ -231,8 +231,8 @@ unsigned int scrub_nproc( struct scrub_ctx *ctx) { - if (nr_threads) - return nr_threads; + if (force_nr_threads) + return force_nr_threads; return ctx->nr_io_threads; } diff --git a/scrub/disk.c b/scrub/disk.c index 7daa508e..dd109533 100644 --- a/scrub/disk.c +++ b/scrub/disk.c @@ -75,8 +75,8 @@ unsigned int disk_heads( struct disk *disk) { - if (nr_threads) - return nr_threads; + if (force_nr_threads) + return force_nr_threads; return __disk_heads(disk); } diff --git a/scrub/xfs_scrub.c b/scrub/xfs_scrub.c index b8138000..71fc274f 100644 --- a/scrub/xfs_scrub.c +++ b/scrub/xfs_scrub.c @@ -133,7 +133,7 @@ unsigned int bg_mode; int nproc; /* Number of threads we're allowed to use. */ -unsigned int nr_threads; +unsigned int force_nr_threads; /* Verbosity; higher values print more information. */ bool verbose; @@ -589,7 +589,7 @@ main( } break; case 'b': - nr_threads = 1; + force_nr_threads = 1; bg_mode++; break; case 'C': @@ -659,7 +659,7 @@ main( perror("nr_threads"); usage(); } - nr_threads = x; + force_nr_threads = x; } if (optind != argc - 1) diff --git a/scrub/xfs_scrub.h b/scrub/xfs_scrub.h index a961d8fd..a459e4b5 100644 --- a/scrub/xfs_scrub.h +++ b/scrub/xfs_scrub.h @@ -10,7 +10,7 @@ extern char *progname; #define _PATH_PROC_MOUNTS "/proc/mounts" -extern unsigned int nr_threads; +extern unsigned int force_nr_threads; extern unsigned int bg_mode; extern unsigned int debug; extern int nproc;