]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
btrfs: remove experimental offload csum mode
authorQu Wenruo <wqu@suse.com>
Thu, 8 Jan 2026 04:01:03 +0000 (14:31 +1030)
committerDavid Sterba <dsterba@suse.com>
Tue, 3 Feb 2026 06:51:43 +0000 (07:51 +0100)
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>
fs/btrfs/Kconfig
fs/btrfs/bio.c
fs/btrfs/sysfs.c
fs/btrfs/volumes.h

index d88eb836a1931ac1c8034c7d724aae874f25bbaf..423122786a93466793fb58f0fb287b5d27c77f0a 100644 (file)
@@ -104,9 +104,6 @@ config BTRFS_EXPERIMENTAL
 
          - send stream protocol v3 - fs-verity support
 
-         - checksum offload mode - sysfs knob to affect when checksums are
-                                   calculated (at IO time, or in a thread)
-
          - raid-stripe-tree - additional mapping of extents to devices to
                               support RAID1* profiles on zoned devices,
                               RAID56 not yet supported
index a12446aa0fbf7ad6c4329c8303bf20933390be1e..d46f399964690e54fe9a8a116bfc7c240beb15eb 100644 (file)
@@ -665,11 +665,6 @@ static bool should_async_write(struct btrfs_bio *bbio)
        bool auto_csum_mode = true;
 
 #ifdef CONFIG_BTRFS_EXPERIMENTAL
-       struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;
-       enum btrfs_offload_csum_mode csum_mode = READ_ONCE(fs_devices->offload_csum_mode);
-
-       if (csum_mode == BTRFS_OFFLOAD_CSUM_FORCE_ON)
-               return true;
        /*
         * Write bios will calculate checksum and submit bio at the same time.
         * Unless explicitly required don't offload serial csum calculate and bio
index f0974f4c0ae45e4583214b89d38f1960c947f600..ebd6d1d6778ba76c6e2354f1f214317bb01ae9a7 100644 (file)
@@ -1538,47 +1538,6 @@ static ssize_t btrfs_bg_reclaim_threshold_store(struct kobject *kobj,
 BTRFS_ATTR_RW(, bg_reclaim_threshold, btrfs_bg_reclaim_threshold_show,
              btrfs_bg_reclaim_threshold_store);
 
-#ifdef CONFIG_BTRFS_EXPERIMENTAL
-static ssize_t btrfs_offload_csum_show(struct kobject *kobj,
-                                      struct kobj_attribute *a, char *buf)
-{
-       struct btrfs_fs_devices *fs_devices = to_fs_devs(kobj);
-
-       switch (READ_ONCE(fs_devices->offload_csum_mode)) {
-       case BTRFS_OFFLOAD_CSUM_AUTO:
-               return sysfs_emit(buf, "auto\n");
-       case BTRFS_OFFLOAD_CSUM_FORCE_ON:
-               return sysfs_emit(buf, "1\n");
-       case BTRFS_OFFLOAD_CSUM_FORCE_OFF:
-               return sysfs_emit(buf, "0\n");
-       default:
-               WARN_ON(1);
-               return -EINVAL;
-       }
-}
-
-static ssize_t btrfs_offload_csum_store(struct kobject *kobj,
-                                       struct kobj_attribute *a, const char *buf,
-                                       size_t len)
-{
-       struct btrfs_fs_devices *fs_devices = to_fs_devs(kobj);
-       int ret;
-       bool val;
-
-       ret = kstrtobool(buf, &val);
-       if (ret == 0)
-               WRITE_ONCE(fs_devices->offload_csum_mode,
-                          val ? BTRFS_OFFLOAD_CSUM_FORCE_ON : BTRFS_OFFLOAD_CSUM_FORCE_OFF);
-       else if (ret == -EINVAL && sysfs_streq(buf, "auto"))
-               WRITE_ONCE(fs_devices->offload_csum_mode, BTRFS_OFFLOAD_CSUM_AUTO);
-       else
-               return -EINVAL;
-
-       return len;
-}
-BTRFS_ATTR_RW(, offload_csum, btrfs_offload_csum_show, btrfs_offload_csum_store);
-#endif
-
 /*
  * Per-filesystem information and stats.
  *
@@ -1598,9 +1557,6 @@ static const struct attribute *btrfs_attrs[] = {
        BTRFS_ATTR_PTR(, bg_reclaim_threshold),
        BTRFS_ATTR_PTR(, commit_stats),
        BTRFS_ATTR_PTR(, temp_fsid),
-#ifdef CONFIG_BTRFS_EXPERIMENTAL
-       BTRFS_ATTR_PTR(, offload_csum),
-#endif
        NULL,
 };
 
index f20abeb16bce749e2d67b07e3c0c1ae80c2e5867..262526657cdf7ee28344a31964d9b91228f6a8f9 100644 (file)
@@ -321,25 +321,6 @@ enum btrfs_read_policy {
        BTRFS_NR_READ_POLICY,
 };
 
-#ifdef CONFIG_BTRFS_EXPERIMENTAL
-/*
- * Checksum mode - offload it to workqueues or do it synchronously in
- * btrfs_submit_chunk().
- */
-enum btrfs_offload_csum_mode {
-       /*
-        * Choose offloading checksum or do it synchronously automatically.
-        * Do it synchronously if the checksum is fast, or offload to workqueues
-        * otherwise.
-        */
-       BTRFS_OFFLOAD_CSUM_AUTO,
-       /* Always offload checksum to workqueues. */
-       BTRFS_OFFLOAD_CSUM_FORCE_ON,
-       /* Never offload checksum to workqueues. */
-       BTRFS_OFFLOAD_CSUM_FORCE_OFF,
-};
-#endif
-
 struct btrfs_fs_devices {
        u8 fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */
 
@@ -466,9 +447,6 @@ struct btrfs_fs_devices {
 
        /* Device to be used for reading in case of RAID1. */
        u64 read_devid;
-
-       /* Checksum mode - offload it or do it synchronously. */
-       enum btrfs_offload_csum_mode offload_csum_mode;
 #endif
 };