xfs
[Top] [All Lists]

Re: [PATCH v4 5/7] fs: prioritize and separate direct_io from dax_io

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>, Vishal Verma <vishal.l.verma@xxxxxxxxx>
Subject: Re: [PATCH v4 5/7] fs: prioritize and separate direct_io from dax_io
From: Vishal Verma <vishal@xxxxxxxxxx>
Date: Mon, 02 May 2016 09:45:35 -0600
Cc: linux-nvdimm@xxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx, linux-block@xxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx, linux-ext4@xxxxxxxxxxxxxxx, linux-mm@xxxxxxxxx, Matthew Wilcox <matthew@xxxxxx>, Ross Zwisler <ross.zwisler@xxxxxxxxxxxxxxx>, Dan Williams <dan.j.williams@xxxxxxxxx>, Dave Chinner <david@xxxxxxxxxxxxx>, Jan Kara <jack@xxxxxxx>, Jens Axboe <axboe@xxxxxx>, Al Viro <viro@xxxxxxxxxxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, Jeff Moyer <jmoyer@xxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20160502145606.GD20589@xxxxxxxxxxxxx>
References: <1461878218-3844-1-git-send-email-vishal.l.verma@xxxxxxxxx> <1461878218-3844-6-git-send-email-vishal.l.verma@xxxxxxxxx> <20160502145606.GD20589@xxxxxxxxxxxxx>
On Mon, 2016-05-02 at 07:56 -0700, Christoph Hellwig wrote:
> > 
> > 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.

Do you mean to say remove the last 'else' clause entirely?
I agree that it should never be hit, which is why it is a WARN..
But I'm happy to remove it.

> 
> > 
> > --- 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.

Will do.

> 
> > 
> > +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.

Ok. So check the flags directly where needed?

> --
> To unsubscribe from this list: send the line "unsubscribe linux-
> block" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info atÂÂhttp://vger.kernel.org/majordomo-info.html

<Prev in Thread] Current Thread [Next in Thread>