]> git.hungrycats.org Git - linux/commitdiff
Revert "btrfs: introduce new device-state read_preferred (rebased 5.14)"
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Fri, 19 Nov 2021 04:44:38 +0000 (23:44 -0500)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Fri, 19 Nov 2021 04:44:38 +0000 (23:44 -0500)
This reverts commit 8d97fee99965895e08440bb7a0a743022a5ab570.

fs/btrfs/sysfs.c
fs/btrfs/volumes.h

index 9fda0b2937b947331f466539968fd2dd44ba06f0..ea0b4806b96905ea19ba5146f44208589b79d01f 100644 (file)
@@ -1521,63 +1521,6 @@ static ssize_t btrfs_devinfo_error_stats_show(struct kobject *kobj,
 }
 BTRFS_ATTR(devid, error_stats, btrfs_devinfo_error_stats_show);
 
-static ssize_t btrfs_devinfo_read_pref_show(struct kobject *kobj,
-                                           struct kobj_attribute *a, char *buf)
-{
-       int val;
-       struct btrfs_device *device = container_of(kobj, struct btrfs_device,
-                                                  devid_kobj);
-
-       val = !!test_bit(BTRFS_DEV_STATE_READ_PREFERRED, &device->dev_state);
-
-       return snprintf(buf, PAGE_SIZE, "%d\n", val);
-}
-
-static ssize_t btrfs_devinfo_read_pref_store(struct kobject *kobj,
-                                            struct kobj_attribute *a,
-                                            const char *buf, size_t len)
-{
-       int ret;
-       unsigned long val;
-       struct btrfs_device *device;
-
-       ret = kstrtoul(skip_spaces(buf), 0, &val);
-       if (ret)
-               return ret;
-
-       if (val != 0 && val != 1)
-               return -EINVAL;
-
-       /*
-        * lock is not required, the btrfs_device struct can't be freed while
-        * its kobject btrfs_device::devid_kobj is still open.
-        */
-       device = container_of(kobj, struct btrfs_device, devid_kobj);
-
-       if (val &&
-           !test_bit(BTRFS_DEV_STATE_READ_PREFERRED, &device->dev_state)) {
-               set_bit(BTRFS_DEV_STATE_READ_PREFERRED, &device->dev_state);
-               btrfs_info(device->fs_devices->fs_info,
-                          "set read preferred on devid %llu (%d)",
-                          device->devid, task_pid_nr(current));
-       } else if (!val &&
-                  test_bit(BTRFS_DEV_STATE_READ_PREFERRED, &device->dev_state)) {
-               clear_bit(BTRFS_DEV_STATE_READ_PREFERRED, &device->dev_state);
-               btrfs_info(device->fs_devices->fs_info,
-                          "reset read preferred on devid %llu (%d)",
-                          device->devid, task_pid_nr(current));
-       }
-
-       return len;
-}
-BTRFS_ATTR_RW(devid, read_preferred, btrfs_devinfo_read_pref_show,
-             btrfs_devinfo_read_pref_store);
-
-/*
- * Information about one device.
- *
- * Path: /sys/fs/btrfs/<uuid>/devinfo/<devid>/
- */
 static struct attribute *devid_attrs[] = {
        BTRFS_ATTR_PTR(devid, error_stats),
        BTRFS_ATTR_PTR(devid, in_fs_metadata),
@@ -1586,7 +1529,6 @@ static struct attribute *devid_attrs[] = {
        BTRFS_ATTR_PTR(devid, scrub_speed_max),
        BTRFS_ATTR_PTR(devid, writeable),
        BTRFS_ATTR_PTR(devid, type),
-       BTRFS_ATTR_PTR(devid, read_preferred),
        NULL
 };
 ATTRIBUTE_GROUPS(devid);
index 8f1794aaf6ba2c1b7dcb8302d58775a6a806e186..088d46887cee2b80e9fb1445835957f373d3af71 100644 (file)
@@ -51,7 +51,6 @@ struct btrfs_io_geometry {
 #define BTRFS_DEV_STATE_REPLACE_TGT    (3)
 #define BTRFS_DEV_STATE_FLUSH_SENT     (4)
 #define BTRFS_DEV_STATE_NO_READA       (5)
-#define BTRFS_DEV_STATE_READ_PREFERRED (6)
 
 struct btrfs_zoned_device_info;