Skip to contentSkip to conversation

don't offload CRCs generation to helpers if it is fast

PATCH In review Christoph Hellwig 4 participants 16 messages Mar 29, 2023 – Apr 11, 2023 Btrfs file system

lore
Share & tools
lore
#0 lore raw

Hi all,

based on various observations from me and Chris, we really should never offload CRCs generation to helpers if it is hardware accelerated.

This series implements that and also tidies up various lose ends around that.

Diffstat:

 bio.c         |   32 ++++++++++++++------------------
 btrfs_inode.h |    3 ---
 disk-io.c     |   24 ++++++++++++++++++------
 file.c        |    9 ---------
 fs.h          |    1 -
 inode.c       |    1 -
 super.c       |    3 ---
 transaction.c |    2 --
 8 files changed, 32 insertions(+), 43 deletions(-)
#1 lore raw

PATCH 1/4 btrfs: fix fast csum detection

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.

---
 fs/btrfs/disk-io.c | 18 +++++++++++++++++-
 fs/btrfs/super.c   |  2 --
 2 files changed, 17 insertions(+), 3 deletions(-)
fs/btrfs/disk-io.c +17 -1
index 3f57c41f41bf5f..ec765d6bc53673 100644
@@ -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);
fs/btrfs/super.c +0 -2
index d8885966e801cd..e94a4cd06607e1 100644
@@ -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)
Signature · 1 line
2.39.2
#2 lore raw

Re: [PATCH 1/4] btrfs: fix fast csum detection

Quoted 6 lines · Christoph Hellwig

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.

https://lore.kernel.org/linux-crypto/[email protected]/
I got pointed to the driver name, the priority that would say if the implementation is accelerated is not exported to the API. This would be cleaner but for a simple 'is/is-not' I think it's sufficient.

Quoted 14 lines
---
 fs/btrfs/disk-io.c | 18 +++++++++++++++++-
 fs/btrfs/super.c   |  2 --
 2 files changed, 17 insertions(+), 3 deletions(-)
fs/btrfs/disk-io.c +0 -0
index 3f57c41f41bf5f..ec765d6bc53673 100644
@@ -154,6 +154,21 @@ static bool btrfs_supported_super_csum(u16 csum_type)
 	}
 }
 

fs/btrfs/disk-io.c static bool btrfs_supported_super_csum(u16 csum_type) · line 166

Quoted 10 lines
fs/btrfs/disk-io.c +10 -0
+/*
+ * 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");

This would check the internal shash (lib/libcrc32c.c) not the one we allocate for btrfs in btrfs_init_csum_hash. Though they both should be equivalent as libcrc32c does some tricks to lookup the fastest implementation but theoretically may not find the fast one, while mount could.

Quoted 9 lines
fs/btrfs/disk-io.c +5 -0
+	default:
+		return false;
+	}
+}
+
 /*
  * Return 0 if the superblock checksum type matches the checksum value of that
  * algorithm. Pass the raw disk superblock data.

fs/btrfs/disk-io.c int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device · line 3392

Quoted 6 lines
fs/btrfs/disk-io.c +2 -1
@@ -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);

This ^^^

fs/btrfs/disk-io.c int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device · line 3395

Quoted 3 lines
fs/btrfs/disk-io.c +0 -0
 	fs_info->csum_size = btrfs_super_csum_size(disk_super);
 
 	ret = btrfs_init_csum_hash(fs_info, csum_type);

should be moved after the initialization btrfs_init_csum_hash so it would also detect accelerated implementation of other hashes.

Quoted 15 lines
fs/btrfs/super.c +0 -2
index d8885966e801cd..e94a4cd06607e1 100644
@@ -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)
Signature · 1 line
2.39.2
#3 lore raw

Re: [PATCH 1/4] btrfs: fix fast csum detection

Quoted 9 lines · David Sterba
Quoted 4 lines

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.

https://lore.kernel.org/linux-crypto/[email protected]/
I got pointed to the driver name, the priority that would say if the implementation is accelerated is not exported to the API. This would be cleaner but for a simple 'is/is-not' I think it's sufficient.

Except that it diesn't really scale to multiple algorithms very well. I guess the priority might be the logically best thing to do, so I'll try to find some time to look into it.

Quoted 8 lines
Quoted 8 lines
(quoted diff) +8 -0
+/*
+ * 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) {
Quoted 8 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	case BTRFS_CSUM_TYPE_CRC32:
+		return !strstr(crc32c_impl(), "generic");

This would check the internal shash (lib/libcrc32c.c) not the one we allocate for btrfs in btrfs_init_csum_hash. Though they both should be equivalent as libcrc32c does some tricks to lookup the fastest implementation but theoretically may not find the fast one, while mount could.

Yeah.

Quoted 11 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	if (btrfs_csum_is_fast(csum_type))
+		set_bit(BTRFS_FS_CSUM_IMPL_FAST, &fs_info->flags);

This ^^^

Review

Quoted 3 lines
(quoted diff) +0 -0
 	fs_info->csum_size = btrfs_super_csum_size(disk_super);
 
 	ret = btrfs_init_csum_hash(fs_info, csum_type);

should be moved after the initialization btrfs_init_csum_hash so it would also detect accelerated implementation of other hashes.

Sure. Something like this incremental fix. Do you want to fold it in or should I resend the series?

---

fs/btrfs/disk-io.c +14 -17
index 7740bb1b152445..eeefa5105c91d5 100644
@@ -154,21 +154,6 @@ 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.
@@ -2260,6 +2245,20 @@ static int btrfs_init_csum_hash(struct btrfs_fs_info *fs_info, u16 csum_type)
 
 	fs_info->csum_shash = csum_shash;
 
+	/*
+	 * 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.
+	 */
+	switch (csum_type) {
+	case BTRFS_CSUM_TYPE_CRC32:
+		if (!strstr(crypto_shash_driver_name(csum_shash), "generic"))
+			set_bit(BTRFS_FS_CSUM_IMPL_FAST, &fs_info->flags);
+		break;
+	default:
+		break;
+	}
+
 	btrfs_info(fs_info, "using %s (%s) checksum algorithm",
 			btrfs_super_csum_name(csum_type),
 			crypto_shash_driver_name(csum_shash));
@@ -3384,8 +3383,6 @@ 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);
#4 lore raw

Re: [PATCH 1/4] btrfs: fix fast csum detection

Quoted 7 lines · Christoph Hellwig
Quoted 7 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	if (btrfs_csum_is_fast(csum_type))
+		set_bit(BTRFS_FS_CSUM_IMPL_FAST, &fs_info->flags);

This ^^^

Quoted 2 lines

fs_info->csum_size = btrfs_super_csum_size(disk_super);

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

ret = btrfs_init_csum_hash(fs_info, csum_type);

should be moved after the initialization btrfs_init_csum_hash so it would also detect accelerated implementation of other hashes.

Sure. Something like this incremental fix. Do you want to fold it in or should I resend the series?

I ended up with the same diff when reviewing the patch so I can fold it, no need to resend. I'll send a separate patch to add xxhash as a fast implementation, with some numbers.

#5 lore raw

PATCH 2/4 btrfs: remove the sync_writers field in struct btrfs_inode

In reply to Christoph Hellwig

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.

---
 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(-)
fs/btrfs/bio.c +3 -4
index cf09c6271edbee..c851a3526911f6 100644
@@ -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;
 
 	/*
fs/btrfs/btrfs_inode.h +0 -3
index 9dc21622806ef4..8666ace8879302 100644
@@ -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.
 	 */
fs/btrfs/file.c +0 -9
index 5cc5a1faaef5b5..4b9433b96f4b8e 100644
@@ -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;
fs/btrfs/inode.c +0 -1
index 865d56ff2ce150..b505b205c1b142 100644
@@ -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);
fs/btrfs/transaction.c +0 -2
index c8e503e5db4cdb..6587a13de0aedb 100644
@@ -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;
 }
 
Signature · 1 line
2.39.2
#6 lore raw

Re: [PATCH 2/4] btrfs: remove the sync_writers field in struct btrfs_inode

Quoted 5 lines · Christoph Hellwig

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.

This does not go into much detail why it is 'better'. Tracking the status from the outside as sync_writers applies to the whole inode and not just the submission context of the individual bios so there's a difference.

Also the subject should say something about changing the decision logic, removal of sync_writes is just a side effect.

Quoted 15 lines
---
 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(-)
fs/btrfs/bio.c +0 -0
index cf09c6271edbee..c851a3526911f6 100644
@@ -552,11 +552,10 @@ static void run_one_async_free(struct btrfs_work *work)
 static bool should_async_write(struct btrfs_bio *bbio)

fs/btrfs/bio.c static void run_one_async_free(struct btrfs_work *work) · line 558

Quoted 10 lines
fs/btrfs/bio.c +3 -4
 {
 	/*
-	 * 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))

So if there's sync_writers set from any of

- btrfs_do_write_iter
- start_ordered_ops
- btrfs_write_marked_extents

then should_async_write would always return false. The change in behaviour looks like "write everything for this inode synchronously" vs "write some bios synchronously". I don't see the 1:1 correspondence.

Quoted 1 line
fs/btrfs/bio.c +0 -0
 		return false;
#7 lore raw

PATCH 3/4 btrfs: never defer I/O submission for fast CRC implementations

In reply to Christoph Hellwig

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)

---
 fs/btrfs/bio.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
fs/btrfs/bio.c +12 -12
index c851a3526911f6..57c35e920269f4 100644
@@ -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;
 }
Signature · 1 line
2.39.2
#8 lore raw

PATCH 4/4 btrfs: remove hipri_workers workqueue

In reply to Christoph Hellwig

Now that btrfs_wq_submit_bio is never called for synchronous I/O, the hipri_workers workqueue is dead code and can be removeḋ.

---
 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(-)
fs/btrfs/bio.c +1 -4
index 57c35e920269f4..f1ff33d6726404 100644
@@ -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;
 }
 
fs/btrfs/disk-io.c +1 -5
index ec765d6bc53673..7740bb1b152445 100644
@@ -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 &&
fs/btrfs/fs.h +0 -1
index ca17a7fc3ac35c..25faa9de4b5385 100644
@@ -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;
fs/btrfs/super.c +0 -1
index e94a4cd06607e1..f2d59be4477cf1 100644
@@ -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);
Signature · 1 line
2.39.2
Reviewed-by
#9 lore raw
In reply to Christoph Hellwig
Quoted 8 lines · Christoph Hellwig

Hi all,

based on various observations from me and Chris, we really should never offload CRCs generation to helpers if it is hardware accelerated.

This series implements that and also tidies up various lose ends around that.

Thanks for doing this, and for fixing up the fast crc detection. For the whole series:

I spent a while convincing myself we really don't need sync_writers, and it's great to get rid of that. Tangent-man noticed that we're really close to being able to drop struct btrfs_bio_ctrl->sync_io.

As far as I can tell, it's only mirroring wbc->sync_mode, and the only place that still cares is lock_extent_buffer_for_io(), and we could just pass down the wbc.

-chris

#10 lore raw
Quoted 7 lines · Chris Mason

I spent a while convincing myself we really don't need sync_writers, and it's great to get rid of that. Tangent-man noticed that we're really close to being able to drop struct btrfs_bio_ctrl->sync_io.

As far as I can tell, it's only mirroring wbc->sync_mode, and the only place that still cares is lock_extent_buffer_for_io(), and we could just pass down the wbc.

btrfs_bio_ctrl->sync_io is already gone in misc-next and replaced with a check for wbc->sync_mode.

#11 lore raw
In reply to Christoph Hellwig
Quoted 7 lines · Christoph Hellwig

Hi all,

based on various observations from me and Chris, we really should never offload CRCs generation to helpers if it is hardware accelerated.

This series implements that and also tidies up various lose ends around that.

Added to for-next, thanks.

Applied
#12 lore raw
In reply to Christoph Hellwig
Quoted 7 lines · Christoph Hellwig

Hi all,

based on various observations from me and Chris, we really should never offload CRCs generation to helpers if it is hardware accelerated.

This series implements that and also tidies up various lose ends around that.

I've picked patch 1 as it's a standalone fix and should go to stable trees, the rest is in for-next and still queued for 6.4.

#13 lore raw
Quoted 5 lines · David Sterba
Quoted 2 lines

This series implements that and also tidies up various lose ends around that.

I've picked patch 1 as it's a standalone fix and should go to stable trees, the rest is in for-next and still queued for 6.4.

So the usual question:

- should I resend the series with a commit log that you're prefer?
- or just deliver a new commit log?
- or are you just going to fix it up?

#14 lore raw
Quoted 4 lines · Christoph Hellwig
Quoted 3 lines · David Sterba
Quoted 2 lines

This series implements that and also tidies up various lose ends around that.

Quoted 8 lines
Quoted 2 lines

I've picked patch 1 as it's a standalone fix and should go to stable trees, the rest is in for-next and still queued for 6.4.

So the usual question:

- should I resend the series with a commit log that you're prefer?
- or just deliver a new commit log?
- or are you just going to fix it up?

Dave, can you help me on how you want me to proceed here?

#15 lore raw
Quoted 8 lines · Christoph Hellwig
Quoted 7 lines · Christoph Hellwig
Quoted 5 lines · David Sterba
Quoted 2 lines

This series implements that and also tidies up various lose ends around that.

I've picked patch 1 as it's a standalone fix and should go to stable trees, the rest is in for-next and still queued for 6.4.

Quoted 7 lines
Quoted 5 lines

So the usual question:

- should I resend the series with a commit log that you're prefer?
- or just deliver a new commit log?
- or are you just going to fix it up?

Dave, can you help me on how you want me to proceed here?

Please update the changelog of patch 2. I fix trivial things or do minor rewording/spelling fixes, when the changelog does not match the code I'd rather let the original author to write it and me take the second look.

It's getting close to the merge window and there was Easter holiday here so adding the rest of the patches will be moved to 6.5, also it might be actually better to group all the workqueue changes together.