Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-6.4-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux

Pull btrfs fix from David Sterba:
"One regression fix.

The rewrite of scrub code in 6.4 broke device replace in zoned mode,
some of the writes could happen out of order so this had to be
adjusted for all cases"

* tag 'for-6.4-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
btrfs: zoned: fix dev-replace after the scrub rework

+32 -20
-4
fs/btrfs/bio.c
··· 811 811 goto fail; 812 812 813 813 if (dev_replace) { 814 - if (btrfs_op(&bbio->bio) == BTRFS_MAP_WRITE && btrfs_is_zoned(fs_info)) { 815 - bbio->bio.bi_opf &= ~REQ_OP_WRITE; 816 - bbio->bio.bi_opf |= REQ_OP_ZONE_APPEND; 817 - } 818 814 ASSERT(smap.dev == fs_info->dev_replace.srcdev); 819 815 smap.dev = fs_info->dev_replace.tgtdev; 820 816 }
+32 -16
fs/btrfs/scrub.c
··· 1137 1137 wake_up(&stripe->io_wait); 1138 1138 } 1139 1139 1140 + static void scrub_submit_write_bio(struct scrub_ctx *sctx, 1141 + struct scrub_stripe *stripe, 1142 + struct btrfs_bio *bbio, bool dev_replace) 1143 + { 1144 + struct btrfs_fs_info *fs_info = sctx->fs_info; 1145 + u32 bio_len = bbio->bio.bi_iter.bi_size; 1146 + u32 bio_off = (bbio->bio.bi_iter.bi_sector << SECTOR_SHIFT) - 1147 + stripe->logical; 1148 + 1149 + fill_writer_pointer_gap(sctx, stripe->physical + bio_off); 1150 + atomic_inc(&stripe->pending_io); 1151 + btrfs_submit_repair_write(bbio, stripe->mirror_num, dev_replace); 1152 + if (!btrfs_is_zoned(fs_info)) 1153 + return; 1154 + /* 1155 + * For zoned writeback, queue depth must be 1, thus we must wait for 1156 + * the write to finish before the next write. 1157 + */ 1158 + wait_scrub_stripe_io(stripe); 1159 + 1160 + /* 1161 + * And also need to update the write pointer if write finished 1162 + * successfully. 1163 + */ 1164 + if (!test_bit(bio_off >> fs_info->sectorsize_bits, 1165 + &stripe->write_error_bitmap)) 1166 + sctx->write_pointer += bio_len; 1167 + } 1168 + 1140 1169 /* 1141 1170 * Submit the write bio(s) for the sectors specified by @write_bitmap. 1142 1171 * ··· 1184 1155 { 1185 1156 struct btrfs_fs_info *fs_info = stripe->bg->fs_info; 1186 1157 struct btrfs_bio *bbio = NULL; 1187 - const bool zoned = btrfs_is_zoned(fs_info); 1188 1158 int sector_nr; 1189 1159 1190 1160 for_each_set_bit(sector_nr, &write_bitmap, stripe->nr_sectors) { ··· 1196 1168 1197 1169 /* Cannot merge with previous sector, submit the current one. */ 1198 1170 if (bbio && sector_nr && !test_bit(sector_nr - 1, &write_bitmap)) { 1199 - fill_writer_pointer_gap(sctx, stripe->physical + 1200 - (sector_nr << fs_info->sectorsize_bits)); 1201 - atomic_inc(&stripe->pending_io); 1202 - btrfs_submit_repair_write(bbio, stripe->mirror_num, dev_replace); 1203 - /* For zoned writeback, queue depth must be 1. */ 1204 - if (zoned) 1205 - wait_scrub_stripe_io(stripe); 1171 + scrub_submit_write_bio(sctx, stripe, bbio, dev_replace); 1206 1172 bbio = NULL; 1207 1173 } 1208 1174 if (!bbio) { ··· 1209 1187 ret = bio_add_page(&bbio->bio, page, fs_info->sectorsize, pgoff); 1210 1188 ASSERT(ret == fs_info->sectorsize); 1211 1189 } 1212 - if (bbio) { 1213 - fill_writer_pointer_gap(sctx, bbio->bio.bi_iter.bi_sector << 1214 - SECTOR_SHIFT); 1215 - atomic_inc(&stripe->pending_io); 1216 - btrfs_submit_repair_write(bbio, stripe->mirror_num, dev_replace); 1217 - if (zoned) 1218 - wait_scrub_stripe_io(stripe); 1219 - } 1190 + if (bbio) 1191 + scrub_submit_write_bio(sctx, stripe, bbio, dev_replace); 1220 1192 } 1221 1193 1222 1194 /*