[05/19] btrfs: disable direct IO in HMZONED mode
diff mbox series

Message ID 20190607131025.31996-6-naohiro.aota@wdc.com
State New
Headers show
Series
  • btrfs zoned block device support
Related show

Commit Message

Naohiro Aota June 7, 2019, 1:10 p.m. UTC
Direct write I/Os can be directed at existing extents that have already
been written. Such write requests are prohibited on host-managed zoned
block devices. So disable direct IO support for a volume with HMZONED mode
enabled.

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

Comments

Josef Bacik June 13, 2019, 2 p.m. UTC | #1
On Fri, Jun 07, 2019 at 10:10:11PM +0900, Naohiro Aota wrote:
> Direct write I/Os can be directed at existing extents that have already
> been written. Such write requests are prohibited on host-managed zoned
> block devices. So disable direct IO support for a volume with HMZONED mode
> enabled.
> 

That's only if we're nocow, so seems like you only need to disable DIO into
nocow regions with hmzoned?  Thanks,

Josef
Naohiro Aota June 18, 2019, 8:17 a.m. UTC | #2
On 2019/06/13 23:00, Josef Bacik wrote:
> On Fri, Jun 07, 2019 at 10:10:11PM +0900, Naohiro Aota wrote:
>> Direct write I/Os can be directed at existing extents that have already
>> been written. Such write requests are prohibited on host-managed zoned
>> block devices. So disable direct IO support for a volume with HMZONED mode
>> enabled.
>>
> 
> That's only if we're nocow, so seems like you only need to disable DIO into
> nocow regions with hmzoned?  Thanks,
> 
> Josef
> 

True. And actually, I had to disable or ignore BTRFS_INODE_NODATACOW on HMZONED.
I'll replace this patch with that one.
Thanks,

Patch
diff mbox series

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 6bebc0ca751d..89542c19d09e 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8520,6 +8520,9 @@  static ssize_t check_direct_IO(struct btrfs_fs_info *fs_info,
 	unsigned int blocksize_mask = fs_info->sectorsize - 1;
 	ssize_t retval = -EINVAL;
 
+	if (btrfs_fs_incompat(fs_info, HMZONED))
+		goto out;
+
 	if (offset & blocksize_mask)
 		goto out;