}
}
- /* put a new bio on the list */
+ /*
+ * Put a new bio on the list. Every per-device bio, data and P/Q
+ * alike, serves the bios in rbio->bio_list, so it is metadata I/O if
+ * any of them is: a tree block write, or a tree block read rebuilt
+ * from the other stripes.
+ */
bio = bio_alloc(stripe->dev->bdev,
max(BTRFS_STRIPE_LEN >> PAGE_SHIFT, 1),
- op, GFP_NOFS);
+ op | rbio->req_meta, GFP_NOFS);
bio->bi_iter.bi_sector = disk_start >> SECTOR_SHIFT;
bio->bi_private = rbio;
struct bio *bio;
spin_lock(&rbio->bio_list_lock);
- bio_list_for_each(bio, &rbio->bio_list)
+ rbio->req_meta = 0;
+ bio_list_for_each(bio, &rbio->bio_list) {
index_one_bio(rbio, bio);
+ rbio->req_meta |= bio->bi_opf & REQ_META;
+ }
spin_unlock(&rbio->bio_list_lock);
}
*/
enum btrfs_rbio_ops operation;
+ /*
+ * REQ_META if any bio in bio_list has it. Set under bio_list_lock by
+ * index_rbio_pages(), which runs before every assembly of per-device
+ * bios.
+ */
+ blk_opf_t req_meta;
+
/* How many pages there are for the full stripe including P/Q */
u16 nr_pages;