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

Skip to content
Draft
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: move latency-based selection into helper
Signed-off-by: Kai Krakow <[email protected]>
  • Loading branch information
kakra committed May 2, 2025
commit a6dfeede73e04a27f7e023d3f2f06765c37e968b
42 changes: 32 additions & 10 deletions fs/btrfs/volumes.c
Original file line number Diff line number Diff line change
Expand Up @@ -6007,15 +6007,26 @@ static int btrfs_read_preferred(struct btrfs_chunk_map *map, int first,
return first;
}

static int btrfs_best_stripe(struct btrfs_fs_info *fs_info,
struct btrfs_chunk_map *map, int first,
int num_stripe)
/*
* btrfs_best_stripe
*
* Select a stripe for reading using the average latency:
*
* 1. Compute the average latency of the device by dividing total latency
* by number of IOs.
* 2. Store minimum latency and selected stripe in best_wait / best_stripe.
*
* Will always find at least one stripe.
*/
static void btrfs_best_stripe(struct btrfs_fs_info *fs_info,
struct btrfs_chunk_map *map, int first,
int num_stripes, u64 *best_wait, int *best_stripe)
{
u64 best_wait = U64_MAX;
int best_stripe = 0;
int index;
*best_wait = U64_MAX;
*best_stripe = 0;

for (index = first; index < first + num_stripe; index++) {
for (index = first; index < first + num_stripes; index++) {
u64 read_wait;
u64 avg_wait = 0;
unsigned long read_ios;
Expand All @@ -6027,11 +6038,22 @@ static int btrfs_best_stripe(struct btrfs_fs_info *fs_info,
if (read_wait && read_ios && read_wait >= read_ios)
avg_wait = div_u64(read_wait, read_ios);

if (best_wait > avg_wait) {
best_wait = avg_wait;
best_stripe = index;
if (*best_wait > avg_wait) {
*best_wait = avg_wait;
*best_stripe = index;
}
}
}

static int btrfs_read_fastest(struct btrfs_fs_info *fs_info,
struct btrfs_chunk_map *map, int first,
int num_stripes)
{
u64 best_wait;
int best_stripe;

btrfs_best_stripe(fs_info, map, first, num_stripes, &best_wait,
&best_stripe);

return best_stripe;
}
Expand Down Expand Up @@ -6131,7 +6153,7 @@ static int find_live_mirror(struct btrfs_fs_info *fs_info,
preferred_mirror = btrfs_read_preferred(map, first, num_stripes);
break;
case BTRFS_READ_POLICY_LATENCY:
preferred_mirror = btrfs_best_stripe(fs_info, map, first,
preferred_mirror = btrfs_read_fastest(fs_info, map, first,
num_stripes);
break;
#endif
Expand Down