Message ID | 20230417110617.2664129-3-shikemeng@huaweicloud.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1848061vqo; Sun, 16 Apr 2023 20:05:19 -0700 (PDT) X-Google-Smtp-Source: AKy350Y/swxfuV1n/tyYnTL01nEGi9IIijGD64MRrRNRgxre24EVCYDAupS4OUDZ6eFheXo7Tjne X-Received: by 2002:a17:903:190:b0:1a2:86c6:7b66 with SMTP id z16-20020a170903019000b001a286c67b66mr13428753plg.4.1681700719605; Sun, 16 Apr 2023 20:05:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681700719; cv=none; d=google.com; s=arc-20160816; b=jqidT2CRTZtUYw3JZ7d7co/ZMVS26hRRpNomd9CD9YF09WYz7eA912nbM6IMdxL1fA 2Hajm2bymH56hF3FvB11F/M3wBMJJz89mRClmNH2Ke81KC42w4qyDx9FtpEA5HaiYBGM quGbp2E/gBU1eOjW1R5iNwmPXV7LhqMc7r/mgiQdaXiiStY4MfZcPJ9/vkqGaKPGjDbn /yG1Kht5ugu9B/jvRANvNaQgSAdrroRrS8ZhRuoRGXWb5JMQvXHq9Bi5jjw1FMp4hmK4 2QYOfpYH8vzRre2pYWHgpOOKM7IKCW2QBMbxtRsBooI0c1YpC0BfdEDPZY3YM7SS/zgX ZKoA== 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=3KuTnu51zk6QgXMd/0G6Vd9vRaVPE8xBRGnI1Wesm94=; b=dWjzhFB8eAbbPzeOympMV+pz++jlbhnOa8c+FL6SLPtBRf9a5sQAX8MjkxdMbWwTNO GsaHq5nnKkAPR85IPsZsVxdQKbDvpyHs/D7jFbK7LgOY46XR5Ivpv8zy6W0lLspy47FN 3mnuCQXwUFEpKscdQBQ7//iDyajtIBSTxLCYbbK5Kg7qaKQMSTy9ZbAGdNHiDGfd0iZj dvDUS1zpV5nHIwq3bxkCnQtF07pYpwpU3KHY+QOnAt4F17uqzlhUJGv4L41n9OljmExp 03xqf2EWDs9fECcEAPTGQhU4wRAanT+azoAyG4wlEPviU8GfvOVKJ45NWsKhf73XTKzV NjGA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c9-20020a170902c1c900b001a20c983d21si10733989plc.51.2023.04.16.20.05.07; Sun, 16 Apr 2023 20:05:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230106AbjDQDEQ (ORCPT <rfc822;leviz.kernel.dev@gmail.com> + 99 others); Sun, 16 Apr 2023 23:04:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229473AbjDQDEA (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 16 Apr 2023 23:04:00 -0400 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67F5D26BB; Sun, 16 Apr 2023 20:03:58 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4Q0Bhn4yfzz4f47kF; Mon, 17 Apr 2023 11:03:53 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP1 (Coremail) with SMTP id cCh0CgAXODIXtzxkfzJgHA--.17426S4; Mon, 17 Apr 2023 11:03:55 +0800 (CST) From: Kemeng Shi <shikemeng@huaweicloud.com> To: tytso@mit.edu, adilger.kernel@dilger.ca, ojaswin@linux.ibm.com Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, shikemeng@huaweicloud.com Subject: [PATCH v3 02/19] ext4: fix unit mismatch in ext4_mb_new_blocks_simple Date: Mon, 17 Apr 2023 19:06:00 +0800 Message-Id: <20230417110617.2664129-3-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230417110617.2664129-1-shikemeng@huaweicloud.com> References: <20230417110617.2664129-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: cCh0CgAXODIXtzxkfzJgHA--.17426S4 X-Coremail-Antispam: 1UD129KBjvJXoW7tw1DGFW3GrWkurWxur4xtFb_yoW8Gw4rpw s8AF10kr1xWr1Dua1xZ3yFqw1fZw1xCr17XrZ5C395WryxX34fCFsxtF1rtF1rtFsxX3ZI qr15Zryruw48G3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUPSb4IE77IF4wAFF20E14v26ryj6rWUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M280x2IEY4vEnII2IxkI6r1a6r45M2 8IrcIa0xkI8VA2jI8067AKxVWUXwA2048vs2IY020Ec7CjxVAFwI0_Gr0_Xr1l8cAvFVAK 0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4 x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l 84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I 8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AK xVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zV CS5cI20VAGYxC7MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E 5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAV WUtwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY 1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI 0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7s RNVbyUUUUUU== X-CM-SenderInfo: 5vklyvpphqwq5kxd4v5lfo033gof0z/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=2.5 required=5.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, KHOP_HELO_FCRDNS,MAY_BE_FORGED,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763391013699938850?= X-GMAIL-MSGID: =?utf-8?q?1763391013699938850?= |
Series |
Fixes, cleanups and unit test for mballoc
|
|
Commit Message
Kemeng Shi
April 17, 2023, 11:06 a.m. UTC
The "i" returned from mb_find_next_zero_bit is in cluster unit and we need offset "block" corresponding to "i" in block unit. Convert "i" to block unit to fix the unit mismatch. Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com> Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com> --- fs/ext4/mballoc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 544915088d99..fbbd19cec1c9 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -5954,6 +5954,7 @@ static ext4_fsblk_t ext4_mb_new_blocks_simple(handle_t *handle, { struct buffer_head *bitmap_bh; struct super_block *sb = ar->inode->i_sb; + struct ext4_sb_info *sbi = EXT4_SB(sb); ext4_group_t group; ext4_grpblk_t blkoff; ext4_grpblk_t max = EXT4_CLUSTERS_PER_GROUP(sb); @@ -5982,7 +5983,8 @@ static ext4_fsblk_t ext4_mb_new_blocks_simple(handle_t *handle, if (i >= max) break; if (ext4_fc_replay_check_excluded(sb, - ext4_group_first_block_no(sb, group) + i)) { + ext4_group_first_block_no(sb, group) + + EXT4_C2B(sbi, i))) { blkoff = i + 1; } else break; @@ -5999,7 +6001,7 @@ static ext4_fsblk_t ext4_mb_new_blocks_simple(handle_t *handle, return 0; } - block = ext4_group_first_block_no(sb, group) + i; + block = ext4_group_first_block_no(sb, group) + EXT4_C2B(sbi, i); ext4_mb_mark_bb(sb, block, 1, 1); ar->len = 1;