Skip to content

Commit 4ec434d

Browse files
committed
Merge branch 'misc-6.16' into for-next-next-v6.15-20250520
2 parents a5806cd + eeb133a commit 4ec434d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+3777
-3268
lines changed

fs/btrfs/Kconfig

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,29 +52,34 @@ config BTRFS_FS_RUN_SANITY_TESTS
5252
bool "Btrfs will run sanity tests upon loading"
5353
depends on BTRFS_FS
5454
help
55-
This will run some basic sanity tests on the free space cache
56-
code to make sure it is acting as it should. These are mostly
57-
regression tests and are only really interesting to btrfs
58-
developers.
55+
This will run sanity tests for core functionality like free space,
56+
extent maps, extent io, extent buffers, inodes, qgroups and others,
57+
at module load time. These are mostly regression tests and are only
58+
interesting to developers.
5959

6060
If unsure, say N.
6161

6262
config BTRFS_DEBUG
6363
bool "Btrfs debugging support"
6464
depends on BTRFS_FS
6565
help
66-
Enable run-time debugging support for the btrfs filesystem. This may
67-
enable additional and expensive checks with negative impact on
68-
performance, or export extra information via sysfs.
66+
Enable run-time debugging support for the btrfs filesystem.
67+
68+
Additional potentially expensive checks, debugging functionality or
69+
sysfs exported information is enabled, like leak checks of internal
70+
objects, optional forced space fragmentation and /sys/fs/btrfs/debug .
71+
This has negative impact on performance.
6972

7073
If unsure, say N.
7174

7275
config BTRFS_ASSERT
7376
bool "Btrfs assert support"
7477
depends on BTRFS_FS
7578
help
76-
Enable run-time assertion checking. This will result in panics if
77-
any of the assertions trip. This is meant for btrfs developers only.
79+
Enable run-time assertion checking. Additional safety checks are
80+
done, simple enough not to affect performance but verify invariants
81+
and assumptions of code to run properly. This may result in panics,
82+
and is meant for developers but can be enabled in general.
7883

7984
If unsure, say N.
8085

@@ -89,7 +94,14 @@ config BTRFS_EXPERIMENTAL
8994

9095
Current list:
9196

92-
- extent map shrinker - performance problems with too frequent shrinks
97+
- COW fixup worker warning - last warning before removing the
98+
functionality catching out-of-band page
99+
dirtying, not necessary since 5.8
100+
101+
- RAID mirror read policy - additional read policies for balancing
102+
reading from redundant block group
103+
profiles (currently: pid, round-robin,
104+
fixed devid)
93105

94106
- send stream protocol v3 - fs-verity support
95107

fs/btrfs/async-thread.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,7 @@ static void run_ordered_work(struct btrfs_workqueue *wq,
219219
spin_lock_irqsave(lock, flags);
220220
if (list_empty(list))
221221
break;
222-
work = list_entry(list->next, struct btrfs_work,
223-
ordered_list);
222+
work = list_first_entry(list, struct btrfs_work, ordered_list);
224223
if (!test_bit(WORK_DONE_BIT, &work->flags))
225224
break;
226225
/*

fs/btrfs/backref.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2877,7 +2877,7 @@ int btrfs_backref_iter_start(struct btrfs_backref_iter *iter, u64 bytenr)
28772877
goto release;
28782878
}
28792879
if (path->slots[0] == 0) {
2880-
WARN_ON(IS_ENABLED(CONFIG_BTRFS_DEBUG));
2880+
DEBUG_WARN();
28812881
ret = -EUCLEAN;
28822882
goto release;
28832883
}
@@ -3134,8 +3134,8 @@ void btrfs_backref_cleanup_node(struct btrfs_backref_cache *cache,
31343134
return;
31353135

31363136
while (!list_empty(&node->upper)) {
3137-
edge = list_entry(node->upper.next, struct btrfs_backref_edge,
3138-
list[LOWER]);
3137+
edge = list_first_entry(&node->upper, struct btrfs_backref_edge,
3138+
list[LOWER]);
31393139
list_del(&edge->list[LOWER]);
31403140
list_del(&edge->list[UPPER]);
31413141
btrfs_backref_free_edge(cache, edge);
@@ -3473,8 +3473,8 @@ int btrfs_backref_add_tree_node(struct btrfs_trans_handle *trans,
34733473
* type BTRFS_TREE_BLOCK_REF_KEY
34743474
*/
34753475
ASSERT(list_is_singular(&cur->upper));
3476-
edge = list_entry(cur->upper.next, struct btrfs_backref_edge,
3477-
list[LOWER]);
3476+
edge = list_first_entry(&cur->upper, struct btrfs_backref_edge,
3477+
list[LOWER]);
34783478
ASSERT(list_empty(&edge->list[UPPER]));
34793479
exist = edge->node[UPPER];
34803480
/*
@@ -3617,7 +3617,7 @@ int btrfs_backref_finish_upper_links(struct btrfs_backref_cache *cache,
36173617

36183618
/* Sanity check, we shouldn't have any unchecked nodes */
36193619
if (!upper->checked) {
3620-
ASSERT(0);
3620+
DEBUG_WARN("we should not have any unchecked nodes");
36213621
return -EUCLEAN;
36223622
}
36233623

fs/btrfs/backref.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,8 @@ struct btrfs_backref_node *btrfs_backref_alloc_node(
423423
struct btrfs_backref_edge *btrfs_backref_alloc_edge(
424424
struct btrfs_backref_cache *cache);
425425

426-
#define LINK_LOWER (1 << 0)
427-
#define LINK_UPPER (1 << 1)
426+
#define LINK_LOWER (1U << 0)
427+
#define LINK_UPPER (1U << 1)
428428

429429
void btrfs_backref_link_edge(struct btrfs_backref_edge *edge,
430430
struct btrfs_backref_node *lower,

fs/btrfs/bio.c

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ static void btrfs_end_repair_bio(struct btrfs_bio *repair_bbio,
192192
btrfs_repair_io_failure(fs_info, btrfs_ino(inode),
193193
repair_bbio->file_offset, fs_info->sectorsize,
194194
repair_bbio->saved_iter.bi_sector << SECTOR_SHIFT,
195-
page_folio(bv->bv_page), bv->bv_offset, mirror);
195+
bvec_phys(bv), mirror);
196196
} while (mirror != fbio->bbio->mirror_num);
197197

198198
done:
@@ -512,7 +512,7 @@ static void btrfs_submit_bio(struct bio *bio, struct btrfs_io_context *bioc,
512512
}
513513
}
514514

515-
static blk_status_t btrfs_bio_csum(struct btrfs_bio *bbio)
515+
static int btrfs_bio_csum(struct btrfs_bio *bbio)
516516
{
517517
if (bbio->bio.bi_opf & REQ_META)
518518
return btree_csum_one_bio(bbio);
@@ -543,11 +543,11 @@ static void run_one_async_start(struct btrfs_work *work)
543543
{
544544
struct async_submit_bio *async =
545545
container_of(work, struct async_submit_bio, work);
546-
blk_status_t ret;
546+
int ret;
547547

548548
ret = btrfs_bio_csum(async->bbio);
549549
if (ret)
550-
async->bbio->bio.bi_status = ret;
550+
async->bbio->bio.bi_status = errno_to_blk_status(ret);
551551
}
552552

553553
/*
@@ -674,19 +674,19 @@ static bool btrfs_submit_chunk(struct btrfs_bio *bbio, int mirror_num)
674674
bool use_append = btrfs_use_zone_append(bbio);
675675
struct btrfs_io_context *bioc = NULL;
676676
struct btrfs_io_stripe smap;
677-
blk_status_t ret;
678-
int error;
677+
blk_status_t status;
678+
int ret;
679679

680680
if (!bbio->inode || btrfs_is_data_reloc_root(inode->root))
681681
smap.rst_search_commit_root = true;
682682
else
683683
smap.rst_search_commit_root = false;
684684

685685
btrfs_bio_counter_inc_blocked(fs_info);
686-
error = btrfs_map_block(fs_info, btrfs_op(bio), logical, &map_length,
687-
&bioc, &smap, &mirror_num);
688-
if (error) {
689-
ret = errno_to_blk_status(error);
686+
ret = btrfs_map_block(fs_info, btrfs_op(bio), logical, &map_length,
687+
&bioc, &smap, &mirror_num);
688+
if (ret) {
689+
status = errno_to_blk_status(ret);
690690
btrfs_bio_counter_dec(fs_info);
691691
goto end_bbio;
692692
}
@@ -700,7 +700,7 @@ static bool btrfs_submit_chunk(struct btrfs_bio *bbio, int mirror_num)
700700

701701
split = btrfs_split_bio(fs_info, bbio, map_length);
702702
if (IS_ERR(split)) {
703-
ret = errno_to_blk_status(PTR_ERR(split));
703+
status = errno_to_blk_status(PTR_ERR(split));
704704
btrfs_bio_counter_dec(fs_info);
705705
goto end_bbio;
706706
}
@@ -715,7 +715,8 @@ static bool btrfs_submit_chunk(struct btrfs_bio *bbio, int mirror_num)
715715
if (bio_op(bio) == REQ_OP_READ && is_data_bbio(bbio)) {
716716
bbio->saved_iter = bio->bi_iter;
717717
ret = btrfs_lookup_bio_sums(bbio);
718-
if (ret)
718+
status = errno_to_blk_status(ret);
719+
if (status)
719720
goto fail;
720721
}
721722

@@ -748,13 +749,15 @@ static bool btrfs_submit_chunk(struct btrfs_bio *bbio, int mirror_num)
748749
goto done;
749750

750751
ret = btrfs_bio_csum(bbio);
751-
if (ret)
752+
status = errno_to_blk_status(ret);
753+
if (status)
752754
goto fail;
753755
} else if (use_append ||
754756
(btrfs_is_zoned(fs_info) && inode &&
755757
inode->flags & BTRFS_INODE_NODATASUM)) {
756758
ret = btrfs_alloc_dummy_sum(bbio);
757-
if (ret)
759+
status = errno_to_blk_status(ret);
760+
if (status)
758761
goto fail;
759762
}
760763
}
@@ -775,10 +778,10 @@ static bool btrfs_submit_chunk(struct btrfs_bio *bbio, int mirror_num)
775778
ASSERT(bbio->bio.bi_pool == &btrfs_clone_bioset);
776779
ASSERT(remaining);
777780

778-
btrfs_bio_end_io(remaining, ret);
781+
btrfs_bio_end_io(remaining, status);
779782
}
780783
end_bbio:
781-
btrfs_bio_end_io(bbio, ret);
784+
btrfs_bio_end_io(bbio, status);
782785
/* Do not submit another chunk */
783786
return true;
784787
}
@@ -803,8 +806,7 @@ void btrfs_submit_bbio(struct btrfs_bio *bbio, int mirror_num)
803806
* freeing the bio.
804807
*/
805808
int btrfs_repair_io_failure(struct btrfs_fs_info *fs_info, u64 ino, u64 start,
806-
u64 length, u64 logical, struct folio *folio,
807-
unsigned int folio_offset, int mirror_num)
809+
u64 length, u64 logical, phys_addr_t paddr, int mirror_num)
808810
{
809811
struct btrfs_io_stripe smap = { 0 };
810812
struct bio_vec bvec;
@@ -835,8 +837,7 @@ int btrfs_repair_io_failure(struct btrfs_fs_info *fs_info, u64 ino, u64 start,
835837

836838
bio_init(&bio, smap.dev->bdev, &bvec, 1, REQ_OP_WRITE | REQ_SYNC);
837839
bio.bi_iter.bi_sector = smap.physical >> SECTOR_SHIFT;
838-
ret = bio_add_folio(&bio, folio, length, folio_offset);
839-
ASSERT(ret);
840+
__bio_add_page(&bio, phys_to_page(paddr), length, offset_in_page(paddr));
840841
ret = submit_bio_wait(&bio);
841842
if (ret) {
842843
/* try to remap that extent elsewhere? */
@@ -900,22 +901,18 @@ int __init btrfs_bioset_init(void)
900901
return -ENOMEM;
901902
if (bioset_init(&btrfs_clone_bioset, BIO_POOL_SIZE,
902903
offsetof(struct btrfs_bio, bio), 0))
903-
goto out_free_bioset;
904+
goto out;
904905
if (bioset_init(&btrfs_repair_bioset, BIO_POOL_SIZE,
905906
offsetof(struct btrfs_bio, bio),
906907
BIOSET_NEED_BVECS))
907-
goto out_free_clone_bioset;
908+
goto out;
908909
if (mempool_init_kmalloc_pool(&btrfs_failed_bio_pool, BIO_POOL_SIZE,
909910
sizeof(struct btrfs_failed_bio)))
910-
goto out_free_repair_bioset;
911+
goto out;
911912
return 0;
912913

913-
out_free_repair_bioset:
914-
bioset_exit(&btrfs_repair_bioset);
915-
out_free_clone_bioset:
916-
bioset_exit(&btrfs_clone_bioset);
917-
out_free_bioset:
918-
bioset_exit(&btrfs_bioset);
914+
out:
915+
btrfs_bioset_exit();
919916
return -ENOMEM;
920917
}
921918

fs/btrfs/bio.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ void btrfs_bio_end_io(struct btrfs_bio *bbio, blk_status_t status);
110110
void btrfs_submit_bbio(struct btrfs_bio *bbio, int mirror_num);
111111
void btrfs_submit_repair_write(struct btrfs_bio *bbio, int mirror_num, bool dev_replace);
112112
int btrfs_repair_io_failure(struct btrfs_fs_info *fs_info, u64 ino, u64 start,
113-
u64 length, u64 logical, struct folio *folio,
114-
unsigned int folio_offset, int mirror_num);
113+
u64 length, u64 logical, phys_addr_t paddr, int mirror_num);
115114

116115
#endif

0 commit comments

Comments
 (0)