Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1196447lqa; Mon, 29 Apr 2024 00:34:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXLYgcP+/jwFo37NWvHYkuEE5qhhJlyKvT7fs44+um+41FTt8s+6bMpI+7dVS/Wbib8I7T/GZP7M9pLYz0qkISs207Hd5jQyjq+UoVw5g== X-Google-Smtp-Source: AGHT+IGybMkKBmLKFnXwH94tgM+M6iQ7I9T6Db0YFNjBrH2U9mu33i2A1+9GeWf2lWRsg5b88Xre X-Received: by 2002:a17:90a:f197:b0:2aa:b377:d29e with SMTP id bv23-20020a17090af19700b002aab377d29emr8734092pjb.3.1714376088599; Mon, 29 Apr 2024 00:34:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714376088; cv=pass; d=google.com; s=arc-20160816; b=f1lVrazW4CMhQ8f451BQSFhCcOZG/YmtrX/W6N2GnZtfFouBnmj52IAgJ+miwF3LHj VwGylEeeK/c0BOaBjNr5gCbJ9gWGxci5dVQWvmvz0rii1rOcvf5YjN5fdgEF7hRJUHJX L4SA8BKQFx4QyLNxtSMTaQ49DkQPrHPKR6b10dQGnyaLsbgXiaVXV2yC9QFtCqYkZKOn Kb+kwJdMr3oGqjeNZC3RkaMYG5Zu1KserbySCd0FI8qVXAYiJGugyDd/crqZY2Oqh2qT mVOJV+x0/a7g4L6DrsfiYZIvudcOpWPFCFvHIG3epBTZgVSBnuMPKECnOmSIsNzWExX8 /0Qw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature:dkim-signature :dkim-signature; bh=bGx/ylCmVxhvoe50C+EZpKaNVRUM0HVbXzxEoJJkY/k=; fh=4ic0y0MxEOsaJpqJiMHFKH6Q5OqW2g5wq7NmfOUu7xY=; b=w4EoGoYkOi1IUMWoxO/Ayczgt8rLpyOI/Jy+IFTPu/sialUIMyw9oKNZ9zZqmoymwn 0cNzLcYHjLbLBf/7jmxcxLaOtbLdmQwRt3ew2tg5Ala9OLCfjp+3S/BtAzIP9RJ3DMnV f2fpQBJwNlFd1QX9HMLbbp23dgs3hbDFCkNnI7UBculcuMrvQGEQTMmHk+pm18FzXyKq ppGa1FXaEEBQ4LzM01en111u+nzGUz7CzWQE67zFnGqZFGuWQvBE40754icZXG4Xr4ss vZ075jIxhEWpSGCELeDw5YgY4g/MDYhNuijpfEqvGuwMaG6GetzAS4AYn5m2rhNKMUtk yDug==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=GZVlL78X; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=GZVlL78X; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-ext4+bounces-2225-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-ext4+bounces-2225-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id cb11-20020a056a02070b00b005fcac46da4csi16074234pgb.731.2024.04.29.00.34.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 00:34:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4+bounces-2225-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=GZVlL78X; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=GZVlL78X; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-ext4+bounces-2225-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-ext4+bounces-2225-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 3B04A281E12 for ; Mon, 29 Apr 2024 07:34:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A1CC014A8D; Mon, 29 Apr 2024 07:34:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="GZVlL78X"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="sq4E28UL"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="GZVlL78X"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="sq4E28UL" X-Original-To: linux-ext4@vger.kernel.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D3E912E70; Mon, 29 Apr 2024 07:34:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714376081; cv=none; b=j2y5bP8rxrIxBx25J1hJ5hcQ2vcL5zzoCXiFIhYLzc0nXIVWGBaTeGVUO4IAbdGIHtpt/aIw2Hx4JRZCFyebi2N0REcJe30r80Wc9e0Ei6/E3J0f0oj0fst6OHhk9GhsOtcReUnX5erFXugcYDMpzB47+jtvKnA4sfm7+fsPAk0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714376081; c=relaxed/simple; bh=2xCgxt+SsLDnRwXH2d+bCIfyo4DmN2AZ9VLWDQ5Ic7I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=EDFGSHc7kFxlMT4kl7zUeGvqRcB7sJOBF19m6JvgFXrmnV2lBCVXnMCndsNTGOnJ1y22lsLDYDsS7L6u94PIdfMzMc6svWuArls6+BkX7d4oqWUJqxyUvcM9vI5/Bsa3MEBtVIwpkO/Q+oGmH1MXSJXitWvn/ygqieKAJ2dx9fQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=GZVlL78X; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=sq4E28UL; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=GZVlL78X; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=sq4E28UL; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 644E822A8F; Mon, 29 Apr 2024 07:34:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1714376077; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=bGx/ylCmVxhvoe50C+EZpKaNVRUM0HVbXzxEoJJkY/k=; b=GZVlL78Xt+BeDNkLAVVOC8RhHEvhk1qO1G1oXQGdntqVFMItYNhmIhh2guQbyQrNqfnQcE RtC3hENZo3IJRVLGF7E18mOEdCabXMA/45qltCVdDXuU1nKgz+K4benCe6C7O8Zkdijtsr QTMqpbjCelPswhj+BGONSQ8QaW4T1ZQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1714376077; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=bGx/ylCmVxhvoe50C+EZpKaNVRUM0HVbXzxEoJJkY/k=; b=sq4E28UL7Y7sGANwRY92lgR4uaJizGrPQuSxMN08XATOb2MPvr84XjKINcAswdZTdHyuDd jn4Nzukh+Fb7joDg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=GZVlL78X; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=sq4E28UL DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1714376077; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=bGx/ylCmVxhvoe50C+EZpKaNVRUM0HVbXzxEoJJkY/k=; b=GZVlL78Xt+BeDNkLAVVOC8RhHEvhk1qO1G1oXQGdntqVFMItYNhmIhh2guQbyQrNqfnQcE RtC3hENZo3IJRVLGF7E18mOEdCabXMA/45qltCVdDXuU1nKgz+K4benCe6C7O8Zkdijtsr QTMqpbjCelPswhj+BGONSQ8QaW4T1ZQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1714376077; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=bGx/ylCmVxhvoe50C+EZpKaNVRUM0HVbXzxEoJJkY/k=; b=sq4E28UL7Y7sGANwRY92lgR4uaJizGrPQuSxMN08XATOb2MPvr84XjKINcAswdZTdHyuDd jn4Nzukh+Fb7joDg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 563C1139DE; Mon, 29 Apr 2024 07:34:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id LMyzFI1NL2YSeAAAD6G6ig (envelope-from ); Mon, 29 Apr 2024 07:34:37 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id F2B46A082F; Mon, 29 Apr 2024 09:34:32 +0200 (CEST) Date: Mon, 29 Apr 2024 09:34:32 +0200 From: Jan Kara To: Zhang Yi Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz, yi.zhang@huawei.com, chengzhihao1@huawei.com, yukuai3@huawei.com Subject: Re: [PATCH v2 4/9] ext4: drop iblock parameter Message-ID: <20240429073432.lvv4fll7gmeupxm6@quack3> References: <20240410034203.2188357-1-yi.zhang@huaweicloud.com> <20240410034203.2188357-5-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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240410034203.2188357-5-yi.zhang@huaweicloud.com> X-Spam-Level: X-Spamd-Result: default: False [-4.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_RHS_NOT_FQDN(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MISSING_XM_UA(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,huawei.com:email]; RCVD_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_SEVEN(0.00)[9]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; RCVD_TLS_LAST(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DKIM_TRACE(0.00)[suse.cz:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: 644E822A8F X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Flag: NO X-Spam-Score: -4.01 On Wed 10-04-24 11:41:58, Zhang Yi wrote: > 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 Looks good. Feel free to add: Reviewed-by: Jan Kara Honza > --- > 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 > -- Jan Kara SUSE Labs, CR