/* Must follow the order as in enum btrfs_read_policy */
static const char * const btrfs_read_policy_name[] = { "pid", "latency",
- "device", "load", "roundrobin", "random", "burst" };
+ "device", "load", "roundrobin", "random" };
static ssize_t btrfs_read_policy_show(struct kobject *kobj,
struct kobj_attribute *a, char *buf)
fs_devs->read_policy_load_rotating_inc =
BTRFS_DEFAULT_READ_POLICY_LOAD_ROTATING_INC;
- fs_devs->read_policy_burst = BTRFS_DEFAULT_READ_POLICY_RR_BURST;
-
return fs_devs;
}
return preferred_mirror;
}
-static int policy_burst(struct btrfs_fs_info *fs_info, struct map_lookup *map,
- int first, int num_stripes)
-{
- int index;
- const u32 burst = READ_ONCE(fs_info->fs_devices->read_policy_burst);
-
- for (index = first; index < first + num_stripes; index++) {
- struct btrfs_device *device = map->stripes[index].dev;
-
- if (device->read_burst < burst) {
- device->read_burst++;
- return index;
- }
- }
-
- /* No suitable device found, reset state */
- for (index = first; index < first + num_stripes; index++) {
- struct btrfs_device *device = map->stripes[index].dev;
-
- device->read_burst = 0;
- }
-
- return first;
-}
-
static int find_live_mirror(struct btrfs_fs_info *fs_info,
struct map_lookup *map, int first,
int dev_replace_is_ongoing)
case BTRFS_READ_POLICY_RANDOM:
preferred_mirror = (first + prandom_u32_max(num_stripes)) % num_stripes;
break;
- case BTRFS_READ_POLICY_RR_BURST:
- preferred_mirror = policy_burst(fs_info, map, first, num_stripes);
- break;
}
if (dev_replace_is_ongoing &&
/* I/O stats for raid1 mirror selection */
struct percpu_counter inflight;
-
- /* Burst stats for policy burst */
- u32 read_burst;
};
/*
BTRFS_READ_POLICY_ROUNDROBIN,
/* Select mirror randomly */
BTRFS_READ_POLICY_RANDOM,
- /* Round robin with configurable burst to a device before switching */
- BTRFS_READ_POLICY_RR_BURST,
BTRFS_NR_READ_POLICY,
};
/* Default duration in the roundrobin read policy (100 ms) */
#define BTRFS_DEFAULT_READ_POLICY_ROUNDROBIN_DURATION 100
-/* Default burst count before anoter mirror is selected */
-#define BTRFS_DEFAULT_READ_POLICY_RR_BURST 50
-
struct btrfs_fs_devices {
u8 fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */
u8 metadata_uuid[BTRFS_FSID_SIZE];
u32 read_policy_load_rotating_inc;
/* Configuration specific for the roundrobin read policy */
u32 read_policy_roundrobin_duration;
- /* Configurable burst count for read policy burst */
- u32 read_policy_burst;
};
#define BTRFS_BIO_INLINE_CSUM_SIZE 64