Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4415208ioa; Wed, 27 Apr 2022 03:26:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgkBUPq/l1e748nj4V39vlYkn/FOCmuoudv9bLIR4x1Rhd6TZg2omQ1A11/q4BBY3bJ/du X-Received: by 2002:a17:90b:886:b0:1d9:3a05:3f2a with SMTP id bj6-20020a17090b088600b001d93a053f2amr22909714pjb.53.1651055162895; Wed, 27 Apr 2022 03:26:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651055162; cv=none; d=google.com; s=arc-20160816; b=g5/tdBMZAX4mql1r4gphUsgHVlwVgMFCzko6qBpEcLhNSYAbHWYHsNmqVHEov0ZKy3 orz5Dv46gYcJWVhKsYyUc8byvpOQCnkqTljk86+F+R1fxojlDGuy4HbwwzpOaxLT7sTa 8beylC+t1J1hNV/Hvyv4wa4g05lapu3WTQjT0sp6deQ/NOFNfX/n4IBc94cY7YjMchAD bfKxZ1xRcGd37mvaa4DcUirPckVAgsSzsv7W6QKzOwYLIJ4u+8TyX9vijhl5lBMzz3ZO xfeXWicW5MgqOoVWAtRL3LLkR6+V7+SN7hO8PvjAG/UZwwFDODSTVSmaoQFeAFe6Yot+ 5R+Q== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1LG1BZfSLiTxF4XbXJQHhxtCqmYIZQIT/iV4vrZohmk=; b=bLBDkgIX45G1kuElhyh/LN7DvlEeG4HnUIQlDr2EKG6BstU24lc+W7hbPpqZxlUCGz wTXw1SlFwIEVNIRRqsk7l/jh/9dIfY4/eFGkEhVtioPHTCJZHsko7i2oJIoHu+0Mrmoi U17721ltgyXxs3ET317MHa987aYpr+LAaBCtGz2Sm60zJ6kTkQlz1fmWlJygJJvy2Sb9 qUZMg1u9TvwBBpw1y1JrvzxDHlJeBvoSU9nK9v5P79Qx61od3Uz9o1B2WTs5Pa4wlQEq TzHETBe1faPS5ROJ9+ITnQ8qtog/gJreY7xtEAH05E9uzDX++4MT9megH3806DMVuCv3 Bjag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Un0A8cf2; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id p10-20020a170902eaca00b001590b345716si1132625pld.281.2022.04.27.03.26.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 03:26:02 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Un0A8cf2; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CD8E2384DA3; Wed, 27 Apr 2022 02:42:53 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346362AbiDZJAX (ORCPT + 99 others); Tue, 26 Apr 2022 05:00:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346883AbiDZIp2 (ORCPT ); Tue, 26 Apr 2022 04:45:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78FD81FA5B; Tue, 26 Apr 2022 01:36:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E3635B81CED; Tue, 26 Apr 2022 08:36:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56FA1C385A4; Tue, 26 Apr 2022 08:36:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650962165; bh=UHRPuTmqGxLHdHpx4pWSZlvt+YX/rS3XZemVEwKUkWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Un0A8cf29pzC7mFHeXLVMOTqQa+SWAhXlaY4Cb5QKne2WzSWWVRf/d2qmk/SqRoVZ 5Z6pewUo+wquA2MOFPuBoQTDpJn0IiehRQ2ZGemrjx5KW9dgj/saQT/VcR+tLX5boW IzuFEne25+ckeR5XSYlxlITjdS/JODzNm7fFZp8w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Theodore Tso , stable@kernel.org Subject: [PATCH 5.10 79/86] ext4: fix overhead calculation to account for the reserved gdt blocks Date: Tue, 26 Apr 2022 10:21:47 +0200 Message-Id: <20220426081743.496343497@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220426081741.202366502@linuxfoundation.org> References: <20220426081741.202366502@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable 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-kernel@vger.kernel.org From: Theodore Ts'o commit 10b01ee92df52c8d7200afead4d5e5f55a5c58b1 upstream. The kernel calculation was underestimating the overhead by not taking into account the reserved gdt blocks. With this change, the overhead calculated by the kernel matches the overhead calculation in mke2fs. Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman --- fs/ext4/super.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -3870,9 +3870,11 @@ static int count_overhead(struct super_b ext4_fsblk_t first_block, last_block, b; ext4_group_t i, ngroups = ext4_get_groups_count(sb); int s, j, count = 0; + int has_super = ext4_bg_has_super(sb, grp); if (!ext4_has_feature_bigalloc(sb)) - return (ext4_bg_has_super(sb, grp) + ext4_bg_num_gdb(sb, grp) + + return (has_super + ext4_bg_num_gdb(sb, grp) + + (has_super ? le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks) : 0) + sbi->s_itb_per_group + 2); first_block = le32_to_cpu(sbi->s_es->s_first_data_block) +