Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1661292rwb; Mon, 7 Nov 2022 04:27:41 -0800 (PST) X-Google-Smtp-Source: AMsMyM7KCpCP/+ItMydK6iaLCE0szMqV7lx3EMMb/8z1LHdc/Rj7dD2txJWmVHn5N22ByMcblPKq X-Received: by 2002:a17:907:724c:b0:7ad:8f76:1fb8 with SMTP id ds12-20020a170907724c00b007ad8f761fb8mr47961098ejc.582.1667824061383; Mon, 07 Nov 2022 04:27:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667824061; cv=none; d=google.com; s=arc-20160816; b=bQCsstd5GMd59OBCoBerMb281xjLUdAQjED62A79IJYi/1bkaC5BshW1iF60HGEaP8 3I2UyQmdqIHl3b7fmEj0A3Flakj3im3PGTE3fRxmMcO0AuHpD3AT5LLiozNhpkdAWJPC TB3KVYPCqlJZWGhC7Mn/YTt1/MNB0IEK+4vKt5rWHjaNLGTOfgYHxd69SpltO6qUJqPG P6xHjCTJTNm9fNcSEEaJp2Tr+IPQXtybd0mhuPAkM5PKaRFcJzn+H1sCUwp3KlHgY5eo hkoLNW1s+r23nwegUEIouiL1kZCp+gle4e6OE24g7VeuHHBPm76YbjGdA69MLKFIBvdG bUDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=djX6kG4sb5dSN1Jo9voKc/t70N6XAj7Y4LtlOcTTGEI=; b=Y0tk1/KESZdgrPJ6OkGGMt634oG09HO7StGdEFqnK4b03X7i8TEYnoiQ3jlcyQRyNd q0pyAh5Xdoss+2ZnfnDWMvVlHvTJMTcMcKDyj3LFang/wcck+UmlB8Q9qK2CbUlGkCvl T11XYxgtW3c800iPwbzFcne09zX6a8yLzj0BEnmZ8Q9RehMVqO230jT/rObcGrZkymj8 K2PIfZF7B8hYD2/pmrhx7lu+2ju52n+cor8S+kI+rdOynXgLot/h1Bb21iCakXkzVTQj EpBR7Bsl1XkTkgsF5IbvwUOo6ZKIqXX2CfjxDtQnSx5kTa2wUE9T4jk84Gfj55CaUmFm WNAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=JUhJRCd5; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hb40-20020a170907162800b007ae2dfe020bsi10727825ejc.783.2022.11.07.04.27.17; Mon, 07 Nov 2022 04:27:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=JUhJRCd5; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232190AbiKGM0n (ORCPT + 99 others); Mon, 7 Nov 2022 07:26:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232106AbiKGM0m (ORCPT ); Mon, 7 Nov 2022 07:26:42 -0500 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EFB863D5 for ; Mon, 7 Nov 2022 04:26:42 -0800 (PST) Received: by mail-pg1-x52a.google.com with SMTP id e129so10303432pgc.9 for ; Mon, 07 Nov 2022 04:26:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=djX6kG4sb5dSN1Jo9voKc/t70N6XAj7Y4LtlOcTTGEI=; b=JUhJRCd5DAjnwvACzAeMR1dtwzdkXflnrkpW0fMdisLYmtuZkezcnQyBt3CF1j5PjO B2N6pcwKH6/MfMNgzVt40q7oImNYyQb5B37k2raftfpD42Xi+H+FFV95Xqhjz8Xzrsp8 73Oz5542gfL3K+qOFcBiw45rThLoqEYTOQwVrrExh7ZvN+EfN3ZqZnk8Iw4C7xbD/MWA ShBsy4ug5HOOGS/Kg8CsF8o7yAl90YqUSDyQCyIbJPTNfsV02HZYTRLnIM9Uj5NTXQDE S7Pvtj4BsQCNwk/MXKI2efaVjE1kWiwIzmUP70rllBCa/4Xoil7WZQC07b4e4VIcUEoV lxVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=djX6kG4sb5dSN1Jo9voKc/t70N6XAj7Y4LtlOcTTGEI=; b=nhyKec9cR/dEbTAcd/rpIeutE8O3Kuo5rdwooHmtPMMM6gZz09NEnax3eHx2eIi3N3 MKO7wtnXqrVrIBJNwScc/DHf2phDkWHqWracEnqINIxI7GfBnEWUfsenkv/wWI7BeB09 OvYn6h683QaYv3UW8ua7ULHcE3gEjcVIU/FT271eQfJURdVteJWskiJXrSrBw4VqfoRb 5JJ2uVzYR1QSigJMuCyPX0Ban1u+HX+t8EkQsSc56FdUrNJjAn6zYXBR9a9fSGQHNwaQ J65rK4qvobHkeFnUp63Du5e/Hz1hb/UEowIFVA/BjjZaJyWyZa3xsZD9tMMby0iZZ3a2 bsvA== X-Gm-Message-State: ACrzQf0dM691NYYLzVHNCF9Qm05Z0IAz1h8XR7MrbdUzqzPRjWOzvWP2 SN2frM+CqobWwGLeDC/aHb8= X-Received: by 2002:a62:ea09:0:b0:562:a86f:63af with SMTP id t9-20020a62ea09000000b00562a86f63afmr51018117pfh.71.1667824001646; Mon, 07 Nov 2022 04:26:41 -0800 (PST) Received: from localhost ([2406:7400:63:f20b:312d:45b2:85c1:c486]) by smtp.gmail.com with ESMTPSA id p1-20020a170902ebc100b00179c9219195sm4881685plg.16.2022.11.07.04.26.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Nov 2022 04:26:40 -0800 (PST) From: "Ritesh Harjani (IBM)" To: Theodore Ts'o Cc: linux-ext4@vger.kernel.org, Harshad Shirwadkar , Wang Shilong , Andreas Dilger , Li Xi , Ritesh Harjani Subject: [RFCv1 42/72] e2fsck: merge quota context after threads finish Date: Mon, 7 Nov 2022 17:51:30 +0530 Message-Id: <31672b4c6e497a62c5f4fe0650cf0acde6c0b607.1667822611.git.ritesh.list@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Wang Shilong Every threads calculate its own quota accounting, merge them after threads finish. Signed-off-by: Wang Shilong Signed-off-by: Ritesh Harjani (IBM) --- e2fsck/pass1.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index 7e167189..213c1a51 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -2317,6 +2317,12 @@ static errcode_t e2fsck_pass1_thread_prepare(e2fsck_t global_ctx, e2fsck_t *thre if (thread_context->options & E2F_OPT_MULTITHREAD) log_out(thread_context, _("Scan group range [%d, %d)\n"), tinfo->et_group_start, tinfo->et_group_end); + retval = quota_init_context(&thread_context->qctx, thread_fs, 0); + if (retval) { + com_err(global_ctx->program_name, retval, + "while init quota context"); + goto out_fs; + } *thread_ctx = thread_context; return 0; out_fs: @@ -2454,6 +2460,7 @@ static int e2fsck_pass1_thread_join_one(e2fsck_t global_ctx, e2fsck_t thread_ctx ext2_ino_t dx_dir_info_size = global_ctx->dx_dir_info_size; ext2_ino_t dx_dir_info_count = global_ctx->dx_dir_info_count; ext2_u32_list dirs_to_hash = global_ctx->dirs_to_hash; + quota_ctx_t qctx = global_ctx->qctx; #ifdef HAVE_SETJMP_H jmp_buf old_jmp; @@ -2530,6 +2537,12 @@ static int e2fsck_pass1_thread_join_one(e2fsck_t global_ctx, e2fsck_t thread_ctx return retval; } + global_ctx->qctx = qctx; + retval = quota_merge_and_update_usage(global_ctx->qctx, + thread_ctx->qctx); + if (retval) + return retval; + retval = e2fsck_pass1_merge_bitmap(global_fs, &thread_ctx->inode_used_map, &global_ctx->inode_used_map); @@ -2611,6 +2624,7 @@ static int e2fsck_pass1_thread_join(e2fsck_t global_ctx, e2fsck_t thread_ctx) ext2fs_free_icount(thread_ctx->inode_link_info); if (thread_ctx->dirs_to_hash) ext2fs_badblocks_list_free(thread_ctx->dirs_to_hash); + quota_release_context(&thread_ctx->qctx); if (thread_ctx->logf) fclose(thread_ctx->logf); -- 2.37.3