diff mbox series

[5/7] btrfs: never return true for reads in btrfs_use_zone_append

Message ID 20221212073724.12637-6-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [1/7] btrfs: use file_offset to limit bios size in calc_bio_boundaries | expand

Commit Message

Christoph Hellwig Dec. 12, 2022, 7:37 a.m. UTC
Using Zone Append only makes sense for writes to the device, so check
that in btrfs_use_zone_append.  This avoids the possibility of
artificially limited read size on zoned file systems.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/btrfs/zoned.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Johannes Thumshirn Dec. 12, 2022, 12:02 p.m. UTC | #1
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
diff mbox series

Patch

diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index 77f453005dc924..af063089ad3465 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -1636,6 +1636,9 @@  bool btrfs_use_zone_append(struct btrfs_bio *bbio)
 	if (!is_data_inode(&inode->vfs_inode))
 		return false;
 
+	if (btrfs_op(&bbio->bio) != BTRFS_MAP_WRITE)
+		return false;
+
 	/*
 	 * Using REQ_OP_ZONE_APPNED for relocation can break assumptions on the
 	 * extent layout the relocation code has.