[v5,07/28] btrfs: disable fallocate in HMZONED mode
diff mbox series

Message ID 20191204081735.852438-8-naohiro.aota@wdc.com
State New
Headers show
  • btrfs: zoned block device support
Related show

Commit Message

Naohiro Aota Dec. 4, 2019, 8:17 a.m. UTC
fallocate() is implemented by reserving actual extent instead of
reservations. This can result in exposing the sequential write constraint
of host-managed zoned block devices to the application, which would break
the POSIX semantic for the fallocated file.  To avoid this, report
fallocate() as not supported when in HMZONED mode for now.

In the future, we may be able to implement "in-memory" fallocate() in
HMZONED mode by utilizing space_info->bytes_may_use or so.

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
 fs/btrfs/file.c | 4 ++++
 1 file changed, 4 insertions(+)


Johannes Thumshirn Dec. 5, 2019, 8 a.m. UTC | #1
Looks good,
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>

diff mbox series

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 0cb43b682789..22373d00428b 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -3170,6 +3170,10 @@  static long btrfs_fallocate(struct file *file, int mode,
 	alloc_end = round_up(offset + len, blocksize);
 	cur_offset = alloc_start;
+	/* Do not allow fallocate in HMZONED mode */
+	if (btrfs_fs_incompat(btrfs_sb(inode->i_sb), HMZONED))
+		return -EOPNOTSUPP;
 	/* Make sure we aren't being give some crap mode */