Skip to content

[6.12] Track btrfs patches #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 36 commits into
base: base-6.12
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 9 additions & 0 deletions fs/btrfs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ config BTRFS_ASSERT

If unsure, say N.

config BTRFS_EXPERIMENTAL
bool "Btrfs experimental features"
depends on BTRFS_FS
help
Enable experimental features. These features may not be stable enough
for end users. This is meant for btrfs developers only.

If unsure, say N.

config BTRFS_FS_REF_VERIFY
bool "Btrfs with the ref verify tool compiled in"
depends on BTRFS_FS
Expand Down
3 changes: 2 additions & 1 deletion fs/btrfs/backref.c
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,7 @@ static int add_inline_refs(struct btrfs_backref_walk_ctx *ctx,
if (ret)
return ret;
ptr += btrfs_extent_inline_ref_size(type);
cond_resched();
}

return 0;
Expand Down Expand Up @@ -1230,7 +1231,7 @@ static int add_keyed_refs(struct btrfs_backref_walk_ctx *ctx,
}
if (ret)
return ret;

cond_resched();
}

return ret;
Expand Down
8 changes: 8 additions & 0 deletions fs/btrfs/bio.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,14 @@ static void btrfs_submit_dev_bio(struct btrfs_device *dev, struct bio *bio)
(unsigned long)dev->bdev->bd_dev, btrfs_dev_name(dev),
dev->devid, bio->bi_iter.bi_size);

/*
* Track reads if tracking is enabled; ignore I/O operations before
* fully initialized.
*/
if (dev->fs_devices->fs_stats && bio_op(bio) == REQ_OP_READ && dev->fs_info)
percpu_counter_add(&dev->fs_info->stats_read_blocks,
bio->bi_iter.bi_size >> dev->fs_info->sectorsize_bits);

if (bio->bi_opf & REQ_BTRFS_CGROUP_PUNT)
blkcg_punt_bio_submit(bio);
else
Expand Down
6 changes: 6 additions & 0 deletions fs/btrfs/disk-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,7 @@ void btrfs_free_fs_info(struct btrfs_fs_info *fs_info)
{
struct percpu_counter *em_counter = &fs_info->evictable_extent_maps;

percpu_counter_destroy(&fs_info->stats_read_blocks);
percpu_counter_destroy(&fs_info->dirty_metadata_bytes);
percpu_counter_destroy(&fs_info->delalloc_bytes);
percpu_counter_destroy(&fs_info->ordered_bytes);
Expand Down Expand Up @@ -2858,6 +2859,10 @@ static int init_mount_fs_info(struct btrfs_fs_info *fs_info, struct super_block
if (ret)
return ret;

ret = percpu_counter_init(&fs_info->stats_read_blocks, 0, GFP_KERNEL);
if (ret)
return ret;

fs_info->dirty_metadata_batch = PAGE_SIZE *
(1 + ilog2(nr_cpu_ids));

Expand Down Expand Up @@ -3324,6 +3329,7 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
fs_info->sectors_per_page = (PAGE_SIZE >> fs_info->sectorsize_bits);
fs_info->csums_per_leaf = BTRFS_MAX_ITEM_SIZE(fs_info) / fs_info->csum_size;
fs_info->stripesize = stripesize;
fs_info->fs_devices->fs_info = fs_info;

/*
* Handle the space caching options appropriately now that we have the
Expand Down
3 changes: 3 additions & 0 deletions fs/btrfs/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,9 @@ struct btrfs_fs_info {
struct kobject *qgroups_kobj;
struct kobject *discard_kobj;

/* Track the number of blocks (sectors) read by the filesystem. */
struct percpu_counter stats_read_blocks;

/* Used to keep from writing metadata until there is a nice batch */
struct percpu_counter dirty_metadata_bytes;
struct percpu_counter delalloc_bytes;
Expand Down
18 changes: 18 additions & 0 deletions fs/btrfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -2468,6 +2468,9 @@ static __cold void btrfs_interface_exit(void)
static int __init btrfs_print_mod_info(void)
{
static const char options[] = ""
#ifdef CONFIG_BTRFS_EXPERIMENTAL
", experimental=on"
#endif
#ifdef CONFIG_BTRFS_DEBUG
", debug=on"
#endif
Expand All @@ -2488,7 +2491,17 @@ static int __init btrfs_print_mod_info(void)
", fsverity=no"
#endif
;

#ifdef CONFIG_BTRFS_EXPERIMENTAL
if (btrfs_get_mod_read_policy() == NULL)
pr_info("Btrfs loaded%s\n", options);
else
pr_info("Btrfs loaded%s, read_policy=%s\n",
options, btrfs_get_mod_read_policy());
#else
pr_info("Btrfs loaded%s\n", options);
#endif

return 0;
}

Expand Down Expand Up @@ -2546,6 +2559,11 @@ static const struct init_sequence mod_init_seq[] = {
}, {
.init_func = extent_map_init,
.exit_func = extent_map_exit,
#ifdef CONFIG_BTRFS_EXPERIMENTAL
}, {
.init_func = btrfs_read_policy_init,
.exit_func = NULL,
#endif
}, {
.init_func = ordered_data_init,
.exit_func = ordered_data_exit,
Expand Down
Loading