From patchwork Wed Apr 10 14:29:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Yi X-Patchwork-Id: 13624710 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDA13CD11C2 for ; Wed, 10 Apr 2024 14:39:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5FE286B00A1; Wed, 10 Apr 2024 10:38:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5AA4D6B00A4; Wed, 10 Apr 2024 10:38:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3FD856B00A5; Wed, 10 Apr 2024 10:38:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 1C8F36B00A1 for ; Wed, 10 Apr 2024 10:38:43 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id DA333120815 for ; Wed, 10 Apr 2024 14:38:42 +0000 (UTC) X-FDA: 81993878484.25.3739CB8 Received: from dggsgout12.his.huawei.com (unknown [45.249.212.56]) by imf28.hostedemail.com (Postfix) with ESMTP id 7A811C0015 for ; Wed, 10 Apr 2024 14:38:40 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=none; spf=pass (imf28.hostedemail.com: domain of yi.zhang@huaweicloud.com designates 45.249.212.56 as permitted sender) smtp.mailfrom=yi.zhang@huaweicloud.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712759921; a=rsa-sha256; cv=none; b=Da6SNr6HRYtKfCljYPlNQlhFx4HqI1OZ1YdYqtkByz6eU1rKN+OO6jQO1v3NOrFwMGtgDe enN727Win+vkH8hrbNEjkOD2Ynq9CoJ5AFspFxoHAzot/ERDCBBl2cbcfPPyYrVUm8AUSd J/A0Nqv/bGD2/ThKiSINzfIGtsAsiVk= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=none; spf=pass (imf28.hostedemail.com: domain of yi.zhang@huaweicloud.com designates 45.249.212.56 as permitted sender) smtp.mailfrom=yi.zhang@huaweicloud.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712759921; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DHxnVt2eCkNob2fbYWCpZnvTmN8bZoEP4xQkUMxT9ko=; b=Kte6NfGnBmXj1kdYQJsiDW9dWDReJKs4b9bgRlffLJ6ViVWjuenL3LoAcapFyAArXE8Qmv dWv332KIk96xRJ0/DGfAFmEysG9XnweY/0BlRGAF6naB/quokTCEN2XkRslKyOfYqgXxiZ /Ewkl6RTseHscmXQVVOfHmBu6Cjha+s= Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4VF56Y6RGrz4f3knS for ; 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 B92D51A016E for ; 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> MIME-Version: 1.0 X-CM-TRANSID: cCh0CgAX6RFSpBZmcwR8Jg--.63000S21 X-Coremail-Antispam: 1UD129KBjvJXoWxJryxuryUKF13tF13AFy8AFb_yoW8Gry3p3 sxAryfCw1UWr1q9a1xtr48Zry8K3WUKrWqqrWxGr1rA345Crn3tF45tFyfAFWDKrZ7Xw1Y qFWrKry8C3yrGrDanT9S1TB71UUUUUJqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUHa14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JF0E3s1l82xGYI kIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2 z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F 4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq 3wAaw2AFwI0_Jrv_JF1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I 8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jrv_JF1lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCF s4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lFI xGxcIEc7CjxVA2Y2ka0xkIwI1lc7CjxVAaw2AFwI0_GFv_Wryl42xK82IYc2Ij64vIr41l 4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1l4IxYO2xFxVAFwI0_Jrv_JF1lx2IqxVAqx4xG67AKxV WUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r4a6rW5MIIYrxkI 7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_tr0E3s1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r 4UJVWxJr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r4UJVWx Jr1lIxAIcVC2z280aVCY1x0267AKxVW0oVCq3bIYCTnIWIevJa73UjIFyTuYvjTRtOzsDU UUU X-CM-SenderInfo: d1lo6xhdqjqx5xdzvxpfor3voofrz/ X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 7A811C0015 X-Stat-Signature: 616fzwicwu8keg4i6hg61h69hb3g698e X-HE-Tag: 1712759920-351980 X-HE-Meta: U2FsdGVkX18MQdAX+6J1lpVNhqc3k8UdKmXszNg4rhtQK4ShV3wLHzlO9Exh9OagolaZOKF4wfXEyXEAcri2Sy74quPHR0zUU7I8LjCYa2bIlJuDgFKqZVazCvxM4XezVWwETQf8AnEzGhV/MwUrWTf0tYD2XJZZ5RI3par8UNeInMAWqjRtXfORaBoR1aMkuEqos+gZCv+gPzLeon4ccIg1nsxlsdZ49H6oDrj9pKHElLjxMysgTTfnA8x9oSC3uK+Mf68IMDWoRI1yRtKeRdPuQMXqFc4h39HQA5/fODdOullxIlgfKc6+/zQSkW97zS81HK+6Ij17/9sxFfkRdMSzgmOUEEmdVLN8v9ClzISSDe91//z40ivb78n2Rnt5F/SP/SiqAMd1DnALYtfn7e6EOrfT8iR9kiExBjsJdXlHsuK14K+rl7waZapYGo+OJQ6YJ/FE0tW16H32vF+RdQH4VmgiUJnvyhFEmt0N7wFBuOuLB5LJ3yW6Q2Tvl5decAVUX0Uf4CGyMNHRtZR7SP1P9FxyfL3aEpBvlBVQe5Us0YVaUB6tswyEu7NnwSgJWqNcWMHHC4ZNfL2AXBTupmr+H9THGqCTOQ5Y4wZh9H/LKfY+RrXzlW7VO2XYb/m9dt+DbKv4JYFNu7TXAyiLanHaxB/gnKLRBRQaq4wt5I/8EPaJ18APRY3fg5xLqqOfGvoUktHSoMeoq7EXD5KtBOXy7nBTKD69M7QqFiURojYlVMnG+qGhIOKEr9T2Y+uyp+rRQ/4C1O8kL+FX8srgtQjsnNyPr3jWLcJJwk4W1hGeAlLP5L/89YMP33geFvMrsfqzXag2IX/Razyy8EMzyLmPjnRUH2UDrLkvQvdPO0NgdsXdUxqHWVt8ClhV9YVhJyHrVGGOu3Plz8CySKEVSEXJjAtdHElt6z0Z7HkegHB7DL21p5G7rEOhufGKoDjBh8+CA7cLQEXusDelx1V 6hnuOchE XFAaiLKaS4PzD3zEKIE3ysnDz34d8BIpm3us5aL0etaysVIYT7fjJH9Dr7OtNAFG/96Aguzdf+DwtkHb+/vmMfx8LvTI5/fI+QY1lx8TiEZX6gw2gUiVMc+ChjchajQklnEDJlkBGhFJ8puogrVCib4A/6fN0sR1BWCLbU/p0WjqDfVpqzcg5p5FiG6x6So0HY0pVTYJbAWydpJ8kQrTi2XePChwzqr6mDvVeqPslAzFnfYq+oY7jX+Wz+eWsue5cMmJVhrezqV1uWpfkhISmvtTz4X+7EfM/jwnyE+Rx4LoA5aI= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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: