[PATCH v2 1/3] block: add QUEUE_FLAG_DAX for devices to advertise their DAX support

2016-06-22 Thread Toshi Kani
Currently, presence of direct_access() in block_device_operations
indicates support of DAX on its block device.  Because
block_device_operations is instantiated with 'const', this DAX
capablity may not be enabled conditinally.

In preparation for supporting DAX to device-mapper devices, add
QUEUE_FLAG_DAX to request_queue flags to advertise their DAX
support.  This will allow to set the DAX capability based on how
mapped device is composed.

Signed-off-by: Toshi Kani 
Cc: Jens Axboe 
Cc: Dan Williams 
Cc: Ross Zwisler 
Cc: Martin Schwidefsky 
Cc: Heiko Carstens 
Cc: 
---
 drivers/block/brd.c  |4 +++-
 drivers/nvdimm/pmem.c|1 +
 drivers/s390/block/dcssblk.c |1 +
 fs/block_dev.c   |5 +++--
 include/linux/blkdev.h   |2 ++
 5 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index f5b0d6f..dd96a93 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -509,7 +509,9 @@ static struct brd_device *brd_alloc(int i)
blk_queue_max_discard_sectors(brd->brd_queue, UINT_MAX);
brd->brd_queue->limits.discard_zeroes_data = 1;
queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, brd->brd_queue);
-
+#ifdef CONFIG_BLK_DEV_RAM_DAX
+   queue_flag_set_unlocked(QUEUE_FLAG_DAX, brd->brd_queue);
+#endif
disk = brd->brd_disk = alloc_disk(max_part);
if (!disk)
goto out_free_queue;
diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
index 608fc44..53b701b 100644
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -283,6 +283,7 @@ static int pmem_attach_disk(struct device *dev,
blk_queue_max_hw_sectors(q, UINT_MAX);
blk_queue_bounce_limit(q, BLK_BOUNCE_ANY);
queue_flag_set_unlocked(QUEUE_FLAG_NONROT, q);
+   queue_flag_set_unlocked(QUEUE_FLAG_DAX, q);
q->queuedata = pmem;
 
disk = alloc_disk_node(0, nid);
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
index bed53c4..093e9e1 100644
--- a/drivers/s390/block/dcssblk.c
+++ b/drivers/s390/block/dcssblk.c
@@ -618,6 +618,7 @@ dcssblk_add_store(struct device *dev, struct 
device_attribute *attr, const char
dev_info->gd->driverfs_dev = _info->dev;
blk_queue_make_request(dev_info->dcssblk_queue, dcssblk_make_request);
blk_queue_logical_block_size(dev_info->dcssblk_queue, 4096);
+   queue_flag_set_unlocked(QUEUE_FLAG_DAX, dev_info->dcssblk_queue);
 
seg_byte_size = (dev_info->end - dev_info->start + 1);
set_capacity(dev_info->gd, seg_byte_size >> 9); // size in sectors
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 71ccab1..d012be4 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -493,7 +493,7 @@ long bdev_direct_access(struct block_device *bdev, struct 
blk_dax_ctl *dax)
 
if (size < 0)
return size;
-   if (!ops->direct_access)
+   if (!blk_queue_dax(bdev_get_queue(bdev)) || !ops->direct_access)
return -EOPNOTSUPP;
if ((sector + DIV_ROUND_UP(size, 512)) >
part_nr_sects_read(bdev->bd_part))
@@ -1287,7 +1287,8 @@ 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;
-   if (IS_ENABLED(CONFIG_BLK_DEV_DAX) && disk->fops->direct_access)
+   if (IS_ENABLED(CONFIG_BLK_DEV_DAX) &&
+   blk_queue_dax(disk->queue))
bdev->bd_inode->i_flags = S_DAX;
else
bdev->bd_inode->i_flags = 0;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 9746d22..1493ab3 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -505,6 +505,7 @@ struct request_queue {
 #define QUEUE_FLAG_WC 23   /* Write back caching */
 #define QUEUE_FLAG_FUA24   /* device supports FUA writes */
 #define QUEUE_FLAG_FLUSH_NQ25  /* flush not queueuable */
+#define QUEUE_FLAG_DAX 26  /* device supports DAX */
 
 #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) |\
 (1 << QUEUE_FLAG_STACKABLE)|   \
@@ -594,6 +595,7 @@ static inline void queue_flag_clear(unsigned int flag, 
struct request_queue *q)
 #define blk_queue_discard(q)   test_bit(QUEUE_FLAG_DISCARD, &(q)->queue_flags)
 #define blk_queue_secdiscard(q)(blk_queue_discard(q) && \
test_bit(QUEUE_FLAG_SECDISCARD, &(q)->queue_flags))
+#define blk_queue_dax(q)   test_bit(QUEUE_FLAG_DAX, &(q)->queue_flags)
 
 #define blk_noretry_request(rq) \
((rq)->cmd_flags & (REQ_FAILFAST_DEV|REQ_FAILFAST_TRANSPORT| \

[PATCH v2 0/3] Support DAX for device-mapper dm-linear devices

2016-06-22 Thread Toshi Kani
This patch-set adds DAX support to device-mapper dm-linear devices
used by LVM.  It works with LVM commands as follows:
 - Creation of a logical volume with all DAX capable devices (such
   as pmem) sets the logical volume DAX capable as well.
 - Once a logical volume is set to DAX capable, the volume may not
   be extended with non-DAX capable devices.

The direct_access interface is added to dm and dm-linear to map
a request to a target device.

The patches replace v1 series at:
http://git.kernel.org/cgit/linux/kernel/git/snitzer/linux.git/log/?h=wip

v2:
 - Fix issue with partitioning.
 - Change to add DAX flag to a request queue.

---
Toshi Kani (3):
 1/3 block: add QUEUE_FLAG_DAX for devices to advertise their DAX support
 2/3 dm: add infrastructure for DAX support
 3/3 dm linear: add DAX support

---
 drivers/block/brd.c   |  4 +++-
 drivers/md/dm-linear.c| 23 ++-
 drivers/md/dm-table.c | 23 ---
 drivers/md/dm.c   | 36 +++-
 drivers/md/dm.h   |  1 +
 drivers/nvdimm/pmem.c |  1 +
 drivers/s390/block/dcssblk.c  |  1 +
 fs/block_dev.c|  5 +++--
 include/linux/blkdev.h|  2 ++
 include/linux/device-mapper.h | 16 
 10 files changed, 104 insertions(+), 8 deletions(-)
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: [PATCH 0/6] Support DAX for device-mapper dm-linear devices

2016-06-22 Thread Mike Snitzer
On Wed, Jun 22 2016 at  4:16P -0400,
Kani, Toshimitsu  wrote:

> On Wed, 2016-06-22 at 12:15 -0700, Dan Williams wrote:
> > On Wed, Jun 22, 2016 at 10:44 AM, Kani, Toshimitsu 
> > wrote:
> > > On Tue, 2016-06-21 at 14:17 -0400, Mike Snitzer wrote:
> > > > 
> > > > On Tue, Jun 21 2016 at 11:44am -0400,
> > > > Kani, Toshimitsu  wrote:
> > > > > 
> > > > > On Tue, 2016-06-21 at 09:41 -0400, Mike Snitzer wrote:
> > > > > > On Mon, Jun 20 2016 at  6:22pm -0400,
> > > > > > Mike Snitzer  wrote:
> > > > > > I'm now wondering if we'd be better off setting a new QUEUE_FLAG_DAX
> > > > > > rather than establish GENHD_FL_DAX on the genhd?
> > > > > > 
> > > > > > It'd be quite a bit easier to allow upper layers (e.g. XFS and ext4)
> > > > > > to check for a queue flag.
> > > > > 
> > > > > I think GENHD_FL_DAX is more appropriate since DAX does not use a
> > > > > request queue, except for protecting the underlining device being
> > > > > disabled while direct_access() is called (b2e0d1625e19).
> > > > 
> > > > The devices in question have a request_queue.  All bio-based device have
> > > > a request_queue.
> > >
> > > DAX-capable devices have two operation modes, bio-based and DAX.  I agree
> > > that bio-based operation is associated with a request queue, and its
> > > capabilities should be set to it.  DAX, on the other hand, is rather
> > > independent from a request queue.
> > > 
> > > > I don't have a big problem with GENHD_FL_DAX.  Just wanted to point out
> > > > that such block device capabilities are generally advertised in terms of
> > > > a QUEUE_FLAG.
> > >
> > > I do not have a strong opinion, but feel a bit odd to associate DAX to a
> > > request queue.
> >
> > Given that we do not support dax to a raw block device [1] it seems a
> > gendisk flag is more misleading than request_queue flag that specifies
> > what requests can be made of the device.
> > 
> > [1]: acc93d30d7d4 Revert "block: enable dax for raw block devices"
> 
> Oh, I see.  I will change to use request_queue flag.

I implemented the block patch for this yesterday but based on your
feedback I stopped there (didn't carry the change through to the DM core
and DM linear -- can easily do so tomorrow though).

Feel free to use this as a starting point and fix/extend and add a
proper header:

>From e88736ce322f248157da6c7d402e940adafffa1e Mon Sep 17 00:00:00 2001
From: Mike Snitzer 
Date: Tue, 21 Jun 2016 12:23:29 -0400
Subject: [PATCH] block: add QUEUE_FLAG_DAX for devices to advertise their DAX 
support

Signed-off-by: Mike Snitzer 
---
 drivers/block/brd.c  | 3 +++
 drivers/nvdimm/pmem.c| 1 +
 drivers/s390/block/dcssblk.c | 1 +
 fs/block_dev.c   | 5 +++--
 include/linux/blkdev.h   | 2 ++
 5 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index f5b0d6f..13eee12 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -508,6 +508,9 @@ static struct brd_device *brd_alloc(int i)
brd->brd_queue->limits.discard_granularity = PAGE_SIZE;
blk_queue_max_discard_sectors(brd->brd_queue, UINT_MAX);
brd->brd_queue->limits.discard_zeroes_data = 1;
+#ifdef CONFIG_BLK_DEV_RAM_DAX
+   queue_flag_set_unlocked(QUEUE_FLAG_DAX, brd->brd_queue);
+#endif
queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, brd->brd_queue);
 
disk = brd->brd_disk = alloc_disk(max_part);
diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
index 608fc44..53b701b 100644
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -283,6 +283,7 @@ static int pmem_attach_disk(struct device *dev,
blk_queue_max_hw_sectors(q, UINT_MAX);
blk_queue_bounce_limit(q, BLK_BOUNCE_ANY);
queue_flag_set_unlocked(QUEUE_FLAG_NONROT, q);
+   queue_flag_set_unlocked(QUEUE_FLAG_DAX, q);
q->queuedata = pmem;
 
disk = alloc_disk_node(0, nid);
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
index bed53c4..093e9e1 100644
--- a/drivers/s390/block/dcssblk.c
+++ b/drivers/s390/block/dcssblk.c
@@ -618,6 +618,7 @@ dcssblk_add_store(struct device *dev, struct 
device_attribute *attr, const char
dev_info->gd->driverfs_dev = _info->dev;
blk_queue_make_request(dev_info->dcssblk_queue, dcssblk_make_request);
blk_queue_logical_block_size(dev_info->dcssblk_queue, 4096);
+   queue_flag_set_unlocked(QUEUE_FLAG_DAX, dev_info->dcssblk_queue);
 
seg_byte_size = (dev_info->end - dev_info->start + 1);
set_capacity(dev_info->gd, seg_byte_size >> 9); // size in sectors
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 71ccab1..9bcb3a9 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -484,6 +484,7 @@ long bdev_direct_access(struct block_device *bdev, struct 
blk_dax_ctl *dax)
sector_t sector = dax->sector;
long avail, size = dax->size;
const 

[PATCH 7/8] xfs: split direct I/O and DAX path

2016-06-22 Thread Christoph Hellwig
So far the DAX code overloaded the direct I/O code path.  There is very little
in common between the two, and untangling them allows to clean up both variants.

As a ѕide effect we also get separate trace points for both I/O types.

Signed-off-by: Christoph Hellwig 
---
 fs/xfs/xfs_file.c  | 139 ++---
 fs/xfs/xfs_trace.h |   2 +
 2 files changed, 112 insertions(+), 29 deletions(-)

diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 24b267d..0e74325 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -262,13 +262,11 @@ xfs_file_dio_aio_read(
else
target = ip->i_mount->m_ddev_targp;
 
-   if (!IS_DAX(inode)) {
-   /* DIO must be aligned to device logical sector size */
-   if ((iocb->ki_pos | count) & target->bt_logical_sectormask) {
-   if (iocb->ki_pos == isize)
-   return 0;
-   return -EINVAL;
-   }
+   /* DIO must be aligned to device logical sector size */
+   if ((iocb->ki_pos | count) & target->bt_logical_sectormask) {
+   if (iocb->ki_pos == isize)
+   return 0;
+   return -EINVAL;
}
 
/*
@@ -317,13 +315,37 @@ xfs_file_dio_aio_read(
}
 
data = *to;
-   if (IS_DAX(inode)) {
-   ret = dax_do_io(iocb, inode, , xfs_get_blocks_direct,
-   NULL, 0);
-   } else {
-   ret = __blockdev_direct_IO(iocb, inode, target->bt_bdev, ,
-   xfs_get_blocks_direct, NULL, NULL, 0);
+   ret = __blockdev_direct_IO(iocb, inode, target->bt_bdev, ,
+   xfs_get_blocks_direct, NULL, NULL, 0);
+   if (ret > 0) {
+   iocb->ki_pos += ret;
+   iov_iter_advance(to, ret);
}
+   xfs_rw_iunlock(ip, XFS_IOLOCK_SHARED);
+
+   file_accessed(iocb->ki_filp);
+   return ret;
+}
+
+STATIC ssize_t
+xfs_file_dax_read(
+   struct kiocb*iocb,
+   struct iov_iter *to)
+{
+   struct address_space*mapping = iocb->ki_filp->f_mapping;
+   struct inode*inode = mapping->host;
+   struct xfs_inode*ip = XFS_I(inode);
+   struct iov_iter data = *to;
+   size_t  count = iov_iter_count(to);
+   ssize_t ret = 0;
+
+   trace_xfs_file_dax_read(ip, count, iocb->ki_pos);
+
+   if (!count)
+   return 0; /* skip atime */
+
+   xfs_rw_ilock(ip, XFS_IOLOCK_SHARED);
+   ret = dax_do_io(iocb, inode, , xfs_get_blocks_direct, NULL, 0);
if (ret > 0) {
iocb->ki_pos += ret;
iov_iter_advance(to, ret);
@@ -356,7 +378,8 @@ xfs_file_read_iter(
struct kiocb*iocb,
struct iov_iter *to)
 {
-   struct xfs_mount*mp = XFS_I(file_inode(iocb->ki_filp))->i_mount;
+   struct inode*inode = file_inode(iocb->ki_filp);
+   struct xfs_mount*mp = XFS_I(inode)->i_mount;
ssize_t ret = 0;
 
XFS_STATS_INC(mp, xs_read_calls);
@@ -364,7 +387,9 @@ xfs_file_read_iter(
if (XFS_FORCED_SHUTDOWN(mp))
return -EIO;
 
-   if (iocb->ki_flags & IOCB_DIRECT)
+   if (IS_DAX(inode))
+   ret = xfs_file_dax_read(iocb, to);
+   else if (iocb->ki_flags & IOCB_DIRECT)
ret = xfs_file_dio_aio_read(iocb, to);
else
ret = xfs_file_buffered_aio_read(iocb, to);
@@ -586,8 +611,7 @@ xfs_file_dio_aio_write(
mp->m_rtdev_targp : mp->m_ddev_targp;
 
/* DIO must be aligned to device logical sector size */
-   if (!IS_DAX(inode) &&
-   ((iocb->ki_pos | count) & target->bt_logical_sectormask))
+   if ((iocb->ki_pos | count) & target->bt_logical_sectormask)
return -EINVAL;
 
/* "unaligned" here means not aligned to a filesystem block */
@@ -656,14 +680,9 @@ xfs_file_dio_aio_write(
trace_xfs_file_direct_write(ip, count, iocb->ki_pos);
 
data = *from;
-   if (IS_DAX(inode)) {
-   ret = dax_do_io(iocb, inode, , xfs_get_blocks_direct,
-   xfs_end_io_direct_write, 0);
-   } else {
-   ret = __blockdev_direct_IO(iocb, inode, target->bt_bdev, ,
-   xfs_get_blocks_direct, xfs_end_io_direct_write,
-   NULL, DIO_ASYNC_EXTEND);
-   }
+   ret = __blockdev_direct_IO(iocb, inode, target->bt_bdev, ,
+   xfs_get_blocks_direct, xfs_end_io_direct_write,
+   NULL, DIO_ASYNC_EXTEND);
 
/* see generic_file_direct_write() for why this is necessary */
if (mapping->nrpages) {
@@ -680,10 +699,70 @@ out:
xfs_rw_iunlock(ip, iolock);
 
/*
-* No 

[PATCH 8/8] xfs: fix locking for DAX writes

2016-06-22 Thread Christoph Hellwig
So far DAX writes inherited the locking from direct I/O writes, but the direct
I/O model of using shared locks for writes is actually wrong for DAX.  For
direct I/O we're out of any standards and don't have to provide the Posix
required exclusion between writers, but for DAX which gets transparently
enable on applications without any knowledge of it we can't simply drop the
requirement.  Even worse this only happens for aligned writes and thus
doesn't show up for many typical use cases.

Signed-off-by: Christoph Hellwig 
---
 fs/xfs/xfs_file.c | 20 +---
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 0e74325..413c9e0 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -714,24 +714,11 @@ xfs_file_dax_write(
struct address_space*mapping = iocb->ki_filp->f_mapping;
struct inode*inode = mapping->host;
struct xfs_inode*ip = XFS_I(inode);
-   struct xfs_mount*mp = ip->i_mount;
ssize_t ret = 0;
-   int unaligned_io = 0;
-   int iolock;
+   int iolock = XFS_IOLOCK_EXCL;
struct iov_iter data;
 
-   /* "unaligned" here means not aligned to a filesystem block */
-   if ((iocb->ki_pos & mp->m_blockmask) ||
-   ((iocb->ki_pos + iov_iter_count(from)) & mp->m_blockmask)) {
-   unaligned_io = 1;
-   iolock = XFS_IOLOCK_EXCL;
-   } else if (mapping->nrpages) {
-   iolock = XFS_IOLOCK_EXCL;
-   } else {
-   iolock = XFS_IOLOCK_SHARED;
-   }
xfs_rw_ilock(ip, iolock);
-
ret = xfs_file_aio_write_checks(iocb, from, );
if (ret)
goto out;
@@ -747,11 +734,6 @@ xfs_file_dax_write(
WARN_ON_ONCE(ret);
}
 
-   if (iolock == XFS_IOLOCK_EXCL && !unaligned_io) {
-   xfs_rw_ilock_demote(ip, XFS_IOLOCK_EXCL);
-   iolock = XFS_IOLOCK_SHARED;
-   }
-
trace_xfs_file_dax_write(ip, iov_iter_count(from), iocb->ki_pos);
 
data = *from;
-- 
2.1.4

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


xfs: untangle the direct I/O and DAX path, fix DAX locking

2016-06-22 Thread Christoph Hellwig
The last patch is what started the series:  XFS currently uses the
direct I/O locking strategy for DAX because DAX was overloaded onto
the direct I/O path.  For XFS this means that we only take a shared
inode lock instead of the normal exclusive one for writes IFF they
are properly aligned.  While this is fine for O_DIRECT which requires
explicit opt-in from the application it's not fine for DAX where we'll
suddenly lose expected and required synchronization of the file system
happens to use DAX undeneath.

Patches 1-7 just untangle the code so that we can deal with DAX on
it's own easily.

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


[PATCH 5/8] xfs: stop using generic_file_read_iter for direct I/O

2016-06-22 Thread Christoph Hellwig
XFS already implement it's own flushing of the pagecache because it
implements proper synchronization for direct I/O reads.  This means
calling generic_file_read_iter for direct I/O is rather useless,
as it doesn't do much but updating the atime and iocb position for
us.  This also gets rid of the buffered I/O fallback that isn't used
for XFS.

Signed-off-by: Christoph Hellwig 
---
 fs/xfs/xfs_file.c | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index e584333..f761f49 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -246,12 +246,17 @@ xfs_file_dio_aio_read(
struct address_space*mapping = iocb->ki_filp->f_mapping;
struct inode*inode = mapping->host;
struct xfs_inode*ip = XFS_I(inode);
+   loff_t  isize = i_size_read(inode);
size_t  count = iov_iter_count(to);
+   struct iov_iter data;
struct xfs_buftarg  *target;
ssize_t ret = 0;
 
trace_xfs_file_direct_read(ip, count, iocb->ki_pos);
 
+   if (!count)
+   return 0; /* skip atime */
+
if (XFS_IS_REALTIME_INODE(ip))
target = ip->i_mount->m_rtdev_targp;
else
@@ -260,7 +265,7 @@ xfs_file_dio_aio_read(
if (!IS_DAX(inode)) {
/* DIO must be aligned to device logical sector size */
if ((iocb->ki_pos | count) & target->bt_logical_sectormask) {
-   if (iocb->ki_pos == i_size_read(inode))
+   if (iocb->ki_pos == isize)
return 0;
return -EINVAL;
}
@@ -311,9 +316,15 @@ xfs_file_dio_aio_read(
xfs_rw_ilock_demote(ip, XFS_IOLOCK_EXCL);
}
 
-   ret = generic_file_read_iter(iocb, to);
+   data = *to;
+   ret = mapping->a_ops->direct_IO(iocb, );
+   if (ret > 0) {
+   iocb->ki_pos += ret;
+   iov_iter_advance(to, ret);
+   }
xfs_rw_iunlock(ip, XFS_IOLOCK_SHARED);
 
+   file_accessed(iocb->ki_filp);
return ret;
 }
 
-- 
2.1.4

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


[PATCH 1/8] xfs: don't pass ioflags around in the ioctl path

2016-06-22 Thread Christoph Hellwig
Instead check the file pointer for the invisble I/O flag directly, and
use the chance to drop redundant arguments from the xfs_ioc_space
prototype.

Signed-off-by: Christoph Hellwig 
---
 fs/xfs/xfs_ioctl.c   | 22 --
 fs/xfs/xfs_ioctl.h   |  3 ---
 fs/xfs/xfs_ioctl32.c |  6 +-
 3 files changed, 9 insertions(+), 22 deletions(-)

diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index dbca737..6ab5a24 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -595,13 +595,12 @@ xfs_attrmulti_by_handle(
 
 int
 xfs_ioc_space(
-   struct xfs_inode*ip,
-   struct inode*inode,
struct file *filp,
-   int ioflags,
unsigned intcmd,
xfs_flock64_t   *bf)
 {
+   struct inode*inode = file_inode(filp);
+   struct xfs_inode*ip = XFS_I(inode);
struct iattriattr;
enum xfs_prealloc_flags flags = 0;
uintiolock = XFS_IOLOCK_EXCL;
@@ -626,7 +625,7 @@ xfs_ioc_space(
 
if (filp->f_flags & O_DSYNC)
flags |= XFS_PREALLOC_SYNC;
-   if (ioflags & XFS_IO_INVIS)
+   if (filp->f_mode & FMODE_NOCMTIME)
flags |= XFS_PREALLOC_INVISIBLE;
 
error = mnt_want_write_file(filp);
@@ -1464,8 +1463,7 @@ xfs_getbmap_format(void **ap, struct getbmapx *bmv, int 
*full)
 
 STATIC int
 xfs_ioc_getbmap(
-   struct xfs_inode*ip,
-   int ioflags,
+   struct file *file,
unsigned intcmd,
void__user *arg)
 {
@@ -1479,10 +1477,10 @@ xfs_ioc_getbmap(
return -EINVAL;
 
bmx.bmv_iflags = (cmd == XFS_IOC_GETBMAPA ? BMV_IF_ATTRFORK : 0);
-   if (ioflags & XFS_IO_INVIS)
+   if (file->f_mode & FMODE_NOCMTIME)
bmx.bmv_iflags |= BMV_IF_NO_DMAPI_READ;
 
-   error = xfs_getbmap(ip, , xfs_getbmap_format,
+   error = xfs_getbmap(XFS_I(file_inode(file)), , xfs_getbmap_format,
(__force struct getbmap *)arg+1);
if (error)
return error;
@@ -1619,12 +1617,8 @@ xfs_file_ioctl(
struct xfs_inode*ip = XFS_I(inode);
struct xfs_mount*mp = ip->i_mount;
void__user *arg = (void __user *)p;
-   int ioflags = 0;
int error;
 
-   if (filp->f_mode & FMODE_NOCMTIME)
-   ioflags |= XFS_IO_INVIS;
-
trace_xfs_file_ioctl(ip);
 
switch (cmd) {
@@ -1643,7 +1637,7 @@ xfs_file_ioctl(
 
if (copy_from_user(, arg, sizeof(bf)))
return -EFAULT;
-   return xfs_ioc_space(ip, inode, filp, ioflags, cmd, );
+   return xfs_ioc_space(filp, cmd, );
}
case XFS_IOC_DIOINFO: {
struct dioattr  da;
@@ -1702,7 +1696,7 @@ xfs_file_ioctl(
 
case XFS_IOC_GETBMAP:
case XFS_IOC_GETBMAPA:
-   return xfs_ioc_getbmap(ip, ioflags, cmd, arg);
+   return xfs_ioc_getbmap(filp, cmd, arg);
 
case XFS_IOC_GETBMAPX:
return xfs_ioc_getbmapx(ip, arg);
diff --git a/fs/xfs/xfs_ioctl.h b/fs/xfs/xfs_ioctl.h
index 77c02c7..8b52881 100644
--- a/fs/xfs/xfs_ioctl.h
+++ b/fs/xfs/xfs_ioctl.h
@@ -20,10 +20,7 @@
 
 extern int
 xfs_ioc_space(
-   struct xfs_inode*ip,
-   struct inode*inode,
struct file *filp,
-   int ioflags,
unsigned intcmd,
xfs_flock64_t   *bf);
 
diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c
index 1a05d8a..321f577 100644
--- a/fs/xfs/xfs_ioctl32.c
+++ b/fs/xfs/xfs_ioctl32.c
@@ -532,12 +532,8 @@ xfs_file_compat_ioctl(
struct xfs_inode*ip = XFS_I(inode);
struct xfs_mount*mp = ip->i_mount;
void__user *arg = (void __user *)p;
-   int ioflags = 0;
int error;
 
-   if (filp->f_mode & FMODE_NOCMTIME)
-   ioflags |= XFS_IO_INVIS;
-
trace_xfs_file_compat_ioctl(ip);
 
switch (cmd) {
@@ -589,7 +585,7 @@ xfs_file_compat_ioctl(
if (xfs_compat_flock64_copyin(, arg))
return -EFAULT;
cmd = _NATIVE_IOC(cmd, struct xfs_flock64);
-   return xfs_ioc_space(ip, inode, filp, ioflags, cmd, );
+   return xfs_ioc_space(filp, cmd, );
}
case XFS_IOC_FSGEOMETRY_V1_32:
return xfs_compat_ioc_fsgeometry_v1(mp, arg);
-- 
2.1.4

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


[PATCH 4/8] xfs: split xfs_file_read_iter into buffered and direct I/O helpers

2016-06-22 Thread Christoph Hellwig
Similar to what we did on the write side a while ago.

Signed-off-by: Christoph Hellwig 
---
 fs/xfs/xfs_file.c | 83 ++-
 1 file changed, 57 insertions(+), 26 deletions(-)

diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 09a5a78..e584333 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -239,35 +239,33 @@ xfs_file_fsync(
 }
 
 STATIC ssize_t
-xfs_file_read_iter(
+xfs_file_dio_aio_read(
struct kiocb*iocb,
struct iov_iter *to)
 {
-   struct file *file = iocb->ki_filp;
-   struct inode*inode = file->f_mapping->host;
+   struct address_space*mapping = iocb->ki_filp->f_mapping;
+   struct inode*inode = mapping->host;
struct xfs_inode*ip = XFS_I(inode);
-   struct xfs_mount*mp = ip->i_mount;
-   size_t  size = iov_iter_count(to);
+   size_t  count = iov_iter_count(to);
+   struct xfs_buftarg  *target;
ssize_t ret = 0;
-   loff_t  pos = iocb->ki_pos;
 
-   XFS_STATS_INC(mp, xs_read_calls);
+   trace_xfs_file_direct_read(ip, count, iocb->ki_pos);
 
-   if ((iocb->ki_flags & IOCB_DIRECT) && !IS_DAX(inode)) {
-   xfs_buftarg_t   *target =
-   XFS_IS_REALTIME_INODE(ip) ?
-   mp->m_rtdev_targp : mp->m_ddev_targp;
+   if (XFS_IS_REALTIME_INODE(ip))
+   target = ip->i_mount->m_rtdev_targp;
+   else
+   target = ip->i_mount->m_ddev_targp;
+
+   if (!IS_DAX(inode)) {
/* DIO must be aligned to device logical sector size */
-   if ((pos | size) & target->bt_logical_sectormask) {
-   if (pos == i_size_read(inode))
+   if ((iocb->ki_pos | count) & target->bt_logical_sectormask) {
+   if (iocb->ki_pos == i_size_read(inode))
return 0;
return -EINVAL;
}
}
 
-   if (XFS_FORCED_SHUTDOWN(mp))
-   return -EIO;
-
/*
 * Locking is a bit tricky here. If we take an exclusive lock for direct
 * IO, we effectively serialise all new concurrent read IO to this file
@@ -279,7 +277,7 @@ xfs_file_read_iter(
 * serialisation.
 */
xfs_rw_ilock(ip, XFS_IOLOCK_SHARED);
-   if ((iocb->ki_flags & IOCB_DIRECT) && inode->i_mapping->nrpages) {
+   if (mapping->nrpages) {
xfs_rw_iunlock(ip, XFS_IOLOCK_SHARED);
xfs_rw_ilock(ip, XFS_IOLOCK_EXCL);
 
@@ -294,8 +292,8 @@ xfs_file_read_iter(
 * flush and reduce the chances of repeated iolock cycles going
 * forward.
 */
-   if (inode->i_mapping->nrpages) {
-   ret = filemap_write_and_wait(VFS_I(ip)->i_mapping);
+   if (mapping->nrpages) {
+   ret = filemap_write_and_wait(mapping);
if (ret) {
xfs_rw_iunlock(ip, XFS_IOLOCK_EXCL);
return ret;
@@ -306,23 +304,56 @@ xfs_file_read_iter(
 * we fail to invalidate a page, but this should never
 * happen on XFS. Warn if it does fail.
 */
-   ret = invalidate_inode_pages2(VFS_I(ip)->i_mapping);
+   ret = invalidate_inode_pages2(mapping);
WARN_ON_ONCE(ret);
ret = 0;
}
xfs_rw_ilock_demote(ip, XFS_IOLOCK_EXCL);
}
 
+   ret = generic_file_read_iter(iocb, to);
+   xfs_rw_iunlock(ip, XFS_IOLOCK_SHARED);
+
+   return ret;
+}
+
+STATIC ssize_t
+xfs_file_buffered_aio_read(
+   struct kiocb*iocb,
+   struct iov_iter *to)
+{
+   struct xfs_inode*ip = XFS_I(file_inode(iocb->ki_filp));
+   ssize_t ret;
+
+   trace_xfs_file_buffered_read(ip, iov_iter_count(to), iocb->ki_pos);
+
+   xfs_rw_ilock(ip, XFS_IOLOCK_SHARED);
+   ret = generic_file_read_iter(iocb, to);
+   xfs_rw_iunlock(ip, XFS_IOLOCK_SHARED);
+
+   return ret;
+}
+
+STATIC ssize_t
+xfs_file_read_iter(
+   struct kiocb*iocb,
+   struct iov_iter *to)
+{
+   struct xfs_mount*mp = XFS_I(file_inode(iocb->ki_filp))->i_mount;
+   ssize_t ret = 0;
+
+   XFS_STATS_INC(mp, xs_read_calls);
+
+   if (XFS_FORCED_SHUTDOWN(mp))
+   return -EIO;
+
if (iocb->ki_flags & IOCB_DIRECT)
-   trace_xfs_file_direct_read(ip, size, pos);
+   ret = xfs_file_dio_aio_read(iocb, to);
else
-   trace_xfs_file_buffered_read(ip, size, pos);
+   ret = 

[PATCH 3/8] xfs: remove s_maxbytes enforcement in xfs_file_read_iter

2016-06-22 Thread Christoph Hellwig
All the three low-level read implementations that we might call already
take care of not overflowing the maximum supported bytes, no need to
duplicate it here.

Signed-off-by: Christoph Hellwig 
---
 fs/xfs/xfs_file.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index b32e6b0..09a5a78 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -249,7 +249,6 @@ xfs_file_read_iter(
struct xfs_mount*mp = ip->i_mount;
size_t  size = iov_iter_count(to);
ssize_t ret = 0;
-   xfs_fsize_t n;
loff_t  pos = iocb->ki_pos;
 
XFS_STATS_INC(mp, xs_read_calls);
@@ -266,13 +265,6 @@ xfs_file_read_iter(
}
}
 
-   n = mp->m_super->s_maxbytes - pos;
-   if (n <= 0 || size == 0)
-   return 0;
-
-   if (n < size)
-   size = n;
-
if (XFS_FORCED_SHUTDOWN(mp))
return -EIO;
 
-- 
2.1.4

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


[PATCH 2/8] xfs: kill ioflags

2016-06-22 Thread Christoph Hellwig
Now that we have the direct I/O kiocb flag there is no real need to sample
the value inside of XFS, and the invis flag was always just partially used
and isn't worth keeping this infrastructure around for.   This also splits
the read tracepoint into buffered vs direct as we've done for writes a long
time ago.

Signed-off-by: Christoph Hellwig 
---
 fs/xfs/xfs_file.c  | 26 +-
 fs/xfs/xfs_inode.h | 10 --
 fs/xfs/xfs_trace.h | 19 ---
 3 files changed, 17 insertions(+), 38 deletions(-)

diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 713991c..b32e6b0 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -249,18 +249,12 @@ xfs_file_read_iter(
struct xfs_mount*mp = ip->i_mount;
size_t  size = iov_iter_count(to);
ssize_t ret = 0;
-   int ioflags = 0;
xfs_fsize_t n;
loff_t  pos = iocb->ki_pos;
 
XFS_STATS_INC(mp, xs_read_calls);
 
-   if (unlikely(iocb->ki_flags & IOCB_DIRECT))
-   ioflags |= XFS_IO_ISDIRECT;
-   if (file->f_mode & FMODE_NOCMTIME)
-   ioflags |= XFS_IO_INVIS;
-
-   if ((ioflags & XFS_IO_ISDIRECT) && !IS_DAX(inode)) {
+   if ((iocb->ki_flags & IOCB_DIRECT) && !IS_DAX(inode)) {
xfs_buftarg_t   *target =
XFS_IS_REALTIME_INODE(ip) ?
mp->m_rtdev_targp : mp->m_ddev_targp;
@@ -293,7 +287,7 @@ xfs_file_read_iter(
 * serialisation.
 */
xfs_rw_ilock(ip, XFS_IOLOCK_SHARED);
-   if ((ioflags & XFS_IO_ISDIRECT) && inode->i_mapping->nrpages) {
+   if ((iocb->ki_flags & IOCB_DIRECT) && inode->i_mapping->nrpages) {
xfs_rw_iunlock(ip, XFS_IOLOCK_SHARED);
xfs_rw_ilock(ip, XFS_IOLOCK_EXCL);
 
@@ -327,7 +321,10 @@ xfs_file_read_iter(
xfs_rw_ilock_demote(ip, XFS_IOLOCK_EXCL);
}
 
-   trace_xfs_file_read(ip, size, pos, ioflags);
+   if (iocb->ki_flags & IOCB_DIRECT)
+   trace_xfs_file_direct_read(ip, size, pos);
+   else
+   trace_xfs_file_buffered_read(ip, size, pos);
 
ret = generic_file_read_iter(iocb, to);
if (ret > 0)
@@ -346,18 +343,14 @@ xfs_file_splice_read(
unsigned intflags)
 {
struct xfs_inode*ip = XFS_I(infilp->f_mapping->host);
-   int ioflags = 0;
ssize_t ret;
 
XFS_STATS_INC(ip->i_mount, xs_read_calls);
 
-   if (infilp->f_mode & FMODE_NOCMTIME)
-   ioflags |= XFS_IO_INVIS;
-
if (XFS_FORCED_SHUTDOWN(ip->i_mount))
return -EIO;
 
-   trace_xfs_file_splice_read(ip, count, *ppos, ioflags);
+   trace_xfs_file_splice_read(ip, count, *ppos);
 
/*
 * DAX inodes cannot ues the page cache for splice, so we have to push
@@ -620,7 +613,7 @@ xfs_file_dio_aio_write(
iolock = XFS_IOLOCK_SHARED;
}
 
-   trace_xfs_file_direct_write(ip, count, iocb->ki_pos, 0);
+   trace_xfs_file_direct_write(ip, count, iocb->ki_pos);
 
data = *from;
ret = mapping->a_ops->direct_IO(iocb, );
@@ -670,8 +663,7 @@ xfs_file_buffered_aio_write(
current->backing_dev_info = inode_to_bdi(inode);
 
 write_retry:
-   trace_xfs_file_buffered_write(ip, iov_iter_count(from),
- iocb->ki_pos, 0);
+   trace_xfs_file_buffered_write(ip, iov_iter_count(from), iocb->ki_pos);
ret = iomap_file_buffered_write(iocb, from, _iomap_ops);
if (likely(ret >= 0))
iocb->ki_pos += ret;
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index 0c19d3d..8eb78ec 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -473,14 +473,4 @@ do { \
 
 extern struct kmem_zone*xfs_inode_zone;
 
-/*
- * Flags for read/write calls
- */
-#define XFS_IO_ISDIRECT0x1 /* bypass page cache */
-#define XFS_IO_INVIS   0x2 /* don't update inode timestamps */
-
-#define XFS_IO_FLAGS \
-   { XFS_IO_ISDIRECT,  "DIRECT" }, \
-   { XFS_IO_INVIS, "INVIS"}
-
 #endif /* __XFS_INODE_H__ */
diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
index 6787a9f..2504f94 100644
--- a/fs/xfs/xfs_trace.h
+++ b/fs/xfs/xfs_trace.h
@@ -1135,15 +1135,14 @@ TRACE_EVENT(xfs_log_assign_tail_lsn,
 )
 
 DECLARE_EVENT_CLASS(xfs_file_class,
-   TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset, int flags),
-   TP_ARGS(ip, count, offset, flags),
+   TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset),
+   TP_ARGS(ip, count, offset),
TP_STRUCT__entry(
__field(dev_t, dev)
__field(xfs_ino_t, ino)
__field(xfs_fsize_t, size)
__field(loff_t, offset)
__field(size_t, count)
-   __field(int, flags)

Re: [PATCH v4 3/5] um: track 'parent' device in a local variable

2016-06-22 Thread Dan Williams
On Tue, Jun 21, 2016 at 11:20 PM, Bart Van Assche
 wrote:
> On 06/21/2016 10:47 PM, Dan Williams wrote:
>>
>> In preparation for the removal of 'driverfs_dev' from 'struct gendisk'
>> use a local variable to track the parented vs un-parented case in
>> ubd_disk_register().
>>
>> Cc: Jeff Dike 
>> Cc: Richard Weinberger 
>> Reported-by: Bart Van Assche 
>> Signed-off-by: Dan Williams 
>> ---
>>  arch/um/drivers/ubd_kern.c |5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
>> index ef6b4d960bad..8ec7b4112f55 100644
>> --- a/arch/um/drivers/ubd_kern.c
>> +++ b/arch/um/drivers/ubd_kern.c
>> @@ -801,6 +801,7 @@ static void ubd_device_release(struct device *dev)
>>  static int ubd_disk_register(int major, u64 size, int unit,
>>  struct gendisk **disk_out)
>>  {
>> +   struct device *dev = NULL;
>> struct gendisk *disk;
>>
>> disk = alloc_disk(1 << UBD_SHIFT);
>> @@ -823,12 +824,12 @@ static int ubd_disk_register(int major, u64 size,
>> int unit,
>> ubd_devs[unit].pdev.dev.release = ubd_device_release;
>> dev_set_drvdata(_devs[unit].pdev.dev,
>> _devs[unit]);
>> platform_device_register(_devs[unit].pdev);
>> -   disk->driverfs_dev = _devs[unit].pdev.dev;
>> +   dev = _devs[unit].pdev.dev;
>> }
>>
>> disk->private_data = _devs[unit];
>> disk->queue = ubd_devs[unit].queue;
>> -   add_disk(disk);
>> +   device_add_disk(dev, disk);
>>
>> *disk_out = disk;
>> return 0;
>
>
> Hello Dan,
>
> The Reported-by tag is intended to give people credit who find bugs in the
> upstream kernel. What I reported was a bug not in the upstream kernel but in
> a previous version of this patch series so I think the "Reported-by" tag can
> be left out from this patch.

I see nothing wrong with using it to give credit to patches during
review, I also do this when static analysis finds a problem in a patch
before it gets upstream.  If the report fixes upstream code then I
additionally add a "Fixes" tag.  If you'd rather I don't list you as
reported-by that's fine, but there's nothing in the definition of
Reported-by in Documentation/SubmittingPatches that requires the bug
to be upstream first.

> Additionally, please consider to use a more descriptive name instead of
> "dev", e.g. "parent".

Sure, will do.
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: [PATCH v4 2/5] mmc: move 'parent' tracking to mmc_blk_data

2016-06-22 Thread Bart Van Assche

On 06/21/2016 10:46 PM, Dan Williams wrote:

In preparation for the removal of 'driverfs_dev' from 'struct gendisk',
carry this data in mmc_blk_data. It is used for registration of parent
disks and partitions.

Cc: Ulf Hansson 
Reported-by: Bart Van Assche 
Signed-off-by: Dan Williams 
---
 drivers/mmc/card/block.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 383184743f9a..d1733424bf6e 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -93,6 +93,7 @@ static DEFINE_SPINLOCK(mmc_blk_lock);
  */
 struct mmc_blk_data {
spinlock_t  lock;
+   struct device   *parent;
struct gendisk  *disk;
struct mmc_queue queue;
struct list_head part;
@@ -2270,7 +2271,7 @@ again:
md->disk->fops = _bdops;
md->disk->private_data = md;
md->disk->queue = md->queue.queue;
-   md->disk->driverfs_dev = parent;
+   md->parent = parent;
set_disk_ro(md->disk, md->read_only || default_ro);
md->disk->flags = GENHD_FL_EXT_DEVT;
if (area_type & (MMC_BLK_DATA_AREA_RPMB | MMC_BLK_DATA_AREA_BOOT))
@@ -2458,7 +2459,7 @@ static int mmc_add_disk(struct mmc_blk_data *md)
int ret;
struct mmc_card *card = md->queue.card;

-   add_disk(md->disk);
+   device_add_disk(md->parent, md->disk);
md->force_ro.show = force_ro_show;
md->force_ro.store = force_ro_store;
sysfs_attr_init(>force_ro.attr);


What will the impact be of this patch on code that accesses driverfs_dev 
like printk_all_partitions()? Will this patch hurt bisectability?


Thanks,

Bart.
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: [PATCH v4 3/5] um: track 'parent' device in a local variable

2016-06-22 Thread Bart Van Assche

On 06/21/2016 10:47 PM, Dan Williams wrote:

In preparation for the removal of 'driverfs_dev' from 'struct gendisk'
use a local variable to track the parented vs un-parented case in
ubd_disk_register().

Cc: Jeff Dike 
Cc: Richard Weinberger 
Reported-by: Bart Van Assche 
Signed-off-by: Dan Williams 
---
 arch/um/drivers/ubd_kern.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index ef6b4d960bad..8ec7b4112f55 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -801,6 +801,7 @@ static void ubd_device_release(struct device *dev)
 static int ubd_disk_register(int major, u64 size, int unit,
 struct gendisk **disk_out)
 {
+   struct device *dev = NULL;
struct gendisk *disk;

disk = alloc_disk(1 << UBD_SHIFT);
@@ -823,12 +824,12 @@ static int ubd_disk_register(int major, u64 size, int 
unit,
ubd_devs[unit].pdev.dev.release = ubd_device_release;
dev_set_drvdata(_devs[unit].pdev.dev, _devs[unit]);
platform_device_register(_devs[unit].pdev);
-   disk->driverfs_dev = _devs[unit].pdev.dev;
+   dev = _devs[unit].pdev.dev;
}

disk->private_data = _devs[unit];
disk->queue = ubd_devs[unit].queue;
-   add_disk(disk);
+   device_add_disk(dev, disk);

*disk_out = disk;
return 0;


Hello Dan,

The Reported-by tag is intended to give people credit who find bugs in 
the upstream kernel. What I reported was a bug not in the upstream 
kernel but in a previous version of this patch series so I think the 
"Reported-by" tag can be left out from this patch.


Additionally, please consider to use a more descriptive name instead of 
"dev", e.g. "parent".


Thanks,

Bart.
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm