Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp187596lqj; Wed, 10 Apr 2024 07:46:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUa6YVbzCOluD/sOgCWXsgUomtkIDejlGK54k2+hLG6jfLxhuauoMwEglaNQMAaHvsoFe1obCvmRZIaDa5DD4cAuGwfVyyBK72M4/IMvA== X-Google-Smtp-Source: AGHT+IES2t/Fd7nQ6c4iU0txAkllW8h9AkZ7O1mILcTlnkWdNEAvIxDsFs4VGDlAAfDhOm3xUbat X-Received: by 2002:a50:8e19:0:b0:56e:57f9:8c83 with SMTP id 25-20020a508e19000000b0056e57f98c83mr2571148edw.19.1712760386349; Wed, 10 Apr 2024 07:46:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712760386; cv=pass; d=google.com; s=arc-20160816; b=02ikL7Suuqqv06gk+8SvvirEouQddkhHFkFrJ5YtAEDv9LbaJqALC/uix9yeXlITjp INv+L95ErMi5zYjrVJoYLt5cODBKbwELIbos70Yd0wXfsQLReRuHe391JIgq1mfpI1fl wpc9IVBi1iu5l1w38obywaXvNbCvvZvoufZvs7eHDDmNl+6F2awzfCAe1YxdPudhkqQz 9t7XYqUv/0/x2o3SlzBLCVA8Wc66d8e6RNAFPdoYAC8FyjZpvTsAnaUcJdYtlDIphT8t 67Di2wp9IHnXBNg0FpqWw3nX+5ywWRxW99aZCgp4yBz4MPw7x07PIbcVdknHh/EKbmWg gW6g== 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=VCdyVZCUh9R8dltaA9/RWs/hxQzWhc63WX0fta2PQtE=; b=PE3YvWO9EwSDMcCUw8oycW5Q4MUbLBCMAC/k4MPFigrerpoBU4woGXHhOyh+GqN07d Tz8MX+yi/1AvbA9H0BgTFacMEC6vRPyEzIXGe/QuYRshV5P7kEtYJanxI0NhZZNertgc FKxpX9nWaUFoyW0ld54Z4Qe8s6uWV41TEaAws3Bn7lAq8wl4b29atnsZIg58I7alxDz9 r25pR6OrBHJBcD4uZ8ceVcqOrvO3yJ388T3P931Nm0tDHppHn9PkqELEtybAFdsRuF6B /AEqvgAYSmdccaS3uMw8IuDHv1NixISSboUg/7UYrBCzZp1GwTSwXQia3wBj2mX2reo/ QwTw==; 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-138784-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138784-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id o29-20020a509b1d000000b0056b824b7474si6003325edi.646.2024.04.10.07.46.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 07:46:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-138784-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-138784-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138784-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 am.mirrors.kernel.org (Postfix) with ESMTPS id E04CF1F24FE1 for ; Wed, 10 Apr 2024 14:46:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CBF4B17F37F; Wed, 10 Apr 2024 14:38:43 +0000 (UTC) Received: from dggsgout12.his.huawei.com (unknown [45.249.212.56]) (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 8C45F17A918; Wed, 10 Apr 2024 14:38:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712759922; cv=none; b=SeojPbjbWn3BwIBrM02SB/uRggRV42Pg8rbmjER938yElYfzFyUSv8qBwJ9F19MABPfhTKbkrmFxs+DcLBquFBCq9aj6NhjaRdOa+ig3AQY6FviWAsuwYn99iU/nK+RT+2x637tRiIqAjNGzPFrDub8ZpIMufUPdin3Pjf4amW8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712759922; c=relaxed/simple; bh=l4Smv+z7qMZtCU29mA+UqY7QcHJzCduyerXiP0vHuLg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Xv2LlDhJxMVD7qhcUex5qBtWfhgyEcLFVAtgbFrkjE5rjDnuiFJmpOX2vy5Px2JboDaiAoK1f8Y8K03LXOW5n3ANtN3ZL5D2Cy2ocaftNv3YLMPdMr+oilsLLMFnmee4JUlIna8EdIgibtHIwsL9xjk6WHzt4Bjq74PXCm2ILHU= 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.56 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 dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4VF56Y6v6wz4f3knW; Wed, 10 Apr 2024 22:38:29 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id C78DF1A0568; Wed, 10 Apr 2024 22:38:36 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgAX6RFSpBZmcwR8Jg--.63000S21; Wed, 10 Apr 2024 22:38:36 +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, david@fromorbit.com, 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 22:29:31 +0800 Message-Id: <20240410142948.2817554-18-yi.zhang@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240410142948.2817554-1-yi.zhang@huaweicloud.com> References: <20240410142948.2817554-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:cCh0CgAX6RFSpBZmcwR8Jg--.63000S21 X-Coremail-Antispam: 1UD129KBjvJXoWxJryxuryUKF13tF13AFy8AFb_yoW8Gry3p3 sxAryfCw1UWr1q9a1xtr48Zry8K3WUKrWqqrWxGr1rA345Crn3tF45tFyfAFWDKrZ7Xw1Y qFWrKry8C3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dqjqx5xdzvxpfor3voofrz/ 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