Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp309125rdb; Thu, 24 Aug 2023 06:56:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH5FX/I7QQBJuWcB5YhumKKV7VD/l3Uh0/ulvqYQnzOYjFoV83Msi1+2P13NTTRqq2KdtDO X-Received: by 2002:a17:906:315b:b0:988:9b29:5653 with SMTP id e27-20020a170906315b00b009889b295653mr11209654eje.77.1692885364837; Thu, 24 Aug 2023 06:56:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692885364; cv=none; d=google.com; s=arc-20160816; b=vFSxWFHHF/NFLyTCtX6ihV/HR2Nl+czJogv47KlcEpEUs6PbO2KGHuPsTPnAlHOThM PgZrnX0nDpE8iqfXkgRONuJ1ACf/X3IG1yCOpipxs9EarQhywrGae0JlGJyE92NgZ+i7 5okCAi0QQIHY3hJkAIETEXTPrDo0jG2mq0DMtRVxloJtLJ7iOjqOOpuKoWQmaNUSyldn zIwVO1ct6JqeOqqjxONRFLDlEpTOldE2yvqvb1JqvqDSHcdSjYwTufMPNqkQOmuujlxJ FvurJ5qJ1QhIYyDKVikMAfmo0dney+8IL8FsxcCycwezLeYlfu4KbQmJ3YGAz/BxB1Kl D1vg== 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; bh=ASK5p5fCix5iuWCsbrJMW9vMUFdq935tVAuaLylH7PI=; fh=kuRpQQorcKDqUwyIih6K7H1bgjOqULBSCDKVMHeTjvs=; b=hlP1iqAOZUZijod7/0qZyjiSlwA3CUzF3s0U2pln8kY9sy/ZxMg8arzRFa/i4DY4oy QxvbtCLGzqJbwYNWCFMHtvQYnrEDPMHeLpJbqPQRQf381p1iZiM/LE+5yhrQL6UlMofG tFU5Qm5WT+75g9oH+brYKmpS7Zl8ilS5atN0+hYVv0UK0hxUVIcBS0bfjNLBrOI3YATS mChAb1jHx5xIJCpvU9UjzRHYU7urzT+p1eSJY5C8vlkZlZb3UZYRPB2vh/2uMMDqFjC7 DEkNQ1tfOFtfRLPEDQNaeNvOlHfrB4NTH0rLPMPqxhGmB5zCcV4ueySUhZVDGWhjx/Pb JRGg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lh15-20020a170906f8cf00b00978779cfc97si10867865ejb.795.2023.08.24.06.55.39; Thu, 24 Aug 2023 06:56:04 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240751AbjHXJbH (ORCPT + 99 others); Thu, 24 Aug 2023 05:31:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240771AbjHXJaq (ORCPT ); Thu, 24 Aug 2023 05:30:46 -0400 Received: from dggsgout12.his.huawei.com (unknown [45.249.212.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D12310FA for ; Thu, 24 Aug 2023 02:30:44 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.169]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4RWd9T4wyXz4f3jYX for ; Thu, 24 Aug 2023 17:30:37 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgAHl6kzI+dkL1rbBQ--.46575S5; Thu, 24 Aug 2023 17:30:40 +0800 (CST) From: Zhang Yi To: linux-ext4@vger.kernel.org Cc: tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz, yi.zhang@huawei.com, yi.zhang@huaweicloud.com, chengzhihao1@huawei.com, yukuai3@huawei.com Subject: [RFC PATCH 01/16] ext4: correct the start block of counting reserved clusters Date: Thu, 24 Aug 2023 17:26:04 +0800 Message-Id: <20230824092619.1327976-2-yi.zhang@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230824092619.1327976-1-yi.zhang@huaweicloud.com> References: <20230824092619.1327976-1-yi.zhang@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgAHl6kzI+dkL1rbBQ--.46575S5 X-Coremail-Antispam: 1UD129KBjvJXoW7WF17tFyrWF1xJrW3Jw1UZFb_yoW8Gr15p3 WfJw13tr4rua4UGa48Kw1UGF1UAayjkFW7Wrs3t34fXFW5Zr95Gr18Kw40vFy5XFW8t3yr XF1jkw17Cay7ta7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9v14x267AKxVW5JVWrJwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_Jr4l82xGYIkIc2 x26xkF7I0E14v26r1I6r4UM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0 Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Cr1j6rxdM2 8EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s0DM2AI xVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20x vE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xv r2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7MxAIw28IcxkI7VAKI48JMxC20s 026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_ JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14 v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4v20xva j40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Gr0_Cr1lIxAIcVC2z280aVCY1x0267AKxVW8JV W8JrUvcSsGvfC2KfnxnUUI43ZEXa7VUbec_DUUUUU== X-CM-SenderInfo: d1lo6xhdqjqx5xdzvxpfor3voofrz/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,MAY_BE_FORGED, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE 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: Zhang Yi When big allocate feature is enabled, we need to count and update reserved clusters before removing a delayed only extent_status entry. {init|count|get}_rsvd() have already done this, but the start block number of this counting isn's correct in the following case. lblk end | | v v ------------------------- | | orig_es ------------------------- ^ ^ len1 is 0 | len2 | If the start block of the orig_es entry founded is bigger than lblk, we passed lblk as start block to count_rsvd(), but the length is correct, finally, the range to be counted is offset. This patch fix this by passing the start blocks to 'orig_es->lblk + len1'. Signed-off-by: Zhang Yi --- fs/ext4/extents_status.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c index 6f7de14c0fa8..5e625ea4545d 100644 --- a/fs/ext4/extents_status.c +++ b/fs/ext4/extents_status.c @@ -1405,8 +1405,8 @@ static int __es_remove_extent(struct inode *inode, ext4_lblk_t lblk, } } if (count_reserved) - count_rsvd(inode, lblk, orig_es.es_len - len1 - len2, - &orig_es, &rc); + count_rsvd(inode, orig_es.es_lblk + len1, + orig_es.es_len - len1 - len2, &orig_es, &rc); goto out_get_reserved; } -- 2.39.2