From patchwork Wed Apr 10 13:27:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Yi X-Patchwork-Id: 13624543 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 DF048CD1299 for ; Wed, 10 Apr 2024 13:37:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4760D6B0099; Wed, 10 Apr 2024 09:37:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3D8966B009A; Wed, 10 Apr 2024 09:37:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 203C66B009B; Wed, 10 Apr 2024 09:37:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id E3D196B009A for ; Wed, 10 Apr 2024 09:36:59 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id A871D1C09ED for ; Wed, 10 Apr 2024 13:36:59 +0000 (UTC) X-FDA: 81993722958.16.F428D07 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by imf09.hostedemail.com (Postfix) with ESMTP id 4D02A140015 for ; Wed, 10 Apr 2024 13:36:56 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf09.hostedemail.com: domain of yi.zhang@huaweicloud.com designates 45.249.212.51 as permitted sender) smtp.mailfrom=yi.zhang@huaweicloud.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712756218; a=rsa-sha256; cv=none; b=7mCK5fnZxtOlqEwuUESy6JmM5vxlJRsbYDS/nkLWs8CrdQvjYxDuRMclig4GSyTRx+GEyQ 8yeK52leEQ9Sk2E4niRA4MJJ8bNowOqNsc5dcay/hToCVrR/XQg68oLAhaoxFxkIJqDwLC LxRSJhnyTBmn+1olz9gVWnCDVA4e9Uk= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf09.hostedemail.com: domain of yi.zhang@huaweicloud.com designates 45.249.212.51 as permitted sender) smtp.mailfrom=yi.zhang@huaweicloud.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712756218; 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=c4+6cURURx8jSa0D0D5ClQ4p+d2eJgRX+D3rNfqwvMk=; b=aSxO8Fiq++K91yeg7tgbOlTRVem3EJ6LRJsCaAp2MVnMjUCisi9tmjFWCB4H4viOmu82YC /DXBnb1ZcrSiQsfgHqK8nsA+IoI9yaq/o8m/ArSgW7depGG0hT0WZUahMUIweIoVlhIRVy QVPohidgNXArFGJmAyULt1f/tetip5k= Received: from mail.maildlp.com (unknown [172.19.163.235]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4VF3lF5Yt8z4f3mHG for ; Wed, 10 Apr 2024 21:36:41 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 6CB4B1A0572 for ; Wed, 10 Apr 2024 21:36:50 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgAn+RHolRZmeCl4Jg--.8806S8; Wed, 10 Apr 2024 21:36:50 +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: [PATCH v4 04/34] ext4: drop iblock parameter Date: Wed, 10 Apr 2024 21:27:48 +0800 Message-Id: <20240410132818.2812377-5-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> MIME-Version: 1.0 X-CM-TRANSID: cCh0CgAn+RHolRZmeCl4Jg--.8806S8 X-Coremail-Antispam: 1UD129KBjvJXoWxJFy7ZFy7XrW5Jr1rCFW3Wrg_yoW5Gr47p3 93AF1rGr1fuw109a1xtF17ZF1Sga1UtrW7Jryftr1Fkas5GF1ftF4DAF12yFy8trWfXFn0 qF4jqr1UCw4SyrDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUP214x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JF0E3s1l82xGYI kIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2 z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F 4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq 3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7 IYx2IY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4U M4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2 kIc2xKxwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E 14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_GFv_WrylIx kGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAF wI0_Cr0_Gr1UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVW8JV WxJwCI42IY6I8E87Iv6xkF7I0E14v26r4UJVWxJrUvcSsGvfC2KfnxnUUI43ZEXa7VU17G YJUUUUU== X-CM-SenderInfo: d1lo6xhdqjqx5xdzvxpfor3voofrz/ X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 4D02A140015 X-Stat-Signature: hmez3n71cbhgoz5uqjomwm99du5wyms7 X-Rspam-User: X-HE-Tag: 1712756216-556432 X-HE-Meta: U2FsdGVkX1+9W4rkIGP22RsL0qI1J4ne6W2P9gYlXDxxGcw0cgAilz5ECz0FZIDwae1TBGPVRPtMFFwY5quCeurzRbDDO/UlT3/TQ27iJr1dDIc6Kae05XypoT1k1oeBFgfW1odHBBHhigu9ePsUIDCHjQitR8syKX8mGK7dRSQ1uRLXZDXzjlDRb60/aO2i+lR3aFTikAVqrsom9whu0fgEQ0eEwl0oh8PcBoNo6pfTyzlHN39J2YrvioVghCxDoYiTSeJMY5H1bvtYvZNDo81LGVAxLicTEwcA98DZYA+ug3RuPGyenhiZ1DoGcAV+MMRulvVIWMj8GmLOIHuQOYUjZ/QuhchidWKIeAdw4dE6TFDIyTMKTYzfVMJk4zzmeukKcOPjkdvgU/fx3301+T3fBcBxFljEcWCVhH3CNsu98Qea7QHVrwGI1fj62z2vSnBKH5h2jJAUcfD7/k9W4hZYUELnravBCW81/GEZyW0xay+gxhRqNgr6sbemK7gTfjnHm9++kSliIGcQoxM6YgzWYhDwEAPQ+zxpQWfCbtK+qWoJZWIKLaRkeHy0e6rK1OVetDdG4B1XPevoXaIlkvsqShtZ1ealzcg4399AgjcjvSYsMFx7ELcxiS+dp1bWKswi+0RkVrQ3ZRpZzG+GFKiNUZqKMy8d8QVamht4ZsQIEl/VikCbcIypal1wPIZ9u1uF8y62brAV3J5wXzBnxq/kQH+YYmI1I4YaGkzjlzdMcUUm3rZc5/XEaxA3E50DHELb7XKUMYmXNEBd9qAtthMmEPDIa5sg6ehy6uhhMqoeFt/YTRBKbiN63jdbm4cfcMBqCOoMXVnXLuqjUASMpmH5Zu6z6wHP3Z/m37zGxl24iMZtqHoOJ6Q09BDRkUueVHq15SHGFEQY0SitpGPFUTf0WUDioxcGj664Uupt0VVQbTDKbJTcjCNkdyLkVI3K3+SCjiKfYZz1LbvFId+ EiNSOQwP keg12NMISP+BKamRvp1jmd3qT9YIkH5jqNmUbZu3Up1gpV7ChkA7hCYvTYFQ/3INZQNq889Dr9fNfYRsaeQYLwDxs2gUlCNfw4bDtDffSDqKEXVha8T3wPP4auifShS8DdGII9iCqS6GgQP0FZrsjZn7lllBnHKFU6zPRQNK93yHEN/KiNSKpXhvtUtKwWHtEH45GsY62xtFlU7M= 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 start block of the delalloc extent to be inserted is equal to map->m_lblk, just drop the duplicate iblock input parameter. Signed-off-by: Zhang Yi --- fs/ext4/inode.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index e4043ddb07a5..cccc16506f5f 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -1712,8 +1712,7 @@ static int ext4_insert_delayed_block(struct inode *inode, ext4_lblk_t lblk) * time. This function looks up the requested blocks and sets the * buffer delay bit under the protection of i_data_sem. */ -static int ext4_da_map_blocks(struct inode *inode, sector_t iblock, - struct ext4_map_blocks *map, +static int ext4_da_map_blocks(struct inode *inode, struct ext4_map_blocks *map, struct buffer_head *bh) { struct extent_status es; @@ -1733,8 +1732,8 @@ static int ext4_da_map_blocks(struct inode *inode, sector_t iblock, (unsigned long) map->m_lblk); /* Lookup extent status tree firstly */ - if (ext4_es_lookup_extent(inode, iblock, NULL, &es)) { - retval = es.es_len - (iblock - es.es_lblk); + if (ext4_es_lookup_extent(inode, map->m_lblk, NULL, &es)) { + retval = es.es_len - (map->m_lblk - es.es_lblk); if (retval > map->m_len) retval = map->m_len; map->m_len = retval; @@ -1754,7 +1753,7 @@ static int ext4_da_map_blocks(struct inode *inode, sector_t iblock, return 0; } - map->m_pblk = ext4_es_pblock(&es) + iblock - es.es_lblk; + map->m_pblk = ext4_es_pblock(&es) + map->m_lblk - es.es_lblk; if (ext4_es_is_written(&es)) map->m_flags |= EXT4_MAP_MAPPED; else if (ext4_es_is_unwritten(&es)) @@ -1788,8 +1787,8 @@ static int ext4_da_map_blocks(struct inode *inode, sector_t iblock, * inserting delalloc range haven't been delayed or allocated * whitout holding i_rwsem and folio lock. */ - if (ext4_es_lookup_extent(inode, iblock, NULL, &es)) { - retval = es.es_len - (iblock - es.es_lblk); + if (ext4_es_lookup_extent(inode, map->m_lblk, NULL, &es)) { + retval = es.es_len - (map->m_lblk - es.es_lblk); if (retval > map->m_len) retval = map->m_len; map->m_len = retval; @@ -1846,7 +1845,7 @@ int ext4_da_get_block_prep(struct inode *inode, sector_t iblock, * preallocated blocks are unmapped but should treated * the same as allocated blocks. */ - ret = ext4_da_map_blocks(inode, iblock, &map, bh); + ret = ext4_da_map_blocks(inode, &map, bh); if (ret <= 0) return ret;