[PATCH v2 1/2] btrfs: tag tree block repair writes with REQ_META
From: Mark Korenberg via B4 Relay
Date: Fri Nov 06 2026 - 12:33:31 EST
From: Mark Korenberg <socketpair@xxxxxxxxx>
When a tree block read finds a bad copy, btrfs_repair_eb_io_failure()
rewrites it from a good one through btrfs_repair_bbio_failure(). That
rewrite is a plain REQ_OP_WRITE | REQ_SYNC, while the read that found
the bad copy and all other tree block writes carry REQ_META.
Tag it with REQ_META when the bbio belongs to the btree inode.
Signed-off-by: Mark Korenberg <socketpair@xxxxxxxxx>
---
fs/btrfs/bio.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c
index 2e12a6d7e16f..efbce4d549ff 100644
--- a/fs/btrfs/bio.c
+++ b/fs/btrfs/bio.c
@@ -951,7 +951,8 @@ int btrfs_repair_bbio_failure(struct btrfs_bio *bbio, const struct bvec_iter *or
}
repair_bio = bio_alloc(smap.dev->bdev, max(1, length >> PAGE_SHIFT),
- REQ_OP_WRITE | REQ_SYNC, GFP_NOFS);
+ REQ_OP_WRITE | REQ_SYNC |
+ (is_data_inode(inode) ? 0 : REQ_META), GFP_NOFS);
repair_bio->bi_iter.bi_sector = smap.physical >> SECTOR_SHIFT;
while (cur < length) {
struct page *page = bio_iter_page(&bbio->bio, iter);
--
2.56.0