From patchwork Tue Mar 14 16:59:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13174784 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 34055C6FD1F for ; Tue, 14 Mar 2023 16:59:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230233AbjCNQ7a (ORCPT ); Tue, 14 Mar 2023 12:59:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229675AbjCNQ72 (ORCPT ); Tue, 14 Mar 2023 12:59:28 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 910D3A02A7 for ; Tue, 14 Mar 2023 09:59:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=graDNQDKAEOgHjlYqlQU0upJF15HC8DpSAcInFf6Bb8=; b=XLl/jNUrm49DH40h/JdkqkQLGZ hlp188hzCZgea2Nmm22clwfKv28WY5u2KiB5OWCJd7777h6azlZLx8zbTH5Cji2VORbim8Xvjd+4T fWKZO5DUz7g7XfoX+DKexLWNeTGxBdJr4zPBgwlx5OSvMG5cQQjHGNiegtTdoeORw+lU7+SI1FiHB WiqvuMnZTKrnXgRqVmYcMFFNNdgwTNWS8mrQz1QLeZlkg+u4rCE3YK/15Tbjp5j7kBpfx1zyrCxLB VpgdEIrfsNsD61RF4bL8uhRZAUE0x8xhSiATNk3CIw1wGwwY4yi/bwreWJLJpOsXhmVTFSXF71lhg VndfmDRA==; Received: from [2001:4bb8:182:2e36:91ea:d0e2:233a:8356] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1pc7ze-00AvmU-38; Tue, 14 Mar 2023 16:59:23 +0000 From: Christoph Hellwig To: Chris Mason , Josef Bacik , David Sterba Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org Subject: [PATCH 02/10] btrfs: refactor btrfs_end_io_wq Date: Tue, 14 Mar 2023 17:59:02 +0100 Message-Id: <20230314165910.373347-3-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230314165910.373347-1-hch@lst.de> References: <20230314165910.373347-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Pass a btrfs_bio instead of a fs_info and bio. Signed-off-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Reviewed-by: Qu Wenruo --- fs/btrfs/bio.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c index cf09c6271edbee..85539964864a34 100644 --- a/fs/btrfs/bio.c +++ b/fs/btrfs/bio.c @@ -296,10 +296,11 @@ static void btrfs_log_dev_io_error(struct bio *bio, struct btrfs_device *dev) btrfs_dev_stat_inc_and_print(dev, BTRFS_DEV_STAT_FLUSH_ERRS); } -static struct workqueue_struct *btrfs_end_io_wq(struct btrfs_fs_info *fs_info, - struct bio *bio) +static struct workqueue_struct *btrfs_end_io_wq(struct btrfs_bio *bbio) { - if (bio->bi_opf & REQ_META) + struct btrfs_fs_info *fs_info = bbio->inode->root->fs_info; + + if (bbio->bio.bi_opf & REQ_META) return fs_info->endio_meta_workers; return fs_info->endio_workers; } @@ -319,16 +320,15 @@ static void btrfs_simple_end_io(struct bio *bio) { struct btrfs_bio *bbio = btrfs_bio(bio); struct btrfs_device *dev = bio->bi_private; - struct btrfs_fs_info *fs_info = bbio->inode->root->fs_info; - btrfs_bio_counter_dec(fs_info); + btrfs_bio_counter_dec(bbio->inode->root->fs_info); if (bio->bi_status) btrfs_log_dev_io_error(bio, dev); if (bio_op(bio) == REQ_OP_READ) { INIT_WORK(&bbio->end_io_work, btrfs_end_bio_work); - queue_work(btrfs_end_io_wq(fs_info, bio), &bbio->end_io_work); + queue_work(btrfs_end_io_wq(bbio), &bbio->end_io_work); } else { if (bio_op(bio) == REQ_OP_ZONE_APPEND) btrfs_record_physical_zoned(bbio);