Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp833085lqh; Fri, 31 May 2024 20:44:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUP+JHeJ7NSg2NSGMZD7bAc+YTKWicAeFCR4l3rZpA3BKbH9LBq9zIemF7E+lAX+SM1PGKVyk3LdUPU5hfSGxilnKBb/hDU3L0JoxejIw== X-Google-Smtp-Source: AGHT+IFl7Piilz2pyXzE88qLlQFdDLmeriCh4llR30bZpwTqF8ELL9zjdchTsU//dsSr4Meglz4Y X-Received: by 2002:a05:6808:2020:b0:3c9:3d98:8098 with SMTP id 5614622812f47-3d1e35b9118mr4312929b6e.45.1717213440121; Fri, 31 May 2024 20:44:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717213440; cv=pass; d=google.com; s=arc-20160816; b=ejPEH0Nr0T+IZa+IXP8Ysqyc5w4Qd5RVWAX5si/mLxG+8CuvfshokiyZx0P4pMAJoc IJfqiV8cxxJMfynFt9MEDiNzWUSEZkr28bbjk25Soxbdj0bXTIILJKGQqvj69cMJpwaA UfubYfUYfr+OhXa7q27RqG2c0qHQ2rGpNE9I7E9B31K4aiMED3wYkB29I/jog7fTiH33 Bs/zZd/dUr45Nsbmd9LgjuVCgFUO14Ue4EgXpWAcmFRrVjEMD5T0arEj82uSJXWXNNC5 YdaiUk2maBZM4etfAHxr4QhkON3gE3eqJpzhYmBfx5YJBuJMYjmZDV3286DtQPKErEny MaOg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=Mxy12i2OvKVQZjvvhwigKPP0pYuf8LD5YVkmuPHrC94=; fh=/gW0yUFnRcFNkSCPxz8UjBHCGPgiCEguRpLIibqIEzc=; b=lF3DFVLKhNNkP6JtkBrXWmDFCtYt+Uhn7928DGuq4VLI0vf9gQ2HDsSPy2g+LrDA/E 848aDvX+jxkeuqmv2Ok3iy1tBG1RWg3JA5IQfaGkfa4m+vKYrFQ7Vrrvka2KkMi6cpHK 0QKYkYWAOUj5vnacKVNPRq2/ChX7QeYLnL5nSWN5AAZUTdVC+IoQg8qxFIaGw1G613Jq J5Dm1gKGyt+xbh1of4abYEj0kGsBNY8Jvr2c5kUpbjNMO1gvED9EEfaSeqhCe5+2o8Pv YuxoGl1Hl1Uxp9WYiFocsdpdR1OZX6hSnLoCAs8MEaFqzKBhpQ08hsxck8pHatPOP4h+ Cn0g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-ext4+bounces-2734-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-ext4+bounces-2734-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6ae4b42b980si36826036d6.511.2024.05.31.20.43.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 20:44:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4+bounces-2734-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-ext4+bounces-2734-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-ext4+bounces-2734-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D69B91C228E3 for ; Sat, 1 Jun 2024 03:43:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CBFB32943F; Sat, 1 Jun 2024 03:42:06 +0000 (UTC) X-Original-To: linux-ext4@vger.kernel.org Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC7FB101CA; Sat, 1 Jun 2024 03:42:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717213326; cv=none; b=CPSMZY9Vjul8bTobuYYe6B8KMH91hiUArpTZHyvXG1yvEswXPR4YAuncEZFDMrTrGhbR59EgFOHye55ARaiL+Txys918x0ZSDMypzfoG0Gl/3hjOmN7+KsKkmzzfnVc5+LaO3eXLmhLBi1wmy4yx+glO3pS/FfHppJWUl+P51bs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717213326; c=relaxed/simple; bh=r/Q8Q+Y1qlOGOZSAInCLXijzotPxo89lZP1qo/yLn6E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=u424Rk0LTLxYGfxvAluVMk7ucYRXXLGDbhg2QHYoHcu8nyCNUDR91CjP8fpmDYOu4VOmnWv5H526UD9FQNcCCLJE/pw589Cw7TwakEBVJijJyfGjW3x9Hzj/QIqyuAhJBKq234VuaiU59AHF061DrwMldeWoQWqyMhNz94X4et8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.235]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4Vrm4s6hvrz4f3jkJ; Sat, 1 Jun 2024 11:41:49 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 1A0DD1A0A9F; Sat, 1 Jun 2024 11:41:56 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgAX6RFumFpmHN_4OA--.4543S12; Sat, 01 Jun 2024 11:41:55 +0800 (CST) From: Zhang Yi To: linux-ext4@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz, ritesh.list@gmail.com, yi.zhang@huawei.com, yi.zhang@huaweicloud.com, chengzhihao1@huawei.com, yukuai3@huawei.com Subject: [PATCH 08/10] ext4: use ext4_map_query_blocks() in ext4_map_blocks() Date: Sat, 1 Jun 2024 11:41:47 +0800 Message-Id: <20240601034149.2169771-9-yi.zhang@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240601034149.2169771-1-yi.zhang@huaweicloud.com> References: <20240601034149.2169771-1-yi.zhang@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:cCh0CgAX6RFumFpmHN_4OA--.4543S12 X-Coremail-Antispam: 1UD129KBjvJXoW7WF18Wry7Wry3Jr1kuF43GFg_yoW8GrW5pr 9xAryfGrWUWw1q9a1xKr48ZryxK3WUKrWqq3yxGr1rZ345Crn3tF45tFyfAFZ8KrZ7Xw4Y qFWrGry8C3yrGrJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUPF14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JF0E3s1l82xGYI kIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2 z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F 4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq 3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7 IYx2IY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4U M4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2 kIc2xKxwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E 14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIx kGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUCVW8JwCI42IY6xIIjxv20xvEc7CjxVAF wI0_Cr0_Gr1UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJV W8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjfUF18B UUUUU X-CM-SenderInfo: d1lo6xhdqjqx5xdzvxpfor3voofrz/ From: Zhang Yi The blocks map querying logic in ext4_map_blocks() are the same as ext4_map_query_blocks(), so switch to directly use it. Signed-off-by: Zhang Yi --- fs/ext4/inode.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 0dde2bf078ba..46e151f26655 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -658,27 +658,7 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, * file system block. */ down_read(&EXT4_I(inode)->i_data_sem); - if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) { - retval = ext4_ext_map_blocks(handle, inode, map, 0); - } else { - retval = ext4_ind_map_blocks(handle, inode, map, 0); - } - if (retval > 0) { - unsigned int status; - - if (unlikely(retval != map->m_len)) { - ext4_warning(inode->i_sb, - "ES len assertion failed for inode " - "%lu: retval %d != map->m_len %d", - inode->i_ino, retval, map->m_len); - WARN_ON(1); - } - - status = map->m_flags & EXT4_MAP_UNWRITTEN ? - EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; - ext4_es_insert_extent(inode, map->m_lblk, map->m_len, - map->m_pblk, status); - } + retval = ext4_map_query_blocks(handle, inode, map); up_read((&EXT4_I(inode)->i_data_sem)); found: -- 2.31.1