Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp184834lqj; Wed, 10 Apr 2024 07:41:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX+hHrgUfg77Vhdp9pJYqUkE+Brhi+SaAxBW0E77QUOyf3qP2vhsBMB5FlxFq5EvBXC8Fz5tScjIXbRCQiP1qfhQM/VE384PxmAFLDXCw== X-Google-Smtp-Source: AGHT+IH0Oia4SdvbtUQ5mUOFpH5MieycwBFRmV0vqImTQWmG/iwG4LSyeO41IIQtW6MWeDEqrgDR X-Received: by 2002:a05:6a20:c89c:b0:1a9:5c24:e710 with SMTP id hb28-20020a056a20c89c00b001a95c24e710mr2038589pzb.20.1712760115183; Wed, 10 Apr 2024 07:41:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712760115; cv=pass; d=google.com; s=arc-20160816; b=KYdf5MmwxVkkyWBb64SHT60zgMj3iVXPIHLUxOru2TjcsSH5ZsNg3ZQH+XI5NESir0 GgDCzhuY6Mto2t2IPt/evx+oZUYrGjSubCnCWnlsj1nYOOZnB0PhL/RVY8xlGMQXjOFZ RMFWLLPLbItdwSSw3N5DRwlNwM/+T/aC3v6D+aM/kQ0OB0NR40qCK6fRKLcjFkPpESRs 0NC0efl5SXJAEJ3i6C1OuMpLOtzEAVeIkm2reEkUxdiFWERLZkPCSufxlOwc/39k+m+H 4wf1ro4lB8Uj24gWtmFuu5Jc84yG401eRKhxp8TNjhDG6ZtALd9I543uNLDmMxCwih12 3TKA== 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=c4+6cURURx8jSa0D0D5ClQ4p+d2eJgRX+D3rNfqwvMk=; fh=VCdyVZCUh9R8dltaA9/RWs/hxQzWhc63WX0fta2PQtE=; b=1Dxv0GFzfZb/WhNOL/zGdwatC84dOIs+nHyvI3PuVoUHIlZT/6D5RLwj6UV5i6lhCm ql4Rouc0SGYD8SYdntNgHaIRB87Rikx2At0SiLKDXvrG4QiZ0C61AlcoN6cV6awOEwrG g95T2/t1aBf1iqkvUOB0HJ7cA5RIcCCRq9ZjAkupbWY9ThhLty4o6xaT8HUUAMXki161 UxMKlqXf95EE9DzZVzYH4MAurC3je1icQaac//pusVmXiWnhvgfRkncn0l6NGV0Wm/1u 5Q17A8PDF0QTJ4CI7IC+M7nAMGk4XM4FWStqcNpmkrm/lofhP76eNyTv46iZnVpO7Fhk 0NFA==; 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-1976-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-1976-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 j1-20020a056a00130100b006ed008652b5si10876574pfu.103.2024.04.10.07.41.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 07:41:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4+bounces-1976-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-ext4+bounces-1976-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-1976-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 CC425284F81 for ; Wed, 10 Apr 2024 14:41:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 893D2176FDE; Wed, 10 Apr 2024 14:38:35 +0000 (UTC) X-Original-To: linux-ext4@vger.kernel.org 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 ABA0615FD03; Wed, 10 Apr 2024 14:38:31 +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=1712759915; cv=none; b=VWYjala3+CKVcuJS1FwMA6WHZefws8I5PcUMWyBTcNstoj7l2KdTq7TzlpVgMx4QcJZWSVvjQF0sHs55/vf4RCKEsoTdaEPBblaz3ZQ8VKeZC8B2pU1oosXIZ276jqkoF/+/BCe/2l0/bOAeyFbx7pRk0y6iPWblsQEWl+Xprw0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712759915; c=relaxed/simple; bh=bufxHOVc0PpM9V2w/cjt4ES+5o3E5VFV22cph4TnOxM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=I0f4G6OrJMpP4F0eAAzC/YrlNBPcWHtN2Ht5OQULLDAyDxthJVesUh/04AqcXmEko7lGmkkLBqJh+4XOO7/gj4Sf37cqYYMNdko5LOQueoJP3AlmTt16zczZ1GA/y//CJ+0Vkb7uApmoDVH+3v+X2OyENFcb4WJ+VzRBekTNn/A= 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.216]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4VF56R6wVrz4f3k6H; Wed, 10 Apr 2024 22:38:23 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 616E01A0C6A; Wed, 10 Apr 2024 22:38:28 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgAX6RFSpBZmcwR8Jg--.63000S8; Wed, 10 Apr 2024 22:38:28 +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: [PATCH v4 04/34] ext4: drop iblock parameter Date: Wed, 10 Apr 2024 22:29:18 +0800 Message-Id: <20240410142948.2817554-5-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-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:cCh0CgAX6RFSpBZmcwR8Jg--.63000S8 X-Coremail-Antispam: 1UD129KBjvJXoWxJFy7ZFy7XrW5Jr1rCFW3Wrg_yoW5Gr47p3 93AF1rGr1fuw109a1xtF17ZF1Sga1UtrW7J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2KfnxnUUI43ZEXa7sRibyCP UUUUU== X-CM-SenderInfo: d1lo6xhdqjqx5xdzvxpfor3voofrz/ 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; -- 2.39.2