[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160502145606.GD20589@infradead.org>
Date: Mon, 2 May 2016 07:56:06 -0700
From: Christoph Hellwig <hch@...radead.org>
To: Vishal Verma <vishal.l.verma@...el.com>
Cc: linux-nvdimm@...1.01.org, linux-fsdevel@...r.kernel.org,
linux-block@...r.kernel.org, xfs@....sgi.com,
linux-ext4@...r.kernel.org, linux-mm@...ck.org,
Matthew Wilcox <matthew@....cx>,
Ross Zwisler <ross.zwisler@...ux.intel.com>,
Dan Williams <dan.j.williams@...el.com>,
Dave Chinner <david@...morbit.com>, Jan Kara <jack@...e.cz>,
Jens Axboe <axboe@...com>, Al Viro <viro@...iv.linux.org.uk>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org,
Christoph Hellwig <hch@...radead.org>,
Jeff Moyer <jmoyer@...hat.com>
Subject: Re: [PATCH v4 5/7] fs: prioritize and separate direct_io from dax_io
> index 79defba..97a1f5f 100644
> --- a/fs/block_dev.c
> +++ b/fs/block_dev.c
> @@ -167,12 +167,21 @@ blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, loff_t offset)
> struct file *file = iocb->ki_filp;
> struct inode *inode = bdev_file_inode(file);
>
> - if (IS_DAX(inode))
> + if (iocb_is_direct(iocb))
> + return __blockdev_direct_IO(iocb, inode, I_BDEV(inode), iter,
> + offset, blkdev_get_block, NULL,
> + NULL, DIO_SKIP_DIO_COUNT);
> + else if (iocb_is_dax(iocb))
> return dax_do_io(iocb, inode, iter, offset, blkdev_get_block,
> NULL, DIO_SKIP_DIO_COUNT);
> - return __blockdev_direct_IO(iocb, inode, I_BDEV(inode), iter, offset,
> - blkdev_get_block, NULL, NULL,
> - DIO_SKIP_DIO_COUNT);
> + else {
> + /*
> + * If we're in the direct_IO path, either the IOCB_DIRECT or
> + * IOCB_DAX flags must be set.
> + */
> + WARN_ONCE(1, "Kernel Bug with iocb flags\n");
> + return -ENXIO;
> + }
DAX should not even end up in ->direct_IO.
> --- a/fs/xfs/xfs_file.c
> +++ b/fs/xfs/xfs_file.c
> @@ -300,7 +300,7 @@ xfs_file_read_iter(
>
> XFS_STATS_INC(mp, xs_read_calls);
>
> - if (unlikely(iocb->ki_flags & IOCB_DIRECT))
> + if (unlikely(iocb->ki_flags & (IOCB_DIRECT | IOCB_DAX)))
> ioflags |= XFS_IO_ISDIRECT;
please also add a XFS_IO_ISDAX flag to propagate the information
properly and allow tracing to display the actual I/O type.
> +static inline bool iocb_is_dax(struct kiocb *iocb)
> {
> + return IS_DAX(file_inode(iocb->ki_filp)) &&
> + (iocb->ki_flags & IOCB_DAX);
> +}
> +
> +static inline bool iocb_is_direct(struct kiocb *iocb)
> +{
> + return iocb->ki_flags & IOCB_DIRECT;
> }
No need for these helpers - especially as IOCB_DAX should never be set
if IS_DAX is false.
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists