Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
5e49c78
btrfs: add flags to give an hint to the chunk allocator
kreijack Oct 24, 2021
160344a
btrfs: export dev_item.type in /sys/fs/btrfs/<uuid>/devinfo/<devid>/type
kreijack Oct 24, 2021
29637f2
btrfs: change the DEV_ITEM 'type' field via sysfs
kreijack Oct 24, 2021
970b99e
btrfs: add allocator_hint mode
kreijack Oct 24, 2021
1c1f2e2
btrfs: add allocator_hint for no allocation preferred
kakra Jun 27, 2024
82553ef
btrfs: add allocator_hint to disable allocation completely
kakra Dec 5, 2024
10248db
btrfs: simplify output formatting in btrfs_read_policy_show
asj Jan 1, 2025
4a49a27
btrfs: initialize fs_devices->fs_info earlier
asj Jan 1, 2025
ccb2922
btrfs: add btrfs_read_policy_to_enum helper and refactor read policy …
asj Jan 1, 2025
cf73e90
btrfs: add tracking of read blocks for read policy
asj Jan 1, 2025
7070070
btrfs: introduce CONFIG_BTRFS_EXPERIMENTAL from 6.13
kakra Sep 16, 2024
3efa6c7
btrfs: handle value associated with read policy parameter
asj Jan 1, 2025
6f1b9b1
btrfs: introduce RAID1 round-robin read balancing
kakra May 2, 2025
6fcee9b
btrfs: add RAID1 preferred read device
asj Jan 1, 2025
b627950
btrfs: expose experimental mode in module information
asj Jan 1, 2025
108c5e8
btrfs: enable read policy configuration via modprobe parameter
asj Jan 1, 2025
b2c5980
btrfs: modload to print read policy status
asj Jan 1, 2025
65b747f
btrfs: use the path with the lowest latency for RAID1 reads
asj Oct 11, 2024
a6dfeed
btrfs: move latency-based selection into helper
kakra Apr 9, 2025
c9b6612
btrfs: fix btrfs_read_rr to use the actual number of stripes
kakra Apr 9, 2025
5aa9fb5
btrfs: create a helper instead of open coding device latency calculation
kakra Apr 15, 2025
a451102
btrfs: add filtering by latency to btrfs_read_rr
kakra Apr 14, 2025
9e88f8e
btrfs: add hybrid latency-rr read policy
kakra Apr 18, 2025
eee7666
btrfs: add devinfo read stats to sysfs
kakra Apr 16, 2025
7437625
btrfs: add last IO age to sysfs read_stats
kakra Apr 16, 2025
7c776c2
btrfs: probe read latency if device is 1000 IOs behind its siblings
kakra Apr 16, 2025
fbeb5da
btrfs: allow a short burst of IO for probing read latency
kakra Apr 17, 2025
919eaf1
btrfs: use checkpoint latency instead of cumulative latency
kakra Apr 20, 2025
6f8dc12
btrfs: stat latency checkpoints to get more insight
kakra Apr 20, 2025
18c0ef0
btrfs: rename thresholds to better match with the checkpoint logic
kakra Apr 20, 2025
f4f2455
btrfs: add a stripe ignored counter
kakra Apr 20, 2025
db46d71
btrfs: tune age and burst for latency checkpoint
kakra Apr 21, 2025
504aea7
btrfs: add in-flight queue read policy
kakra Apr 25, 2025
e905c0c
btrfs: guard access to bdev in latency stats and inflight calculation
kakra Apr 27, 2025
740955e
btrfs: reduce atomic reads where possible in btrfs_device_read_latency
kakra May 1, 2025
abf6174
TEST: btrfs: btrfs_backref_resched.patch
fdmanana Jun 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
btrfs: allow a short burst of IO for probing read latency
If we do a probe to detect the current read latency of the device,
allow a short burst of IO so we don't just do single IO requests which
are probably not a realistic measurement anyways and won't have any
useful impact on the cumulative average.

Tests show that this returns device to their expected average latency
performance after some hours after a latency spike, and allows them to
become part of the round-robin again.

Signed-off-by: Kai Krakow <[email protected]>
  • Loading branch information
kakra committed May 2, 2025
commit fbeb5da9618e4fcb138f64db19d7769296eefb2c
4 changes: 2 additions & 2 deletions fs/btrfs/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2192,9 +2192,9 @@ static ssize_t btrfs_devinfo_read_stats_show(struct kobject *kobj,
if (read_wait && read_ios && read_wait >= read_ios)
avg_wait = div_u64(read_wait, read_ios);

return scnprintf(buf, PAGE_SIZE, "ios %lu wait %llu avg %llu age %llu\n",
return scnprintf(buf, PAGE_SIZE, "ios %lu wait %llu avg %llu age %lld\n",
read_ios, read_wait, avg_wait,
(u64)atomic64_read(&device->last_io_age));
atomic64_read(&device->last_io_age));
}
BTRFS_ATTR(devid, read_stats, btrfs_devinfo_read_stats_show);
#endif
Expand Down
16 changes: 14 additions & 2 deletions fs/btrfs/volumes.c
Original file line number Diff line number Diff line change
Expand Up @@ -6021,7 +6021,7 @@ static u64 btrfs_device_read_latency(struct btrfs_device *device)
u64 last_io_age = (u64)atomic64_read(&device->last_io_age);
u64 avg_wait = 0;

if (last_io_age < BTRFS_MAX_AGE_FOR_VALID_LATENCY
if (last_io_age >= 0 && last_io_age < BTRFS_MAX_AGE_FOR_VALID_LATENCY
&& read_wait && read_ios && read_wait >= read_ios)
avg_wait = div_u64(read_wait, read_ios);

Expand Down Expand Up @@ -6174,6 +6174,7 @@ static int btrfs_read_fastest_rr(struct btrfs_fs_info *fs_info,
}
#endif

#define BTRFS_OLD_AGE_IO_BURST 20
static int find_live_mirror(struct btrfs_fs_info *fs_info,
struct btrfs_chunk_map *map, int first,
int dev_replace_is_ongoing)
Expand Down Expand Up @@ -6256,7 +6257,18 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
out:
#ifdef CONFIG_BTRFS_EXPERIMENTAL
/* reset age of selected stripe */
atomic64_set(&map->stripes[preferred_mirror].dev->last_io_age, 0);
s64 current_age, new_age;
do {
current_age = atomic64_read(&map->stripes[preferred_mirror].dev->last_io_age);

if (current_age >= BTRFS_MAX_AGE_FOR_VALID_LATENCY) {
new_age = -BTRFS_OLD_AGE_IO_BURST;
} else if (current_age >= 0) {
new_age = 0;
} else {
return preferred_mirror;
}
} while (unlikely(atomic64_cmpxchg(&map->stripes[preferred_mirror].dev->last_io_age, current_age, new_age) != current_age));
#endif

/* we couldn't find one that doesn't fail. Just return something
Expand Down