From mboxrd@z Thu Jan 1 00:00:00 1970 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 9FAB6C4332F for ; Tue, 13 Dec 2022 08:55:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234687AbiLMIzK (ORCPT ); Tue, 13 Dec 2022 03:55:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233694AbiLMIzH (ORCPT ); Tue, 13 Dec 2022 03:55:07 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E62A8F4 for ; Tue, 13 Dec 2022 00:55:05 -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 1Mkpap-1oeQwP0Kch-00mItw; Tue, 13 Dec 2022 09:54:58 +0100 Message-ID: Date: Tue, 13 Dec 2022 16:54:54 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: [PATCH 7/8] btrfs: call rbio_orig_end_io from recover_rbio Content-Language: en-US To: Christoph Hellwig , Chris Mason , Josef Bacik , David Sterba Cc: Qu Wenruo , linux-btrfs@vger.kernel.org References: <20221213084123.309790-1-hch@lst.de> <20221213084123.309790-8-hch@lst.de> From: Qu Wenruo In-Reply-To: <20221213084123.309790-8-hch@lst.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:AvjS8dRoEb4xPxbIRzqV01tpO2rQV1M6Dj2VSheKR7gZI9qLzsY IXJD16L9wpry/h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KT2QrpegH+mZoo LMrmUEsEmfELB38Se9r/bbRnpVpf+MRLe6G7rhtBoasZmZdazw7hhOWjzUuBANrgz6jrGBMlQ El1OR3L8cnlydo8siBsN8NnoU28= Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On 2022/12/13 16:41, Christoph Hellwig wrote: > Both callers of recover_rbio call rbio_orig_end_io right after it, so > move the call into the shared function. > > Signed-off-by: Christoph Hellwig Reviewed-by: Qu Wenruo Thanks, Qu > --- > fs/btrfs/raid56.c | 26 ++++++++------------------ > 1 file changed, 8 insertions(+), 18 deletions(-) > > diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c > index 2432c2d7fcbed0..b2e02f02294163 100644 > --- a/fs/btrfs/raid56.c > +++ b/fs/btrfs/raid56.c > @@ -1985,7 +1985,7 @@ static int recover_assemble_read_bios(struct btrfs_raid_bio *rbio, > return -EIO; > } > > -static int recover_rbio(struct btrfs_raid_bio *rbio) > +static void recover_rbio(struct btrfs_raid_bio *rbio) > { > struct bio_list bio_list = BIO_EMPTY_LIST; > struct bio *bio; > @@ -2000,13 +2000,13 @@ static int recover_rbio(struct btrfs_raid_bio *rbio) > /* For recovery, we need to read all sectors including P/Q. */ > ret = alloc_rbio_pages(rbio); > if (ret < 0) > - return ret; > + goto out; > > index_rbio_pages(rbio); > > ret = recover_assemble_read_bios(rbio, &bio_list); > if (ret < 0) > - return ret; > + goto out; > > submit_read_bios(rbio, &bio_list); > wait_event(rbio->io_wait, atomic_read(&rbio->stripes_pending) == 0); > @@ -2014,32 +2014,22 @@ static int recover_rbio(struct btrfs_raid_bio *rbio) > ret = recover_sectors(rbio); > while ((bio = bio_list_pop(&bio_list))) > bio_put(bio); > - return ret; > +out: > + rbio_orig_end_io(rbio, errno_to_blk_status(ret)); > } > > static void recover_rbio_work(struct work_struct *work) > { > struct btrfs_raid_bio *rbio; > - int ret; > > rbio = container_of(work, struct btrfs_raid_bio, work); > - > - ret = lock_stripe_add(rbio); > - if (ret == 0) { > - ret = recover_rbio(rbio); > - rbio_orig_end_io(rbio, errno_to_blk_status(ret)); > - } > + if (!lock_stripe_add(rbio)) > + recover_rbio(rbio); > } > > static void recover_rbio_work_locked(struct work_struct *work) > { > - struct btrfs_raid_bio *rbio; > - int ret; > - > - rbio = container_of(work, struct btrfs_raid_bio, work); > - > - ret = recover_rbio(rbio); > - rbio_orig_end_io(rbio, errno_to_blk_status(ret)); > + recover_rbio(container_of(work, struct btrfs_raid_bio, work)); > } > > static void set_rbio_raid6_extra_error(struct btrfs_raid_bio *rbio, int mirror_num)