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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2755FC6FD1F for ; Sat, 25 Mar 2023 08:48:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231740AbjCYIsz (ORCPT ); Sat, 25 Mar 2023 04:48:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230399AbjCYIsx (ORCPT ); Sat, 25 Mar 2023 04:48:53 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0260AF31 for ; Sat, 25 Mar 2023 01:48:52 -0700 (PDT) Received: from [0.0.0.0] ([149.28.201.231]) by mail.gmx.net (mrgmx105 [212.227.17.174]) with ESMTPSA (Nemesis) id 1M2f5T-1pcQGy0N2t-0049HP; Sat, 25 Mar 2023 09:48:43 +0100 Message-ID: <1698cfcc-8beb-7211-2e4f-2e8e5e363ece@gmx.com> Date: Sat, 25 Mar 2023 16:48:40 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Content-Language: en-US To: Christoph Hellwig Cc: Qu Wenruo , linux-btrfs@vger.kernel.org References: <0ee1de5c-9cb2-cecf-c4be-02cc16bd505c@gmx.com> <9581646d-380f-2b55-07ac-2abd37822577@gmx.com> From: Qu Wenruo Subject: Re: [PATCH v3 02/12] btrfs: introduce a new helper to submit bio for scrub In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:gf/4l096af04nsWmR1b3DaMR0D9hZ4rGZRbFo+bV9yDAEy3GiuB 9tCoMhKFMBNcEURD0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puxgp IkreTAqCHMFf+1f6uqLPCqAeLdDwbhvVpwugaf6Asghzkhz9I4cvVocqZatgAnDt77xLHJmyW IMkFoWCxt96avS9lMQw5ZkzoPkc= Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On 2023/3/25 16:31, Christoph Hellwig wrote: > On Sat, Mar 25, 2023 at 04:21:41PM +0800, Qu Wenruo wrote: >> No big deal, I can go with the extra fs_info parameter for btrfs_bio_init() >> and btrfs_bio_alloc(). > > I'd be tempted to just initialize it in the callers given that it's > an optional field now. I wonder if the same might also make sense > for ->file_offset. In that case, I'm not sure if adding more and more arguments while almost all of them can be optional is a good idea... Shouldn't we only pass mandatory arguments, then let the caller to populate the optional ones? Anyway, for scrub usage, fs_info can be initialized at the submission timing if neexed, thus I'm fine either way. > >> The main reason I go with the duplicated allocate is to remove the need for >> nr_vecs, but that's pretty minor, thus not a critical one. > > Passing nr_vecs might actually make sense. There is no need to always > allocated all of them for existing callers either, so we can do > additional optimizations based on that later. Or we can just go with the github version and refine later? Considering scrub would be the final major code migrating to use btrfs_bio, there shouldn't be any major use case change to btrfs_bio for a while. Thanks, Qu