Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3730420rwd; Sat, 3 Jun 2023 10:36:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5FafOC35s8KCd3hlzrlmlAX5MqSgmzOCim/XTkuJG42U6bqlOm/wgI/QUnnRlsPvIVXSVY X-Received: by 2002:a05:6a00:c8e:b0:64d:1185:2411 with SMTP id a14-20020a056a000c8e00b0064d11852411mr12367370pfv.18.1685813786733; Sat, 03 Jun 2023 10:36:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685813786; cv=none; d=google.com; s=arc-20160816; b=0uskGFRBnnpHWGL3YqBvbuf3HIDPzQs6cK3BNK+10+fY9oShByrHpJWHs1ka9ECrDm Umzsul5wyYB/lnKjbbCRjTRVqYzvEJO9f3+58K7qi9KCzIuZi2memrqnZ0Mzp4OqyXAc 4Qd1eTscFj4N+cxcklOy977C3DMtFQkK5kDudsnP2D5sU3EPsMudhxV5ckbrFrjiaL81 eFKHpy3weglpqDN8IZXY5CQ5A8Tfd3pubnybozk+eDM0pu0Z9lvZEXLDhMygHx5jY7gn CD00/4123Emd2XdwhrGfYAlvjskGchAbnEK5mDfiy8qY0OBfYSneYiC07fqq+fiisI4I gm3A== 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:date :subject:cc:to:from:message-id:dkim-signature; bh=uAP3FqBrEWEzvObMBRutUO4oMwLpHty4nVZ2xxX1uks=; b=VUUp+gQHgFXFbpXzZngdTlwGZh0Y/Fgk8rr2iqs+GN2haeHrHv65tfLTZXF97rteEV n0N11E6X0UEZwFBt/CjcY7JUDLU4S4zW4zyBzn0E30m3UzhUdLZMk0Cj8sHfKhLEsYBZ VcpfIi8GZHuTK9Oqc1cmBQMniu+cbL0bUs6teU6QPtxJoqIJ6BI8wBQgnZB/FQwwOqfL GusRruPpBzmelwxQrF5akC5PNlq0VDdwAjG1CTnhN73qe/DM7FzKlj4Ej4T2nn4GrB/t i+QOz755EF9Dn3fbd7KuRXmgQcqtjjtEF27QKtP+/90OwVZkYTUr6odKGP9rEhaxDz53 jeIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=CR0Z6MPV; 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=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 72-20020a62174b000000b0064d2c624630si2801365pfx.23.2023.06.03.10.36.06; Sat, 03 Jun 2023 10:36:26 -0700 (PDT) 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=@foxmail.com header.s=s201512 header.b=CR0Z6MPV; 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=NONE dis=NONE) header.from=foxmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229572AbjFCQeH (ORCPT + 99 others); Sat, 3 Jun 2023 12:34:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbjFCQeD (ORCPT ); Sat, 3 Jun 2023 12:34:03 -0400 Received: from out203-205-221-209.mail.qq.com (out203-205-221-209.mail.qq.com [203.205.221.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0881D8 for ; Sat, 3 Jun 2023 09:33:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1685810035; bh=uAP3FqBrEWEzvObMBRutUO4oMwLpHty4nVZ2xxX1uks=; h=From:To:Cc:Subject:Date; b=CR0Z6MPVUz2hSh4wsqCruX+KN5s70fZpx4R6kb3RyNdGFfMat/6+R54rPQZDJ57Ce cE3FbgUHTTQz7ICQGGICEIyQDYjuQQMgLyuBTQQs9x6ZM/GtOBaHHu25N2MUJmNRJH Dt8hF0wSeb9NxQCfKKA2mkXqGQgQaHqSiG4rQ8Ek= Received: from fedora.. ([2409:8a00:2579:18c0:81cf:3f94:28ba:8d3a]) by newxmesmtplogicsvrszb9-0.qq.com (NewEsmtp) with SMTP id 87622CCA; Sun, 04 Jun 2023 00:33:54 +0800 X-QQ-mid: xmsmtpt1685810034t043dbu2i Message-ID: X-QQ-XMAILINFO: NyTsQ4JOu2J2FtRFERjSLev2Y3o836dxUDC+RnUeU2pnLbPD2Kqp+yWJdWVlEq D/01hXzmTww5jdjAj+jPJoRQkfiuvgmJf6oiiUfkG6RA6ICnNmf+GtWzSaox2bL9aYPT0xA5aiM2 EgPvv+vwO8tn+/Io73AhH8a7/AxHvsatyihEmw4kFQRkHvOWjzfzTIUgnJNozMi3BxOIefB8wk1r Jxy3kHweQgUHKx6qkiCoweQWtJjK3n3pQtNamhiKeJlRI4hoHgT2hFtrax9qR/bD+pwWfQcRZlqF LiTSjoQg/tExuFbqfnmCNX8RQWgm8fCuvi/MJ4FrG1C7JoG5RJ0t3r2j3bcoXpOvavrx85hbTLMb 81B+EhFieVn6fXAWmMqnR/Fa9awttpFckzBujbnkbeKFnPm5Qs3yJeFpm3azwL9G94xQX8zTGBvE ruuK8+O2SX2OYJy/F+CybVFYlo9mKgDRQ+xOM738FTl92IozS8hxvmQfYxd6lzcUYmWf15lpnndE h2pe6ZsNmWtrbe/9CD8Moil6Iwrkoqkbak3FPDjVjb3/4SUT7wsxCNrfkmfg+R0dm1NC1x0GYc+x tL6sd6hVTvc54KbRAOkSeVWrOks/ikSyaGulTRef9WR7PFu7x9n3hgSUWRVPAG+1rCs5hKqAIgKT YOg/QLz69p1AtC2bLZSClA4HGIkYCAxhxHoSw5j208+9dC27rB9mHAyjl50sHReh501SgMtDwTiX tYGHYffuYeLvUO4Uoqkam4EVx5RNamMJ5/SKzpeaQaJaD4UHt91cK1FPzJ6KyoJKoNev6hCaFk2r dCNndHbCzGfcvWDIruoZGRDrjVJ2fIjk62TGT9kdnk+7tRriMu5tKg+wisKsNt8D3/wb9bDic7pt FaeYIPzniIB8u2h865a0piGg9Zmg369xrS7cDbgUXIYNrXoGsW6i4AxTGB9Ge6lRXNClivUhXQIQ yOEgEn5LU+ntipOctc2FYp5LOaMran6kweIT1UuuZo1+SQRHbkJu+kc6eAzq8S From: Wang Jianjian To: linux-ext4@vger.kernel.org, tytso@mit.edu Cc: wangjianjian0@foxmail.com Subject: [PATCH] ext4: Add correct group descriptors and reserved GDT blocks to system zone Date: Sun, 4 Jun 2023 00:33:50 +0800 X-OQ-MSGID: <20230603163350.40117-1-wangjianjian0@foxmail.com> X-Mailer: git-send-email 2.34.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,HELO_DYNAMIC_IPADDR,RCVD_IN_DNSWL_NONE,RDNS_DYNAMIC, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * 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 When setup_system_zone, flex_bg is not initialzied so it is always 1. and when meta_bg enabled, group descriptors are located in the first, second, and the last group of meta group. And this patch also adds reserved GDT blocks to system zone. Signed-off-by: Wang Jianjian --- fs/ext4/block_validity.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c index 5504f72bbbbe..5df357763975 100644 --- a/fs/ext4/block_validity.c +++ b/fs/ext4/block_validity.c @@ -215,7 +215,6 @@ int ext4_setup_system_zone(struct super_block *sb) struct ext4_system_blocks *system_blks; struct ext4_group_desc *gdp; ext4_group_t i; - int flex_size = ext4_flex_bg_size(sbi); int ret; system_blks = kzalloc(sizeof(*system_blks), GFP_KERNEL); @@ -224,11 +223,14 @@ int ext4_setup_system_zone(struct super_block *sb) for (i=0; i < ngroups; i++) { cond_resched(); - if (ext4_bg_has_super(sb, i) && - ((i < 5) || ((i % flex_size) == 0))) { + unsigned int sb_num = ext4_bg_has_super(sb, i); + unsigned long gdb_num = ext4_bg_num_gdb(sb, i); + unsigned int rsvd_gdt = le16_to_cpu(sbi->es->s_reserved_gdt_blocks); + + if (sb_num != 0 || gdb_num != 0) { ret = add_system_zone(system_blks, ext4_group_first_block_no(sb, i), - ext4_bg_num_gdb(sb, i) + 1, 0); + sb_num + gdb_num + rsvd_gdt, 0); if (ret) goto err; } -- 2.34.3