From patchwork Thu Mar 14 21:05:09 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: 10853611 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 873AB17E6 for ; Thu, 14 Mar 2019 21:05:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D82A29E7B for ; Thu, 14 Mar 2019 21:05:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B0342A24A; Thu, 14 Mar 2019 21:05:14 +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 15E7C2A78A for ; Thu, 14 Mar 2019 21:05:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727760AbfCNVFN (ORCPT ); Thu, 14 Mar 2019 17:05:13 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:50920 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727749AbfCNVFN (ORCPT ); Thu, 14 Mar 2019 17:05:13 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x2EKwqLK102588; Thu, 14 Mar 2019 21:05:11 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=Yf4cp8/bOdGwF9rVbp/DETVmC4BagKq7/Lrfx1zF9lE=; b=vL+xZY+Wvk0N4INmr5d7l008zmrF4lXKtjKGjssxR2YqWSgntTfFSxRFa97si/LMnnBq MK9xXReWOWCDmk1mJfNHsg9U9VEC3Wi61Q3fRhjyoQDtf9gU0T/S7FQJ1a0KH/NEUkJT 6pnEH9JcDFNRA49xgt9jrJhdQ6MtjGzsVjjC0YqjAD+2GmYDInF8jrSFZQAuDZWAfhiQ ray0o16D77DoEt635JnFQCcH2Vdacx1UmStRYpxhdAK4iw83Z1G/k8unfDz+0pZO9zv+ yEAM/AvFO36j92u05ZbBKvod1aNSDtjb9gBVLjDFMZnr4s/xqITPBqlJWVqoeZ7GnKxe 6Q== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2r464ruege-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 14 Mar 2019 21:05:10 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x2EL5AbP006014 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 14 Mar 2019 21:05:10 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x2EL5Aaj006984; Thu, 14 Mar 2019 21:05:10 GMT Received: from localhost (/10.145.178.102) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 14 Mar 2019 21:05:09 +0000 Subject: [PATCH 13/36] xfs_scrub: use datadev parallelization estimates for thread count From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Thu, 14 Mar 2019 14:05:09 -0700 Message-ID: <155259750953.31886.7244219282258067422.stgit@magnolia> In-Reply-To: <155259742281.31886.17157720770696604377.stgit@magnolia> References: <155259742281.31886.17157720770696604377.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9195 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 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-1903140143 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 During phases 2-5, xfs_scrub should estimate the level of parallelization possible on the data device to determine the number of threads spawned to scrub filesystem metadata, not just blindly using the number of CPUs. This avoids flooding non-rotational storage with random reads, which totally destroys performance and makes scrub runtimes higher. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen --- scrub/phase1.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scrub/phase1.c b/scrub/phase1.c index 2113014b..6b472147 100644 --- a/scrub/phase1.c +++ b/scrub/phase1.c @@ -109,13 +109,6 @@ _("Must be root to run scrub.")); return false; } - ctx->nr_io_threads = nproc; - if (verbose) { - fprintf(stdout, _("%s: using %d threads to scrub.\n"), - ctx->mntpoint, scrub_nproc(ctx)); - fflush(stdout); - } - if (!platform_test_xfs_fd(ctx->mnt_fd)) { str_info(ctx, ctx->mntpoint, _("Does not appear to be an XFS filesystem!")); @@ -193,6 +186,13 @@ _("Unable to find realtime device path.")); return false; } + ctx->nr_io_threads = disk_heads(ctx->datadev); + if (verbose) { + fprintf(stdout, _("%s: using %d threads to scrub.\n"), + ctx->mntpoint, scrub_nproc(ctx)); + fflush(stdout); + } + if (ctx->fsinfo.fs_log) { ctx->logdev = disk_open(ctx->fsinfo.fs_log); if (error) {