[GIT PULL] libnvdimm fixes for 4.12-rc1

From: Williams, Dan J
Date: Fri May 12 2017 - 17:35:57 EST


Hi Linus, please pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm libnvdimm-fixes

...to receive some incremental fixes and a small feature addition
relative to the libnvdimm 4.12 pull request.

+ACo- Geert noticed that tinyconfig was bloated by BLOCK selecting DAX. The
size regression is fixed by moving all dax helpers into the dax-core
and only specifying +ACI-select DAX+ACI- for FS+AF8-DAX and dax-capable drivers. He
also asked for clarification of the NR+AF8-DEV+AF8-DAX config option which, on
closer look, does not need to be a config option at all. Mike also
throws in a DEV+AF8-DAX+AF8-PMEM fixup for good measure.

+ACo- Ben's attention to detail on -stable patch submissions caught a case
where the recent fixes to+AKA-arch+AF8-copy+AF8-from+AF8-iter+AF8-pmem() missed a condition
where we strand dirty data in the cache. This is tagged for -stable and
will also be included in the rework of the pmem api to a proposed
+AHs-memcpy,copy+AF8-user+AH0AXw-flushcache() interface for 4.13.

+ACo- Vishal adds a feature that missed the initial pull due to pending
review feedback. It allows the kernel to clear media errors when
initializing a BTT (atomic sector update driver) instance on a pmem
namespace.

+ACo- Ross noticed that the dax+AF8-device +- dax+AF8-operations conversion broke
+AF8AXw-dax+AF8-zero+AF8-page+AF8-range(). The nvdimm unit tests fail to check this path,
but xfstests immediately trips over it. No excuse for missing this
before submitting the 4.12 pull request.

These all pass the nvdimm unit tests and an xfstests spot check. The
set has received a build success notification from the kbuild robot.

---

The following changes since commit 736163671bcb163fc82600b46c83dfa89d532d95:

Merge branch 'for-4.12/dax' into libnvdimm-for-next (2017-05-04 23:38:43 -0700)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm libnvdimm-fixes

for you to fetch changes up to e84b83b9ee2187817cf895471675f1ccdf64cd53:

filesystem-dax: fix broken +AF8AXw-dax+AF8-zero+AF8-page+AF8-range() conversion (2017-05-10 21:46:55 -0700)

----------------------------------------------------------------
Ben Hutchings (1):
x86, pmem: Fix cache flushing for iovec write +ADw- 8 bytes

Dan Williams (3):
block, dax: move +ACI-select DAX+ACI- from BLOCK to FS+AF8-DAX
device-dax: kill NR+AF8-DEV+AF8-DAX
filesystem-dax: fix broken +AF8AXw-dax+AF8-zero+AF8-page+AF8-range() conversion

Mike Galbraith (1):
device-dax: Tell kbuild DEV+AF8-DAX+AF8-PMEM depends on DEV+AF8-DAX

Vishal Verma (2):
libnvdimm: add an atomic vs process context flag to rw+AF8-bytes
libnvdimm, btt: ensure that initializing metadata clears poison

arch/x86/include/asm/pmem.h +AHw- 2 +--
block/Kconfig +AHw- 1 -
drivers/dax/Kconfig +AHw- 7 +---
drivers/dax/super.c +AHw- 81 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+----
drivers/nvdimm/blk.c +AHw- 3 +--
drivers/nvdimm/btt.c +AHw- 119 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+---------------
drivers/nvdimm/btt+AF8-devs.c +AHw- 2 +--
drivers/nvdimm/claim.c +AHw- 6 +-+--
drivers/nvdimm/nd.h +AHw- 1 +-
drivers/nvdimm/pfn+AF8-devs.c +AHw- 4 +--
fs/Kconfig +AHw- 1 +-
fs/block+AF8-dev.c +AHw- 66 ------------------------
fs/dax.c +AHw- 4 +--
fs/ext2/super.c +AHw- 1 +-
fs/ext4/super.c +AHw- 1 +-
fs/xfs/xfs+AF8-super.c +AHw- 1 +-
include/linux/blkdev.h +AHw- 2 -
include/linux/dax.h +AHw- 30 +-+-+-+-+-+-+-+-+-+--
include/linux/nd.h +AHw- 12 +-+-+---
19 files changed, 208 insertions(+-), 136 deletions(-)

commit 74d71a01abef37f71d914f2105a4cb8712a2beb8
Author: Mike Galbraith +ADw-efault+AEA-gmx.de+AD4-
Date: Sat May 6 06:14:43 2017 +-0200

device-dax: Tell kbuild DEV+AF8-DAX+AF8-PMEM depends on DEV+AF8-DAX

ERROR: +ACI-devm+AF8-create+AF8-dev+AF8-dax+ACI- +AFs-drivers/dax/dax+AF8-pmem.ko+AF0- undefined+ACE-
ERROR: +ACI-alloc+AF8-dax+AF8-region+ACI- +AFs-drivers/dax/dax+AF8-pmem.ko+AF0- undefined+ACE-
ERROR: +ACI-dax+AF8-region+AF8-put+ACI- +AFs-drivers/dax/dax+AF8-pmem.ko+AF0- undefined+ACE-

Signed-off-by: Mike Galbraith +ADw-efault+AEA-gmx.de+AD4-
Signed-off-by: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-

commit ef51042472f55b325fd7f2b26a2e29fd89757234
Author: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-
Date: Mon May 8 10:55:27 2017 -0700

block, dax: move +ACI-select DAX+ACI- from BLOCK to FS+AF8-DAX

For configurations that do not enable DAX filesystems or drivers, do not
require the DAX core to be built.

Given that the 'direct+AF8-access' method has been removed from
'block+AF8-device+AF8-operations', we can also go ahead and remove the
block-related dax helper functions from fs/block+AF8-dev.c to
drivers/dax/super.c. This keeps dax details out of the block layer and
lets the DAX core be built as a module in the FS+AF8-DAX+AD0-n case.

Filesystems need to include dax.h to call bdev+AF8-dax+AF8-supported().

Cc: linux-xfs+AEA-vger.kernel.org
Cc: Jens Axboe +ADw-axboe+AEA-kernel.dk+AD4-
Cc: +ACI-Theodore Ts'o+ACI- +ADw-tytso+AEA-mit.edu+AD4-
Cc: Matthew Wilcox +ADw-mawilcox+AEA-microsoft.com+AD4-
Cc: Alexander Viro +ADw-viro+AEA-zeniv.linux.org.uk+AD4-
Cc: +ACI-Darrick J. Wong+ACI- +ADw-darrick.wong+AEA-oracle.com+AD4-
Cc: Ross Zwisler +ADw-ross.zwisler+AEA-linux.intel.com+AD4-
Reviewed-by: Jan Kara +ADw-jack+AEA-suse.com+AD4-
Reported-by: Geert Uytterhoeven +ADw-geert+AEA-linux-m68k.org+AD4-
Signed-off-by: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-

commit cf1e22891bee39f50e058bee0827086fd75a8717
Author: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-
Date: Mon May 8 12:33:53 2017 -0700

device-dax: kill NR+AF8-DEV+AF8-DAX

There is no point to ask how many device-dax instances the kernel should
support. Since we are already using a dynamic major number, just allow
the max number of minors by default and be done. This also fixes the
fact that the proposed max for the NR+AF8-DEV+AF8-DAX range was larger than what
could be supported by alloc+AF8-chrdev+AF8-region().

Fixes: ba09c01d2fa8 (+ACI-dax: convert to the cdev api+ACI-)
Reported-by: Geert Uytterhoeven +ADw-geert+AEA-linux-m68k.org+AD4-
Tested-by: Geert Uytterhoeven +ADw-geert+AEA-linux-m68k.org+AD4-
Signed-off-by: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-

commit 8376efd31d3d7c44bd05be337adde023cc531fa1
Author: Ben Hutchings +ADw-ben.hutchings+AEA-codethink.co.uk+AD4-
Date: Tue May 9 18:00:43 2017 +-0100

x86, pmem: Fix cache flushing for iovec write +ADw- 8 bytes

Commit 11e63f6d920d added cache flushing for unaligned writes from an
iovec, covering the first and last cache line of a +AD4APQ- 8 byte write and
the first cache line of a +ADw- 8 byte write. But an unaligned write of
2-7 bytes can still cover two cache lines, so make sure we flush both
in that case.

Cc: +ADw-stable+AEA-vger.kernel.org+AD4-
Fixes: 11e63f6d920d (+ACI-x86, pmem: fix broken +AF8AXw-copy+AF8-user+AF8-nocache ...+ACI-)
Signed-off-by: Ben Hutchings +ADw-ben.hutchings+AEA-codethink.co.uk+AD4-
Signed-off-by: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-

commit 3ae3d67ba705c754a3c91ac009f9ce73a0e7286a
Author: Vishal Verma +ADw-vishal.l.verma+AEA-intel.com+AD4-
Date: Wed May 10 15:01:30 2017 -0600

libnvdimm: add an atomic vs process context flag to rw+AF8-bytes

nsio+AF8-rw+AF8-bytes can clear media errors, but this cannot be done while we
are in an atomic context due to locking within ACPI. From the BTT,
-+AD4-rw+AF8-bytes may be called either from atomic or process context depending
on whether the calls happen during initialization or during IO.

During init, we want to ensure error clearing happens, and the flag
marking process context allows nsio+AF8-rw+AF8-bytes to do that. When called
during IO, we're in atomic context, and error clearing can be skipped.

Cc: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-
Signed-off-by: Vishal Verma +ADw-vishal.l.verma+AEA-intel.com+AD4-
Signed-off-by: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-

commit b177fe85dd27de1ee4c29f59c4e82b3ea3b78784
Author: Vishal Verma +ADw-vishal.l.verma+AEA-intel.com+AD4-
Date: Wed May 10 15:01:31 2017 -0600

libnvdimm, btt: ensure that initializing metadata clears poison

If we had badblocks/poison in the metadata area of a BTT, recreating the
BTT would not clear the poison in all cases, notably the flog area. This
is because rw+AF8-bytes will only clear errors if the request being sent
down is 512B aligned and sized.

Make sure that when writing the map and info blocks, the rw+AF8-bytes being
sent are of the correct size/alignment. For the flog, instead of doing
the smaller log+AF8-entry writes only, first do a 'wipe' of the entire area
by writing zeroes in large enough chunks so that errors get cleared.

Cc: Andy Rudoff +ADw-andy.rudoff+AEA-intel.com+AD4-
Cc: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-
Signed-off-by: Vishal Verma +ADw-vishal.l.verma+AEA-intel.com+AD4-
Signed-off-by: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-

commit e84b83b9ee2187817cf895471675f1ccdf64cd53
Author: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-
Date: Wed May 10 19:38:13 2017 -0700

filesystem-dax: fix broken +AF8AXw-dax+AF8-zero+AF8-page+AF8-range() conversion

The conversion of +AF8AXw-dax+AF8-zero+AF8-page+AF8-range() to 'struct dax+AF8-operations'
caused it to frequently fail. The mistake was treating the +AEA-size
parameter as a dax mapping length rather than just a length of the
clear+AF8-pmem() operation. The dax mapping length is assumed to be hard
coded as PAGE+AF8-SIZE.

Without this fix any page unaligned zeroing request will trigger a
-EINVAL return from bdev+AF8-dax+AF8-pgoff().

Cc: Jan Kara +ADw-jack+AEA-suse.com+AD4-
Cc: Christoph Hellwig +ADw-hch+AEA-lst.de+AD4-
Reported-by: Ross Zwisler +ADw-ross.zwisler+AEA-linux.intel.com+AD4-
Tested-by: Ross Zwisler +ADw-ross.zwisler+AEA-linux.intel.com+AD4-
Fixes: cccbce671582 (+ACI-filesystem-dax: convert to dax+AF8-direct+AF8-access()+ACI-)
Signed-off-by: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-