mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-05-24 10:39:52 +00:00
btrfs: zoned: enable zone append writing for direct IO
Likewise to buffered IO, enable zone append writing for direct IO when its used on a zoned block device. Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
d8e3fb106f
commit
544d24f9de
1 changed files with 18 additions and 0 deletions
|
@ -7738,6 +7738,9 @@ static int btrfs_dio_iomap_begin(struct inode *inode, loff_t start,
|
||||||
iomap->bdev = fs_info->fs_devices->latest_bdev;
|
iomap->bdev = fs_info->fs_devices->latest_bdev;
|
||||||
iomap->length = len;
|
iomap->length = len;
|
||||||
|
|
||||||
|
if (write && btrfs_use_zone_append(BTRFS_I(inode), em))
|
||||||
|
iomap->flags |= IOMAP_F_ZONE_APPEND;
|
||||||
|
|
||||||
free_extent_map(em);
|
free_extent_map(em);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -7964,6 +7967,8 @@ static void btrfs_end_dio_bio(struct bio *bio)
|
||||||
if (err)
|
if (err)
|
||||||
dip->dio_bio->bi_status = err;
|
dip->dio_bio->bi_status = err;
|
||||||
|
|
||||||
|
btrfs_record_physical_zoned(dip->inode, dip->logical_offset, bio);
|
||||||
|
|
||||||
bio_put(bio);
|
bio_put(bio);
|
||||||
btrfs_dio_private_put(dip);
|
btrfs_dio_private_put(dip);
|
||||||
}
|
}
|
||||||
|
@ -8124,6 +8129,19 @@ static blk_qc_t btrfs_submit_direct(struct inode *inode, struct iomap *iomap,
|
||||||
bio->bi_end_io = btrfs_end_dio_bio;
|
bio->bi_end_io = btrfs_end_dio_bio;
|
||||||
btrfs_io_bio(bio)->logical = file_offset;
|
btrfs_io_bio(bio)->logical = file_offset;
|
||||||
|
|
||||||
|
WARN_ON_ONCE(write && btrfs_is_zoned(fs_info) &&
|
||||||
|
fs_info->max_zone_append_size &&
|
||||||
|
bio_op(bio) != REQ_OP_ZONE_APPEND);
|
||||||
|
|
||||||
|
if (bio_op(bio) == REQ_OP_ZONE_APPEND) {
|
||||||
|
status = extract_ordered_extent(BTRFS_I(inode), bio,
|
||||||
|
file_offset);
|
||||||
|
if (status) {
|
||||||
|
bio_put(bio);
|
||||||
|
goto out_err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ASSERT(submit_len >= clone_len);
|
ASSERT(submit_len >= clone_len);
|
||||||
submit_len -= clone_len;
|
submit_len -= clone_len;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue