Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

btrfs: remove experimental offload csum mode

The offload csum mode was introduced to allow developers to compare the
performance of generating checksum for data writes at different timings:

- During btrfs_submit_chunk()
This is the most common one, if any of the following condition is met
we go this path:

* The csum is fast
For now it's CRC32C and xxhash.

* It's a synchronous write

* Zoned

- Delay the checksum generation to a workqueue

However since commit dd57c78aec39 ("btrfs: introduce
btrfs_bio::async_csum") we no longer need to bother any of them.

As if it's an experimental build, async checksum generation at the
background will be faster anyway.

And if not an experimental build, we won't even have the offload csum
mode support.

Considering the async csum will be the new default, let's remove the
offload csum mode code.

There will be no impact to end users, and offload csum mode is still
under experimental features.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>

authored by

Qu Wenruo and committed by
David Sterba
ae23fee4 e582f220

-74
-3
fs/btrfs/Kconfig
··· 104 104 105 105 - send stream protocol v3 - fs-verity support 106 106 107 - - checksum offload mode - sysfs knob to affect when checksums are 108 - calculated (at IO time, or in a thread) 109 - 110 107 - raid-stripe-tree - additional mapping of extents to devices to 111 108 support RAID1* profiles on zoned devices, 112 109 RAID56 not yet supported
-5
fs/btrfs/bio.c
··· 665 665 bool auto_csum_mode = true; 666 666 667 667 #ifdef CONFIG_BTRFS_EXPERIMENTAL 668 - struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; 669 - enum btrfs_offload_csum_mode csum_mode = READ_ONCE(fs_devices->offload_csum_mode); 670 - 671 - if (csum_mode == BTRFS_OFFLOAD_CSUM_FORCE_ON) 672 - return true; 673 668 /* 674 669 * Write bios will calculate checksum and submit bio at the same time. 675 670 * Unless explicitly required don't offload serial csum calculate and bio
-44
fs/btrfs/sysfs.c
··· 1538 1538 BTRFS_ATTR_RW(, bg_reclaim_threshold, btrfs_bg_reclaim_threshold_show, 1539 1539 btrfs_bg_reclaim_threshold_store); 1540 1540 1541 - #ifdef CONFIG_BTRFS_EXPERIMENTAL 1542 - static ssize_t btrfs_offload_csum_show(struct kobject *kobj, 1543 - struct kobj_attribute *a, char *buf) 1544 - { 1545 - struct btrfs_fs_devices *fs_devices = to_fs_devs(kobj); 1546 - 1547 - switch (READ_ONCE(fs_devices->offload_csum_mode)) { 1548 - case BTRFS_OFFLOAD_CSUM_AUTO: 1549 - return sysfs_emit(buf, "auto\n"); 1550 - case BTRFS_OFFLOAD_CSUM_FORCE_ON: 1551 - return sysfs_emit(buf, "1\n"); 1552 - case BTRFS_OFFLOAD_CSUM_FORCE_OFF: 1553 - return sysfs_emit(buf, "0\n"); 1554 - default: 1555 - WARN_ON(1); 1556 - return -EINVAL; 1557 - } 1558 - } 1559 - 1560 - static ssize_t btrfs_offload_csum_store(struct kobject *kobj, 1561 - struct kobj_attribute *a, const char *buf, 1562 - size_t len) 1563 - { 1564 - struct btrfs_fs_devices *fs_devices = to_fs_devs(kobj); 1565 - int ret; 1566 - bool val; 1567 - 1568 - ret = kstrtobool(buf, &val); 1569 - if (ret == 0) 1570 - WRITE_ONCE(fs_devices->offload_csum_mode, 1571 - val ? BTRFS_OFFLOAD_CSUM_FORCE_ON : BTRFS_OFFLOAD_CSUM_FORCE_OFF); 1572 - else if (ret == -EINVAL && sysfs_streq(buf, "auto")) 1573 - WRITE_ONCE(fs_devices->offload_csum_mode, BTRFS_OFFLOAD_CSUM_AUTO); 1574 - else 1575 - return -EINVAL; 1576 - 1577 - return len; 1578 - } 1579 - BTRFS_ATTR_RW(, offload_csum, btrfs_offload_csum_show, btrfs_offload_csum_store); 1580 - #endif 1581 - 1582 1541 /* 1583 1542 * Per-filesystem information and stats. 1584 1543 * ··· 1557 1598 BTRFS_ATTR_PTR(, bg_reclaim_threshold), 1558 1599 BTRFS_ATTR_PTR(, commit_stats), 1559 1600 BTRFS_ATTR_PTR(, temp_fsid), 1560 - #ifdef CONFIG_BTRFS_EXPERIMENTAL 1561 - BTRFS_ATTR_PTR(, offload_csum), 1562 - #endif 1563 1601 NULL, 1564 1602 }; 1565 1603
-22
fs/btrfs/volumes.h
··· 321 321 BTRFS_NR_READ_POLICY, 322 322 }; 323 323 324 - #ifdef CONFIG_BTRFS_EXPERIMENTAL 325 - /* 326 - * Checksum mode - offload it to workqueues or do it synchronously in 327 - * btrfs_submit_chunk(). 328 - */ 329 - enum btrfs_offload_csum_mode { 330 - /* 331 - * Choose offloading checksum or do it synchronously automatically. 332 - * Do it synchronously if the checksum is fast, or offload to workqueues 333 - * otherwise. 334 - */ 335 - BTRFS_OFFLOAD_CSUM_AUTO, 336 - /* Always offload checksum to workqueues. */ 337 - BTRFS_OFFLOAD_CSUM_FORCE_ON, 338 - /* Never offload checksum to workqueues. */ 339 - BTRFS_OFFLOAD_CSUM_FORCE_OFF, 340 - }; 341 - #endif 342 - 343 324 struct btrfs_fs_devices { 344 325 u8 fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */ 345 326 ··· 447 466 448 467 /* Device to be used for reading in case of RAID1. */ 449 468 u64 read_devid; 450 - 451 - /* Checksum mode - offload it or do it synchronously. */ 452 - enum btrfs_offload_csum_mode offload_csum_mode; 453 469 #endif 454 470 }; 455 471