Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp145227lqj; Wed, 10 Apr 2024 06:42:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVxhaWWyXSqgNBYmRgJRW3ZWIeq9FHM85nBEsOFkHwpMn70sofdFIn51oAaM9fwkys3qfPmWPe9ofKSZOfPb2WcojEfiJmhE2hWrnZmRg== X-Google-Smtp-Source: AGHT+IFYjRkL/XenjKVhebMI+MK4rxeswOY2apf9HzdYWF3sUNMUWr29xlfEBUInxvCyyzzc63fV X-Received: by 2002:a05:6300:808a:b0:1a7:a9ab:a733 with SMTP id ap10-20020a056300808a00b001a7a9aba733mr2709036pzc.4.1712756543120; Wed, 10 Apr 2024 06:42:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712756543; cv=pass; d=google.com; s=arc-20160816; b=Q6zkewhSYX4v+d9bk/S0ucEtAzA1LbJ3IPCu9O/pGtoP1nM/EjvbtkaEHidSOsyRTs +czTlm9VDfbMs34ZwIGuLBanrJZbGT5M48VjYz/Nsvm1uACf3QqemOjum4dGJrWclB9F h1f9BeJPinsvrKxY6WGOSzV5VVrAj3OF3CJlGWLMSpVbvp8rEMkAUCnxbIjXwVLAFdJR IqRW9AcVAQw/O8GeNNmDx2CpInCHT8s/QcSurRGY7iOeHbvvAGdfu9RiLVX963newWyf X6RLzMJjLwvNxZwC6IFJgtcZ5vuhd0kBEV+uq1FTgQFeeJAamI6eYykpjhpwkt0RKmvX keVQ== 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=DHxnVt2eCkNob2fbYWCpZnvTmN8bZoEP4xQkUMxT9ko=; fh=UhGiR19HeAIu8tzXykjZgtAKLLMPZj8YX6gPScUOsdE=; b=aN603Qs5G1THJgD9t4EN9rVGnqjmH/MhMZ4hIzyDECV7QT8oq+xDBYR8ianhW7aKuh WUhvZL3OXwtTF2OW2EtxsEh02dZZTAzFsNv2A4ylP6pt6s3rdMjAyjJ4aplu1fZKz6IE Cug7pX8RGkP5/HsVuM1o4ia92xYUXGHz8K97czg4XIpnEvAFMDn+RBdlHNlSlQNxH1DI QMRRgtDZO4LTFV2GYv8XSJ5ttMc8vU5DvYYotyNSzE+1NvN322gIEsXSn3HibU2M399I HqsoUzHY9HJ2CPDA14CSQpUpmPCZtLWd5Wnw067KhK/zMA+JimbdTMHK9WMBSUMA/9CJ G/IQ==; 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-kernel+bounces-138623-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138623-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id f18-20020a637552000000b005cdc5c9d6a2si10976583pgn.576.2024.04.10.06.42.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 06:42:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-138623-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-138623-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138623-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id E2713289FA1 for ; Wed, 10 Apr 2024 13:40:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 59F7C16F90A; Wed, 10 Apr 2024 13:37:04 +0000 (UTC) Received: from dggsgout11.his.huawei.com (unknown [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 C3AEA16E86F; Wed, 10 Apr 2024 13:37:01 +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=1712756223; cv=none; b=UYm8Z5czR7W8sODJN2WRrNOnzroknz1/VUShRpn+FL9QtngydLVjQcJdoYH4P7YmNTzAvMEtGNQFq0AyBqMQEYMWtkR2GQCKmdeG7m1r+dlTW6E8hWiv74QcwWEEo83IRJDDDUrIkfpYOEdrNoqrawhzsc4lRhODJ54f8/Wn8Ws= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712756223; c=relaxed/simple; bh=l4Smv+z7qMZtCU29mA+UqY7QcHJzCduyerXiP0vHuLg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MY2maUXSZL/qHnJA85LXU/8hgcMLoZQbdHnbGBkXEnIN2dF8savq663iV+ugAorbWlWLpuycN6tMItbuBjINmoC5NekM4+JP8YsPhPCT5qLKLwkPl4brdHEzYkgb0BzFHhavDGLNiaFInu6nASi8W6/0It1I7mvtpFPYRiwVrzU= 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.93.142]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4VF3lV0lwkz4f3jpq; Wed, 10 Apr 2024 21:36:54 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 7FB551A0179; Wed, 10 Apr 2024 21:36:58 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgAn+RHolRZmeCl4Jg--.8806S21; Wed, 10 Apr 2024 21:36:58 +0800 (CST) From: Zhang Yi To: linux-ext4@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz, ritesh.list@gmail.com, hch@infradead.org, djwong@kernel.org, willy@infradead.org, zokeefe@google.com, yi.zhang@huawei.com, yi.zhang@huaweicloud.com, chengzhihao1@huawei.com, yukuai3@huawei.com, wangkefeng.wang@huawei.com Subject: [RFC PATCH v4 17/34] ext4: use ext4_map_query_blocks() in ext4_map_blocks() Date: Wed, 10 Apr 2024 21:28:01 +0800 Message-Id: <20240410132818.2812377-18-yi.zhang@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240410132818.2812377-1-yi.zhang@huaweicloud.com> References: <20240410132818.2812377-1-yi.zhang@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:cCh0CgAn+RHolRZmeCl4Jg--.8806S21 X-Coremail-Antispam: 1UD129KBjvJXoWxJryxuryUKF13tF13AFy8AFb_yoW8Gry3p3 sxAryfCw1UWr1q9a1xtr48Zry8K3WUKrWqqrWxGr1rA345Crn3tF45tFyfAFWDKrZ7Xw1Y qFWrKry8C3yrGrDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUPI14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JF0E3s1l82xGYI kIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2 z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F 4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq 3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7 IYx2IY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4U M4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2 kIc2xKxwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E 14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_GFv_WrylIx kGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVW8JVW5JwCI42IY6xIIjxv20xvEc7CjxVAF wI0_Gr1j6F4UJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Gr 0_Cr1lIxAIcVC2z280aVCY1x0267AKxVW8Jr0_Cr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUA rcfUUUUU= X-CM-SenderInfo: d1lo6xhdqjqx5xdzvxpfor3voofrz/ From: Zhang Yi The blocks map querying logic in ext4_map_blocks() are the same with ext4_map_query_blocks(), so use it directly. 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 752fc0555dc0..64bdfa9e06b2 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.39.2