From patchwork Wed Mar 29 00:13:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13191736 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 38416C76196 for ; Wed, 29 Mar 2023 00:13:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229502AbjC2AN1 (ORCPT ); Tue, 28 Mar 2023 20:13:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbjC2AN0 (ORCPT ); Tue, 28 Mar 2023 20:13:26 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51C9D1737 for ; Tue, 28 Mar 2023 17:13: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=t3oqXQlVWS+Mrq7D7uPldV7hw7+VU6vOEbLoWNd4m6g=; b=F4YTbpdGUllXbJtZrg2Wmww4lG 41wLyGcWNCkNNJu4F0d/qVwhp78Pd0q89+2uxVQ9tKcicvm1khe+CnlaEJ9aUc0gFlajssUhIC9uU GNz9Lo8gu5mLWcI1Q/hZSKX4l4xVff/D/phWpE2r9mkFWEzEZ5O7Og9G4edpBKd0IH6KumekUTDCO 2DOsugxrhsOZ7beV+HZbDIUjVHZhTL/bLVOlUIt5C75DCLvCmS4nlUfyXVKiJZjjffQUIXtgisr/R sRrRaerMRAEDgW0TlTMqV+NK3BYyAK1p7asEEpFIQe8KRl7rTZ0cbBrcjqbaDot0FuAnkI8M22770 oZMJYPZA==; Received: from mo146-160-37-65.air.mopera.net ([146.160.37.65] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1phJRK-00GAyw-33; Wed, 29 Mar 2023 00:13:23 +0000 From: Christoph Hellwig To: Chris Mason , Josef Bacik , David Sterba Cc: linux-btrfs@vger.kernel.org Subject: [PATCH 1/4] btrfs: fix fast csum detection Date: Wed, 29 Mar 2023 09:13:05 +0900 Message-Id: <20230329001308.1275299-2-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230329001308.1275299-1-hch@lst.de> References: <20230329001308.1275299-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 The BTRFS_FS_CSUM_IMPL_FAST flag is current set whenever a non-generic crc32c is detected, which is the incorrect check if the file system uses a different checksumming algorithm. Refactor the code to only checks this if crc32 is actually used. Note that in an ideal world the information if an algorithm is hardware accelerated or not should be provided by the crypto API instead, but that's left for another day. Signed-off-by: Christoph Hellwig --- fs/btrfs/disk-io.c | 18 +++++++++++++++++- fs/btrfs/super.c | 2 -- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 3f57c41f41bf5f..ec765d6bc53673 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -154,6 +154,21 @@ static bool btrfs_supported_super_csum(u16 csum_type) } } +/* + * Check if the CSUM implementation is a fast accelerated one. + * As-is this is a bit of a hack and should be replaced once the + * csum implementations provide that information themselves. + */ +static bool btrfs_csum_is_fast(u16 csum_type) +{ + switch (csum_type) { + case BTRFS_CSUM_TYPE_CRC32: + return !strstr(crc32c_impl(), "generic"); + default: + return false; + } +} + /* * Return 0 if the superblock checksum type matches the checksum value of that * algorithm. Pass the raw disk superblock data. @@ -3373,7 +3388,8 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device btrfs_release_disk_super(disk_super); goto fail_alloc; } - + if (btrfs_csum_is_fast(csum_type)) + set_bit(BTRFS_FS_CSUM_IMPL_FAST, &fs_info->flags); fs_info->csum_size = btrfs_super_csum_size(disk_super); ret = btrfs_init_csum_hash(fs_info, csum_type); diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index d8885966e801cd..e94a4cd06607e1 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -1517,8 +1517,6 @@ static struct dentry *btrfs_mount_root(struct file_system_type *fs_type, shrinker_debugfs_rename(&s->s_shrink, "sb-%s:%s", fs_type->name, s->s_id); btrfs_sb(s)->bdev_holder = fs_type; - if (!strstr(crc32c_impl(), "generic")) - set_bit(BTRFS_FS_CSUM_IMPL_FAST, &fs_info->flags); error = btrfs_fill_super(s, fs_devices, data); } if (!error) From patchwork Wed Mar 29 00:13:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13191737 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 49350C76196 for ; Wed, 29 Mar 2023 00:13:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229548AbjC2ANb (ORCPT ); Tue, 28 Mar 2023 20:13:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229452AbjC2ANa (ORCPT ); Tue, 28 Mar 2023 20:13:30 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56FF5213B for ; Tue, 28 Mar 2023 17:13:29 -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=I/TD75OZMdIRuVbcb0TWfT9KmB3urDAo/g+cALin7CY=; b=ckLIurbXm1/aAV4bE4OHVFcMYE pzlv8r2oW9mfBCQm6Ca74nc2PlPj+mh0P+lXwvxmnvPTOcX69mc/heQ6aLqcEPGRMhuc8HrOGMvQz 4BoU5vheSHWBQfAyhgshDV1ppAe0JeERsJ674H6JgyTAT041XZIrdWW1x/xRUyAxglUWS5tSKVRD2 W8wPEHAKeDuBJhrATRQJeLzywbQ87ZK7YjAOrGD8l2PVMtaJYt2Ag9mBfNyz5PgB4y9Xbg8Znwr1e fHVLvGECCUUHP5/N/7Wn8Rw8bLbGG6HIussC+/lVt0N2FNLOFTmY4Qn9/CN7zCy5u22itoJTpIA4S VCQUcc2w==; Received: from mo146-160-37-65.air.mopera.net ([146.160.37.65] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1phJRN-00GAzQ-2t; Wed, 29 Mar 2023 00:13:26 +0000 From: Christoph Hellwig To: Chris Mason , Josef Bacik , David Sterba Cc: linux-btrfs@vger.kernel.org Subject: [PATCH 2/4] btrfs: remove the sync_writers field in struct btrfs_inode Date: Wed, 29 Mar 2023 09:13:06 +0900 Message-Id: <20230329001308.1275299-3-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230329001308.1275299-1-hch@lst.de> References: <20230329001308.1275299-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 The sync_writers field communicates if an inode has outstanding synchronous writeback. The better way is to look at the REQ_SYNC flag in the bio, which is set by the writeback code for WB_SYNC_ALL writeback and can communicate the need for sync writeback without an inode field. Signed-off-by: Christoph Hellwig --- fs/btrfs/bio.c | 7 +++---- fs/btrfs/btrfs_inode.h | 3 --- fs/btrfs/file.c | 9 --------- fs/btrfs/inode.c | 1 - fs/btrfs/transaction.c | 2 -- 5 files changed, 3 insertions(+), 19 deletions(-) diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c index cf09c6271edbee..c851a3526911f6 100644 --- a/fs/btrfs/bio.c +++ b/fs/btrfs/bio.c @@ -552,11 +552,10 @@ static void run_one_async_free(struct btrfs_work *work) static bool should_async_write(struct btrfs_bio *bbio) { /* - * If the I/O is not issued by fsync and friends, (->sync_writers != 0), - * then try to defer the submission to a workqueue to parallelize the - * checksum calculation. + * Try to defer the submission to a workqueue to parallelize the + * checksum calculation unless the I/O is issued synchronously. */ - if (atomic_read(&bbio->inode->sync_writers)) + if (op_is_sync(bbio->bio.bi_opf)) return false; /* diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index 9dc21622806ef4..8666ace8879302 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h @@ -116,9 +116,6 @@ struct btrfs_inode { unsigned long runtime_flags; - /* Keep track of who's O_SYNC/fsyncing currently */ - atomic_t sync_writers; - /* full 64 bit generation number, struct vfs_inode doesn't have a big * enough field for this. */ diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 5cc5a1faaef5b5..4b9433b96f4b8e 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -1651,7 +1651,6 @@ ssize_t btrfs_do_write_iter(struct kiocb *iocb, struct iov_iter *from, struct file *file = iocb->ki_filp; struct btrfs_inode *inode = BTRFS_I(file_inode(file)); ssize_t num_written, num_sync; - const bool sync = iocb_is_dsync(iocb); /* * If the fs flips readonly due to some impossible error, although we @@ -1664,9 +1663,6 @@ ssize_t btrfs_do_write_iter(struct kiocb *iocb, struct iov_iter *from, if (encoded && (iocb->ki_flags & IOCB_NOWAIT)) return -EOPNOTSUPP; - if (sync) - atomic_inc(&inode->sync_writers); - if (encoded) { num_written = btrfs_encoded_write(iocb, from, encoded); num_sync = encoded->len; @@ -1686,9 +1682,6 @@ ssize_t btrfs_do_write_iter(struct kiocb *iocb, struct iov_iter *from, num_written = num_sync; } - if (sync) - atomic_dec(&inode->sync_writers); - current->backing_dev_info = NULL; return num_written; } @@ -1733,9 +1726,7 @@ static int start_ordered_ops(struct inode *inode, loff_t start, loff_t end) * several segments of stripe length (currently 64K). */ blk_start_plug(&plug); - atomic_inc(&BTRFS_I(inode)->sync_writers); ret = btrfs_fdatawrite_range(inode, start, end); - atomic_dec(&BTRFS_I(inode)->sync_writers); blk_finish_plug(&plug); return ret; diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 865d56ff2ce150..b505b205c1b142 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -8479,7 +8479,6 @@ struct inode *btrfs_alloc_inode(struct super_block *sb) ei->io_tree.inode = ei; extent_io_tree_init(fs_info, &ei->file_extent_tree, IO_TREE_INODE_FILE_EXTENT); - atomic_set(&ei->sync_writers, 0); mutex_init(&ei->log_mutex); btrfs_ordered_inode_tree_init(&ei->ordered_tree); INIT_LIST_HEAD(&ei->delalloc_inodes); diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index c8e503e5db4cdb..6587a13de0aedb 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -1055,7 +1055,6 @@ int btrfs_write_marked_extents(struct btrfs_fs_info *fs_info, u64 start = 0; u64 end; - atomic_inc(&BTRFS_I(fs_info->btree_inode)->sync_writers); while (!find_first_extent_bit(dirty_pages, start, &start, &end, mark, &cached_state)) { bool wait_writeback = false; @@ -1091,7 +1090,6 @@ int btrfs_write_marked_extents(struct btrfs_fs_info *fs_info, cond_resched(); start = end + 1; } - atomic_dec(&BTRFS_I(fs_info->btree_inode)->sync_writers); return werr; } From patchwork Wed Mar 29 00:13:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13191738 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 2DE4FC6FD18 for ; Wed, 29 Mar 2023 00:13:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229570AbjC2ANd (ORCPT ); Tue, 28 Mar 2023 20:13:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229560AbjC2ANc (ORCPT ); Tue, 28 Mar 2023 20:13:32 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A1E419C for ; Tue, 28 Mar 2023 17:13:31 -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=+Xfe11xv0g04osh835h6quLYprLeCUAFmPIDjoFALlM=; b=FZahgjlBs4HbxNw0rplZy95bo8 3OZFFSCNR0gGvGEG8350B9Dnzinu3TsJlpmZCh8QFq2DPGWxPL8vlnwoVX65o4AA24Mj42jhQ0YCX +gChygGjMdFvXSit+4lmi4sgwWAZxY6e0fbfe1HZYkc55pB/J1KqCJx5pMD4XlnnC+JIE0sOiT3MQ FbChXwT9I3rVCaUmSgyFDIP9oLh/+66Jbr6XG1regt4Ng8GshD64uAAqu7CW7LTb3hicg2yUNsLQw cjVYea9amVqT+SBaDZ0bS/33jUlDIefpJr/iAyb9qXWHCYqpBO797xtydGswwlqxVV4jiTv+nZN71 YCo3b6fg==; Received: from mo146-160-37-65.air.mopera.net ([146.160.37.65] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1phJRR-00GAzl-0T; Wed, 29 Mar 2023 00:13:29 +0000 From: Christoph Hellwig To: Chris Mason , Josef Bacik , David Sterba Cc: linux-btrfs@vger.kernel.org Subject: [PATCH 3/4] btrfs: never defer I/O submission for fast CRC implementations Date: Wed, 29 Mar 2023 09:13:07 +0900 Message-Id: <20230329001308.1275299-4-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230329001308.1275299-1-hch@lst.de> References: <20230329001308.1275299-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 Most modern hardware supports very fast accelerated crc32c calculation. If that is supported the CPU overhead of the checksum calculation is very limited, and offloading the calculation to special worker threads has a lot of overhead for no gain. E.g. on an Intel Optane device is actually very much slows down even 1M buffered writes with fio: Unpatched: write: IOPS=3316, BW=3316MiB/s (3477MB/s)(200GiB/61757msec); 0 zone resets With synchronous CRCs: write: IOPS=4882, BW=4882MiB/s (5119MB/s)(200GiB/41948msec); 0 zone resets With a lot of variation during the unpatch run going down as low as 1100MB/s, while the synchronous CRC version has about the same peak write speed but much lower dips, and fewer kworkers churning around. Both tests had fio saturated at 100% CPU. (thanks to Jens Axboe via Chris Mason for the benchmarking) Signed-off-by: Christoph Hellwig --- fs/btrfs/bio.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c index c851a3526911f6..57c35e920269f4 100644 --- a/fs/btrfs/bio.c +++ b/fs/btrfs/bio.c @@ -551,26 +551,26 @@ static void run_one_async_free(struct btrfs_work *work) static bool should_async_write(struct btrfs_bio *bbio) { + struct btrfs_fs_info *fs_info = bbio->inode->root->fs_info; + + /* + * Submit synchronously if the checksum implementation is fast. + */ + if (test_bit(BTRFS_FS_CSUM_IMPL_FAST, &fs_info->flags)) + return false; + /* * Try to defer the submission to a workqueue to parallelize the - * checksum calculation unless the I/O is issued synchronously. + * checksum calculation only if the I/O is issued asynchronously. */ if (op_is_sync(bbio->bio.bi_opf)) return false; /* - * Submit metadata writes synchronously if the checksum implementation - * is fast, or we are on a zoned device that wants I/O to be submitted - * in order. + * Zoned devices require I/O to be submitted in order. */ - if (bbio->bio.bi_opf & REQ_META) { - struct btrfs_fs_info *fs_info = bbio->inode->root->fs_info; - - if (btrfs_is_zoned(fs_info)) - return false; - if (test_bit(BTRFS_FS_CSUM_IMPL_FAST, &fs_info->flags)) - return false; - } + if ((bbio->bio.bi_opf & REQ_META) && btrfs_is_zoned(fs_info)) + return false; return true; } From patchwork Wed Mar 29 00:13:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13191739 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 1E084C6FD18 for ; Wed, 29 Mar 2023 00:13:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229585AbjC2ANg (ORCPT ); Tue, 28 Mar 2023 20:13:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229560AbjC2ANe (ORCPT ); Tue, 28 Mar 2023 20:13:34 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 394812D68 for ; Tue, 28 Mar 2023 17:13:34 -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: Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=kOD9gSPGY/jiZFo7uUOcZDMlkB/acRjdCcfIi0hGhgw=; b=qc5NluxNtUueUtGSuzZ/bPI7Kh g+/We4zNFxqKmUh08N9C1wAX6RfxRKB/l0SuDRB6X27fvtmwl3eN+XBaDwH4BPf3lrhRjfxc0uOho pt7vsSpmOu6wKWlwvtmJ4rs87Du8brAngZwRstgbPXi9JWUVs5RXFUE9h9FmGkjCdF/zBFz1R7Znq 9SRA2Mi83h+AX0bYJ8a8PgbqvSCW44UicX3M6BDcgACnoAvlXkvX8UFW8YNPdWVHzFcEuunfx0Jzr a8OrhXhhEh4P6lEod8EjNGxjUFap9N08N7PgnCb2F6cmegADvCOQnXyqLVcAW7BBuEUdrTiS2P4Uj r/gnGgqw==; Received: from mo146-160-37-65.air.mopera.net ([146.160.37.65] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1phJRT-00GB0H-28; Wed, 29 Mar 2023 00:13:32 +0000 From: Christoph Hellwig To: Chris Mason , Josef Bacik , David Sterba Cc: linux-btrfs@vger.kernel.org Subject: [PATCH 4/4] btrfs: remove hipri_workers workqueue Date: Wed, 29 Mar 2023 09:13:08 +0900 Message-Id: <20230329001308.1275299-5-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230329001308.1275299-1-hch@lst.de> References: <20230329001308.1275299-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 Now that btrfs_wq_submit_bio is never called for synchronous I/O, the hipri_workers workqueue is dead code and can be removeḋ. Signed-off-by: Christoph Hellwig --- fs/btrfs/bio.c | 5 +---- fs/btrfs/disk-io.c | 6 +----- fs/btrfs/fs.h | 1 - fs/btrfs/super.c | 1 - 4 files changed, 2 insertions(+), 11 deletions(-) diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c index 57c35e920269f4..f1ff33d6726404 100644 --- a/fs/btrfs/bio.c +++ b/fs/btrfs/bio.c @@ -598,10 +598,7 @@ static bool btrfs_wq_submit_bio(struct btrfs_bio *bbio, btrfs_init_work(&async->work, run_one_async_start, run_one_async_done, run_one_async_free); - if (op_is_sync(bbio->bio.bi_opf)) - btrfs_queue_work(fs_info->hipri_workers, &async->work); - else - btrfs_queue_work(fs_info->workers, &async->work); + btrfs_queue_work(fs_info->workers, &async->work); return true; } diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index ec765d6bc53673..7740bb1b152445 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -2000,7 +2000,6 @@ static void btrfs_stop_all_workers(struct btrfs_fs_info *fs_info) { btrfs_destroy_workqueue(fs_info->fixup_workers); btrfs_destroy_workqueue(fs_info->delalloc_workers); - btrfs_destroy_workqueue(fs_info->hipri_workers); btrfs_destroy_workqueue(fs_info->workers); if (fs_info->endio_workers) destroy_workqueue(fs_info->endio_workers); @@ -2195,9 +2194,6 @@ static int btrfs_init_workqueues(struct btrfs_fs_info *fs_info) fs_info->workers = btrfs_alloc_workqueue(fs_info, "worker", flags, max_active, 16); - fs_info->hipri_workers = - btrfs_alloc_workqueue(fs_info, "worker-high", - flags | WQ_HIGHPRI, max_active, 16); fs_info->delalloc_workers = btrfs_alloc_workqueue(fs_info, "delalloc", @@ -2234,7 +2230,7 @@ static int btrfs_init_workqueues(struct btrfs_fs_info *fs_info) fs_info->discard_ctl.discard_workers = alloc_workqueue("btrfs_discard", WQ_UNBOUND | WQ_FREEZABLE, 1); - if (!(fs_info->workers && fs_info->hipri_workers && + if (!(fs_info->workers && fs_info->delalloc_workers && fs_info->flush_workers && fs_info->endio_workers && fs_info->endio_meta_workers && fs_info->compressed_write_workers && diff --git a/fs/btrfs/fs.h b/fs/btrfs/fs.h index ca17a7fc3ac35c..25faa9de4b5385 100644 --- a/fs/btrfs/fs.h +++ b/fs/btrfs/fs.h @@ -543,7 +543,6 @@ struct btrfs_fs_info { * A third pool does submit_bio to avoid deadlocking with the other two. */ struct btrfs_workqueue *workers; - struct btrfs_workqueue *hipri_workers; struct btrfs_workqueue *delalloc_workers; struct btrfs_workqueue *flush_workers; struct workqueue_struct *endio_workers; diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index e94a4cd06607e1..f2d59be4477cf1 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -1627,7 +1627,6 @@ static void btrfs_resize_thread_pool(struct btrfs_fs_info *fs_info, old_pool_size, new_pool_size); btrfs_workqueue_set_max(fs_info->workers, new_pool_size); - btrfs_workqueue_set_max(fs_info->hipri_workers, new_pool_size); btrfs_workqueue_set_max(fs_info->delalloc_workers, new_pool_size); btrfs_workqueue_set_max(fs_info->caching_workers, new_pool_size); btrfs_workqueue_set_max(fs_info->endio_write_workers, new_pool_size);