Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1176634 > unrolled thread

[PATCH v2 0/6] Miscellaneous DAX patches, take 2

Started byMatthew Wilcox <matthew.r.wilcox@intel.com>
First post2015-07-03 16:50 +0200
Last post2015-07-03 16:50 +0200
Articles 4 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 0/6] Miscellaneous DAX patches, take 2 Matthew Wilcox <matthew.r.wilcox@intel.com> - 2015-07-03 16:50 +0200
    [PATCH v2 6/6] dax: bdev_direct_access() may sleep Matthew Wilcox <matthew.r.wilcox@intel.com> - 2015-07-03 16:50 +0200
    [PATCH v2 2/6] dax: Use copy_from_iter_nocache Matthew Wilcox <matthew.r.wilcox@intel.com> - 2015-07-03 16:50 +0200
    [PATCH v2 5/6] block: Add support for DAX reads/writes to block devices Matthew Wilcox <matthew.r.wilcox@intel.com> - 2015-07-03 16:50 +0200

#1176634 — [PATCH v2 0/6] Miscellaneous DAX patches, take 2

FromMatthew Wilcox <matthew.r.wilcox@intel.com>
Date2015-07-03 16:50 +0200
Subject[PATCH v2 0/6] Miscellaneous DAX patches, take 2
Message-ID<pIarT-1ha-3@gated-at.bofh.it>
A miscellaneous set of patches to improve DAX.  All are independent of
each other.

I dropped the DAX mmap support for block devices; I started trying
to put in a sysfs toggle and ran into some difficulties, so just drop
that part of the patch for now.  There's no problem (that I know of)
with the read()/write() portion of the patch.

I fixed up the conflict between Dave Chinner's changes to ext4 and mine.

I forgot the 'bdev_direct_access() may sleep' patch in the previous
submission.

Matthew Wilcox (6):
  dax: Add block size note to documentation
  dax: Use copy_from_iter_nocache
  ext4: Use ext4_get_block_write() for DAX
  vfs: Allow truncate, chomd and chown to be interrupted by fatal
    signals
  block: Add support for DAX reads/writes to block devices
  dax: bdev_direct_access() may sleep

 Documentation/filesystems/dax.txt |  6 ++++--
 fs/block_dev.c                    | 10 ++++++++++
 fs/dax.c                          |  8 +++++---
 fs/ext4/file.c                    |  8 ++++----
 fs/open.c                         |  9 ++++++---
 5 files changed, 29 insertions(+), 12 deletions(-)

-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1176635 — [PATCH v2 6/6] dax: bdev_direct_access() may sleep

FromMatthew Wilcox <matthew.r.wilcox@intel.com>
Date2015-07-03 16:50 +0200
Subject[PATCH v2 6/6] dax: bdev_direct_access() may sleep
Message-ID<pIarU-1ha-25@gated-at.bofh.it>
In reply to#1176634
The brd driver is the only in-tree driver that may sleep currently.
After some discussion on linux-fsdevel, we decided that any driver
may choose to sleep in its ->direct_access method.  To ensure that all
callers of bdev_direct_access() are prepared for this, add a call
to might_sleep().

Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
---
 fs/block_dev.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 0bb2993..1982437 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -446,6 +446,12 @@ long bdev_direct_access(struct block_device *bdev, sector_t sector,
 	long avail;
 	const struct block_device_operations *ops = bdev->bd_disk->fops;
 
+	/*
+	 * The device driver is allowed to sleep, in order to make the
+	 * memory directly accessible.
+	 */
+	might_sleep();
+
 	if (size < 0)
 		return size;
 	if (!ops->direct_access)
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1176636 — [PATCH v2 2/6] dax: Use copy_from_iter_nocache

FromMatthew Wilcox <matthew.r.wilcox@intel.com>
Date2015-07-03 16:50 +0200
Subject[PATCH v2 2/6] dax: Use copy_from_iter_nocache
Message-ID<pIarU-1ha-27@gated-at.bofh.it>
In reply to#1176634
From: Matthew Wilcox <willy@linux.intel.com>

When userspace does a write, there's no need for the written data to
pollute the CPU cache.  This matches the original XIP code.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
---
 fs/dax.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/dax.c b/fs/dax.c
index 99b5fbc..eaa9e06 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -155,7 +155,7 @@ static ssize_t dax_io(struct inode *inode, struct iov_iter *iter,
 		}
 
 		if (iov_iter_rw(iter) == WRITE)
-			len = copy_from_iter(addr, max - pos, iter);
+			len = copy_from_iter_nocache(addr, max - pos, iter);
 		else if (!hole)
 			len = copy_to_iter(addr, max - pos, iter);
 		else
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1176637 — [PATCH v2 5/6] block: Add support for DAX reads/writes to block devices

FromMatthew Wilcox <matthew.r.wilcox@intel.com>
Date2015-07-03 16:50 +0200
Subject[PATCH v2 5/6] block: Add support for DAX reads/writes to block devices
Message-ID<pIarU-1ha-29@gated-at.bofh.it>
In reply to#1176634
If a block device supports the ->direct_access methods, bypass the normal
DIO path and use DAX to go straight to memcpy() instead of allocating
a DIO and a BIO.

Includes support for the DIO_SKIP_DIO_COUNT flag in DAX, as is done in
do_blockdev_direct_IO().

Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
---
 fs/block_dev.c | 4 ++++
 fs/dax.c       | 6 ++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 4fe10f9..0bb2993 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -152,6 +152,9 @@ blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, loff_t offset)
 	struct file *file = iocb->ki_filp;
 	struct inode *inode = file->f_mapping->host;
 
+	if (IS_DAX(inode))
+		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);
@@ -1170,6 +1173,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
 		bdev->bd_disk = disk;
 		bdev->bd_queue = disk->queue;
 		bdev->bd_contains = bdev;
+		bdev->bd_inode->i_flags = disk->fops->direct_access ? S_DAX : 0;
 		if (!partno) {
 			ret = -ENXIO;
 			bdev->bd_part = disk_get_part(disk, partno);
diff --git a/fs/dax.c b/fs/dax.c
index eaa9e06..c3e21cc 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -209,7 +209,8 @@ ssize_t dax_do_io(struct kiocb *iocb, struct inode *inode,
 	}
 
 	/* Protects against truncate */
-	inode_dio_begin(inode);
+	if (!(flags & DIO_SKIP_DIO_COUNT))
+		inode_dio_begin(inode);
 
 	retval = dax_io(inode, iter, pos, end, get_block, &bh);
 
@@ -219,7 +220,8 @@ ssize_t dax_do_io(struct kiocb *iocb, struct inode *inode,
 	if ((retval > 0) && end_io)
 		end_io(iocb, pos, retval, bh.b_private);
 
-	inode_dio_end(inode);
+	if (!(flags & DIO_SKIP_DIO_COUNT))
+		inode_dio_end(inode);
  out:
 	return retval;
 }
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web