[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180809180450.5091-6-naota@elisp.net>
Date: Fri, 10 Aug 2018 03:04:38 +0900
From: Naohiro Aota <naota@...sp.net>
To: David Sterba <dsterba@...e.com>, linux-btrfs@...r.kernel.org
Cc: Chris Mason <clm@...com>, Josef Bacik <jbacik@...com>,
linux-kernel@...r.kernel.org, Hannes Reinecke <hare@...e.com>,
Damien Le Moal <damien.lemoal@....com>,
Bart Van Assche <bart.vanassche@....com>,
Matias Bjorling <mb@...htnvm.io>,
Naohiro Aota <naota@...sp.net>
Subject: [RFC PATCH 05/17] btrfs: disable fallocate in HMZONED mode
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.
Signed-off-by: Naohiro Aota <naota@...sp.net>
---
fs/btrfs/file.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 095f0bb86bb7..6f4546ccb57d 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -2993,6 +2993,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 */
if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE |
FALLOC_FL_ZERO_RANGE))
--
2.18.0
Powered by blists - more mailing lists