Merge tag 'for-5.18-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
Pull btrfs fixes from David Sterba:
- direct IO fixes:
- restore passing file offset to correctly calculate checksums
when repairing on read and bio split happens
- use correct bio when sumitting IO on zoned filesystem
- zoned mode fixes:
- fix selection of device to correctly calculate device
capabilities when allocating a new bio
- use a dedicated lock for exclusion during relocation
- fix leaked plug after failure syncing log
- fix assertion during scrub and relocation
* tag 'for-5.18-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
btrfs: zoned: use dedicated lock for data relocation
btrfs: fix assertion failure during scrub due to block group reallocation
btrfs: fix direct I/O writes for split bios on zoned devices
btrfs: fix direct I/O read repair for split bios
btrfs: fix and document the zoned device choice in alloc_new_bio
btrfs: fix leaked plug after failure syncing log on zoned filesystems
This commit is contained in:
@@ -2658,6 +2658,7 @@ int btrfs_repair_one_sector(struct inode *inode,
|
||||
|
||||
repair_bio = btrfs_bio_alloc(1);
|
||||
repair_bbio = btrfs_bio(repair_bio);
|
||||
repair_bbio->file_offset = start;
|
||||
repair_bio->bi_opf = REQ_OP_READ;
|
||||
repair_bio->bi_end_io = failed_bio->bi_end_io;
|
||||
repair_bio->bi_iter.bi_sector = failrec->logical >> 9;
|
||||
@@ -3333,24 +3334,37 @@ static int alloc_new_bio(struct btrfs_inode *inode,
|
||||
ret = calc_bio_boundaries(bio_ctrl, inode, file_offset);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
|
||||
if (wbc) {
|
||||
struct block_device *bdev;
|
||||
/*
|
||||
* For Zone append we need the correct block_device that we are
|
||||
* going to write to set in the bio to be able to respect the
|
||||
* hardware limitation. Look it up here:
|
||||
*/
|
||||
if (bio_op(bio) == REQ_OP_ZONE_APPEND) {
|
||||
struct btrfs_device *dev;
|
||||
|
||||
bdev = fs_info->fs_devices->latest_dev->bdev;
|
||||
bio_set_dev(bio, bdev);
|
||||
wbc_init_bio(wbc, bio);
|
||||
}
|
||||
if (bio_op(bio) == REQ_OP_ZONE_APPEND) {
|
||||
struct btrfs_device *device;
|
||||
dev = btrfs_zoned_get_device(fs_info, disk_bytenr,
|
||||
fs_info->sectorsize);
|
||||
if (IS_ERR(dev)) {
|
||||
ret = PTR_ERR(dev);
|
||||
goto error;
|
||||
}
|
||||
|
||||
device = btrfs_zoned_get_device(fs_info, disk_bytenr,
|
||||
fs_info->sectorsize);
|
||||
if (IS_ERR(device)) {
|
||||
ret = PTR_ERR(device);
|
||||
goto error;
|
||||
bio_set_dev(bio, dev->bdev);
|
||||
} else {
|
||||
/*
|
||||
* Otherwise pick the last added device to support
|
||||
* cgroup writeback. For multi-device file systems this
|
||||
* means blk-cgroup policies have to always be set on the
|
||||
* last added/replaced device. This is a bit odd but has
|
||||
* been like that for a long time.
|
||||
*/
|
||||
bio_set_dev(bio, fs_info->fs_devices->latest_dev->bdev);
|
||||
}
|
||||
|
||||
btrfs_bio(bio)->device = device;
|
||||
wbc_init_bio(wbc, bio);
|
||||
} else {
|
||||
ASSERT(bio_op(bio) != REQ_OP_ZONE_APPEND);
|
||||
}
|
||||
return 0;
|
||||
error:
|
||||
|
||||
Reference in New Issue
Block a user