Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1250726lqt; Tue, 19 Mar 2024 18:51:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXcU3Otc4Qm3CQYrYUL7lC4iwqgUkkvSjJf+CJkuTisOpFExWG5IeRsVZRHkM327YtdUzVFQ88pDTfFFmpvfqWeaOTAQ8VdAVZ+Df5A/Q== X-Google-Smtp-Source: AGHT+IEuBVlPeW0C5XPiEdH2Q9wOaoal0C85/I6kQQIkdwEGxQ2nXBai3cj8WoIZAQ9ruYpNSmac X-Received: by 2002:a05:6358:7607:b0:17b:57ee:7b7e with SMTP id r7-20020a056358760700b0017b57ee7b7emr4933062rwg.26.1710899512961; Tue, 19 Mar 2024 18:51:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710899512; cv=pass; d=google.com; s=arc-20160816; b=kJsxTAeGk7qg9uVGNHJSBThb4wcz2RwBqsmrO9VkgOVcZXlhrYpLog7MFtaEehe1II G6zQtFCkGUgHu0xlEDj17lUcDveubBEKfUEHWvfv2DylrJZZsBGXGdWePx9xuhYJRSDc NPZx4bMr6YrPV9YxBGWN/5ND8qoN2YKcqTekIVhj8voRWgw25KWkCwpBpOPBog1Axee4 +DrKXY4Y3CsoVDRu8nsaXaTp31JLzd6TbpHXYORBW73xrPhDXc5MMeR1L3EBLnF39222 LZU68B4PyELwZPfwDQq3fAu0Y+AIWQuBMBTSMlTu/owzib+EZUiMBYvCSJSxlr7VteS5 GV+g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:user-agent:date :message-id:from:references:cc:to:subject; bh=XjOaXUW3gpI7wl8WoW+gen1LAjBqZAUJjAeLmB55SGc=; fh=enOBmWqYwWeDkdGkVYDQ59ah45GpnNcnWILXA2av3vk=; b=Ihf+DDxsvHrA8g5bWRAWuMAb3E45P14VxklBlya2C1Ktkyy7lkZm5ETDocasTKtdpv J3NGqPw+Cxfbmu1ONi3wkQM6shjN/vJJe4RxlNIdqqVSOxg4m4hdPyNOYFH+evucth5k p6lj8vOiV002hGcMVilTrDS1qDGKeNkCGTMqdpIFhDJ9NLuaEuvw/3G7wYwi2pZq6Vrk C13GVFmoqpwErCXfDGlKxkzOKa47P+02Kn3bbbGFwh9eFSTHQvdGHYFvWlPWA9qE/A4a 9ZrAjYLLImBiQ7k2xDVR5tf3noglVzIjn4QERyd10phaC0QQ/ZnvKc8Rycnc+SScwtqv Zzuw==; 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-108330-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108330-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 187-20020a6301c4000000b005d692a181d9si11281389pgb.340.2024.03.19.18.51.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 18:51:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-108330-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; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-108330-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108330-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 7C3492840C1 for ; Wed, 20 Mar 2024 01:51:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AA19B8479; Wed, 20 Mar 2024 01:51:41 +0000 (UTC) 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 A091B6FC3; Wed, 20 Mar 2024 01:51:38 +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=1710899501; cv=none; b=BTm91Gy6zbImI1aA/pRPuxC7fG21ddEneuBZjMqPqAht9e8e4AUo67B9jPv3VC3Pvp2xhSqXL0hMssRbIyTe+BJ6O3Zlr0OK0lb9F3/n1wLkNN0jt7m6dLY9va+R0KhZXBxfuvV0UP2NzPy3VmUGQu8NcFiSmdiD9rS9o1AQfkA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710899501; c=relaxed/simple; bh=saxoGu9UZdW8TBh8QByEj0Of2/jE//AXv/FgCbPO3sI=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=IXXoahQAmVjfVbpAAJqJKHzsE5i4Ay39nhAQfZKcDOJ7rhyq2J4tONfNSaDMvbwUWMwwmjNdFLok5DpW3rJbi9FNt/YEfR6eN2AlPSFCCx6AMZO+sgZ9Wz56hHyZ7jfkCV+UjIOF9sta0/8qWMdSZgCigMod/cCm2gAFLz2EgXE= 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 4Tzs583xHVz4f3jZT; Wed, 20 Mar 2024 09:51:24 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 672681A0199; Wed, 20 Mar 2024 09:51:28 +0800 (CST) Received: from [10.174.176.34] (unknown [10.174.176.34]) by APP1 (Coremail) with SMTP id cCh0CgCXaBEeQfplZGn3HQ--.57221S3; Wed, 20 Mar 2024 09:51:28 +0800 (CST) Subject: Re: [PATCH v3 3/9] xfs: make xfs_bmapi_convert_delalloc() to allocate the target offset To: "Darrick J. Wong" , hch@infradead.org Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, brauner@kernel.org, david@fromorbit.com, tytso@mit.edu, jack@suse.cz, yi.zhang@huawei.com, chengzhihao1@huawei.com, yukuai3@huawei.com References: <20240319011102.2929635-1-yi.zhang@huaweicloud.com> <20240319011102.2929635-4-yi.zhang@huaweicloud.com> <20240319204552.GG1927156@frogsfrogsfrogs> From: Zhang Yi Message-ID: <054ac072-4ccf-b83c-cc9c-cbb5d6f5dbdb@huaweicloud.com> Date: Wed, 20 Mar 2024 09:51:26 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20240319204552.GG1927156@frogsfrogsfrogs> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CM-TRANSID:cCh0CgCXaBEeQfplZGn3HQ--.57221S3 X-Coremail-Antispam: 1UD129KBjvJXoW7CryftrW5trWUZFy8KrWkXrb_yoW8uFW8pF Z3KayS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> On Tue, Mar 19, 2024 at 09:10:56AM +0800, Zhang Yi wrote: >> From: Zhang Yi >> >> Since xfs_bmapi_convert_delalloc() only attempts to allocate the entire >> delalloc extent and require multiple invocations to allocate the target >> offset. So xfs_convert_blocks() add a loop to do this job and we call it >> in the write back path, but xfs_convert_blocks() isn't a common helper. >> Let's do it in xfs_bmapi_convert_delalloc() and drop >> xfs_convert_blocks(), preparing for the post EOF delalloc blocks >> converting in the buffered write begin path. >> >> Signed-off-by: Zhang Yi >> Reviewed-by: Christoph Hellwig >> --- >> fs/xfs/libxfs/xfs_bmap.c | 34 +++++++++++++++++++++++-- >> fs/xfs/xfs_aops.c | 54 +++++++++++----------------------------- >> 2 files changed, 46 insertions(+), 42 deletions(-) >> >> diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c >> index 07dc35de8ce5..042e8d3ab0ba 100644 >> --- a/fs/xfs/libxfs/xfs_bmap.c >> +++ b/fs/xfs/libxfs/xfs_bmap.c >> @@ -4516,8 +4516,8 @@ xfs_bmapi_write( >> * invocations to allocate the target offset if a large enough physical extent >> * is not available. >> */ >> -int >> -xfs_bmapi_convert_delalloc( >> +static int > > static inline? > I'd suggest to leave that to the compiler too. >> +__xfs_bmapi_convert_delalloc( > > Double underscore prefixes read to me like "do this without grabbing > a lock or a resource", not just one step in a loop. > > Would you mind changing it to xfs_bmapi_convert_one_delalloc() ? > Then the callsite looks like: > > xfs_bmapi_convert_delalloc(...) > { > ... > do { > error = xfs_bmapi_convert_one_delalloc(ip, whichfork, offset, > iomap, seq); > if (error) > return error; > } while (iomap->offset + iomap->length <= offset); > } > Thanks for your suggestions, all subsequent improvements in this series are also looks fine by me, I will revise them in my next iteration. Christoph, I will keep your review tag, please let me know if you have different opinion. Thanks, Yi.