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 C936EC678D4 for ; Thu, 2 Mar 2023 23:31:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229862AbjCBXbC (ORCPT ); Thu, 2 Mar 2023 18:31:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229933AbjCBXbA (ORCPT ); Thu, 2 Mar 2023 18:31:00 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C16B028845 for ; Thu, 2 Mar 2023 15:30:57 -0800 (PST) Received: from [0.0.0.0] ([149.28.201.231]) by mail.gmx.net (mrgmx105 [212.227.17.174]) with ESMTPSA (Nemesis) id 1Mo6qp-1qMqJu1hwB-00pcXd; Fri, 03 Mar 2023 00:30:50 +0100 Message-ID: Date: Fri, 3 Mar 2023 07:30:45 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.0 Subject: Re: [PATCH 07/10] btrfs: simplify finding the inode in submit_one_bio Content-Language: en-US To: Christoph Hellwig , Chris Mason , Josef Bacik , David Sterba Cc: linux-btrfs@vger.kernel.org References: <20230301134244.1378533-1-hch@lst.de> <20230301134244.1378533-8-hch@lst.de> From: Qu Wenruo In-Reply-To: <20230301134244.1378533-8-hch@lst.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:9ekR2U1KDvXm8WK4yRrzPtaBkWKsD1B0PeL9mPRuxZXcPuG6xZH PWjcYpJj71vhzmhmF+uCoXqhKprNhgWZsYspZkoDRd+APDO28Kn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PaCDI9L3TQ9cJ0yt9HLtUgl3k0siRYBy5n35aoTPkiXVynXwIuBzulZ+ aEPaV/3R9wavuRLacgxhleXSOxI= Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On 2023/3/1 21:42, Christoph Hellwig wrote: > struct btrfs_bio now has an always valid inode pointer that can be used > to find the inode in submit_one_bio, so use that and initialize all > variables for which it is possible at declaration time. > > Signed-off-by: Christoph Hellwig Reviewed-by: Qu Wenruo Initially I want to recommend to also make bio_ctrl->bio to be btrfs_bio, but that would be done in the next patch already. Thanks, Qu > --- > fs/btrfs/extent_io.c | 15 ++++----------- > 1 file changed, 4 insertions(+), 11 deletions(-) > > diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c > index 6ea6f2c057ac3e..05b96a77fba104 100644 > --- a/fs/btrfs/extent_io.c > +++ b/fs/btrfs/extent_io.c > @@ -123,23 +123,16 @@ struct btrfs_bio_ctrl { > > static void submit_one_bio(struct btrfs_bio_ctrl *bio_ctrl) > { > - struct bio *bio; > - struct bio_vec *bv; > - struct inode *inode; > - int mirror_num; > + struct bio *bio = bio_ctrl->bio; > + int mirror_num = bio_ctrl->mirror_num; > > - if (!bio_ctrl->bio) > + if (!bio) > return; > > - bio = bio_ctrl->bio; > - bv = bio_first_bvec_all(bio); > - inode = bv->bv_page->mapping->host; > - mirror_num = bio_ctrl->mirror_num; > - > /* Caller should ensure the bio has at least some range added */ > ASSERT(bio->bi_iter.bi_size); > > - if (!is_data_inode(inode)) { > + if (!is_data_inode(&btrfs_bio(bio)->inode->vfs_inode)) { > if (btrfs_op(bio) != BTRFS_MAP_WRITE) { > /* > * For metadata read, we should have the parent_check,