]> git.baikalelectronics.ru Git - kernel.git/commitdiff
Merge tag 'libnvdimm-for-4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdim...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 6 May 2017 01:49:20 +0000 (18:49 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 6 May 2017 01:49:20 +0000 (18:49 -0700)
Pull libnvdimm updates from Dan Williams:
 "The bulk of this has been in multiple -next releases. There were a few
  late breaking fixes and small features that got added in the last
  couple days, but the whole set has received a build success
  notification from the kbuild robot.

  Change summary:

   - Region media error reporting: A libnvdimm region device is the
     parent to one or more namespaces. To date, media errors have been
     reported via the "badblocks" attribute attached to pmem block
     devices for namespaces in "raw" or "memory" mode. Given that
     namespaces can be in "device-dax" or "btt-sector" mode this new
     interface reports media errors generically, i.e. independent of
     namespace modes or state.

     This subsequently allows userspace tooling to craft "ACPI 6.1
     Section 9.20.7.6 Function Index 4 - Clear Uncorrectable Error"
     requests and submit them via the ioctl path for NVDIMM root bus
     devices.

   - Introduce 'struct dax_device' and 'struct dax_operations': Prompted
     by a request from Linus and feedback from Christoph this allows for
     dax capable drivers to publish their own custom dax operations.
     This fixes the broken assumption that all dax operations are
     related to a persistent memory device, and makes it easier for
     other architectures and platforms to add customized persistent
     memory support.

   - 'libnvdimm' core updates: A new "deep_flush" sysfs attribute is
     available for storage appliance applications to manually trigger
     memory controllers to drain write-pending buffers that would
     otherwise be flushed automatically by the platform ADR
     (asynchronous-DRAM-refresh) mechanism at a power loss event.
     Support for "locked" DIMMs is included to prevent namespaces from
     surfacing when the namespace label data area is locked. Finally,
     fixes for various reported deadlocks and crashes, also tagged for
     -stable.

   - ACPI / nfit driver updates: General updates of the nfit driver to
     add DSM command overrides, ACPI 6.1 health state flags support, DSM
     payload debug available by default, and various fixes.

  Acknowledgements that came after the branch was pushed:

   - commmit 6ac1b0f286a8 "device-dax: fix sysfs attribute deadlock":
Tested-by: Yi Zhang <yizhan@redhat.com>
   - commit e251ee5093c1 "libnvdimm: rework region badblocks clearing"
Tested-by: Toshi Kani <toshi.kani@hpe.com>"
* tag 'libnvdimm-for-4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: (52 commits)
  libnvdimm, pfn: fix 'npfns' vs section alignment
  libnvdimm: handle locked label storage areas
  libnvdimm: convert NDD_ flags to use bitops, introduce NDD_LOCKED
  brd: fix uninitialized use of brd->dax_dev
  block, dax: use correct format string in bdev_dax_supported
  device-dax: fix sysfs attribute deadlock
  libnvdimm: restore "libnvdimm: band aid btt vs clear poison locking"
  libnvdimm: fix nvdimm_bus_lock() vs device_lock() ordering
  libnvdimm: rework region badblocks clearing
  acpi, nfit: kill ACPI_NFIT_DEBUG
  libnvdimm: fix clear length of nvdimm_forget_poison()
  libnvdimm, pmem: fix a NULL pointer BUG in nd_pmem_notify
  libnvdimm, region: sysfs trigger for nvdimm_flush()
  libnvdimm: fix phys_addr for nvdimm_clear_poison
  x86, dax, pmem: remove indirection around memcpy_from_pmem()
  block: remove block_device_operations ->direct_access()
  block, dax: convert bdev_dax_supported() to dax_direct_access()
  filesystem-dax: convert to dax_direct_access()
  Revert "block: use DAX for partition table reads"
  ext2, ext4, xfs: retrieve dax_device for iomap operations
  ...

21 files changed:
1  2 
block/Kconfig
block/partition-generic.c
drivers/Makefile
drivers/block/Kconfig
drivers/block/brd.c
drivers/dax/pmem.c
drivers/md/Kconfig
drivers/md/dm-core.h
drivers/md/dm-linear.c
drivers/md/dm-stripe.c
drivers/md/dm-target.c
drivers/md/dm.c
drivers/nvdimm/pmem.c
fs/block_dev.c
fs/dax.c
fs/ext2/inode.c
fs/ext4/inode.c
fs/iomap.c
include/linux/blkdev.h
include/linux/device-mapper.h
include/linux/string.h

diff --cc block/Kconfig
Simple merge
Simple merge
Simple merge
Simple merge
index 4ec84d504780d9b606efe3dfdfb6910d1380d0bc,ec00c01b8dc3dd75487353e28d180bf51d213469..57b574f2f66a9d75a86f56a187e0fc9273b7c593
@@@ -415,9 -476,11 +427,6 @@@ static struct brd_device *brd_alloc(in
         *  is harmless)
         */
        blk_queue_physical_block_size(brd->brd_queue, PAGE_SIZE);
- #ifdef CONFIG_BLK_DEV_RAM_DAX
-       queue_flag_set_unlocked(QUEUE_FLAG_DAX, brd->brd_queue);
- #endif
 -
 -      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;
 -      queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, brd->brd_queue);
        disk = brd->brd_disk = alloc_disk(max_part);
        if (!disk)
                goto out_free_queue;
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc drivers/md/dm.c
Simple merge
index fbc640bf06b01821c108711a89dea3564355357e,58db813e7b7b1ceafe86e1a31be3dda112c2db44..c544d466ea51071a3c09a53544df61d8a1bae759
@@@ -232,15 -243,14 +244,19 @@@ static void pmem_release_queue(void *q
        blk_cleanup_queue(q);
  }
  
- static void pmem_release_disk(void *disk)
 +static void pmem_freeze_queue(void *q)
 +{
 +      blk_freeze_queue_start(q);
 +}
 +
+ static void pmem_release_disk(void *__pmem)
  {
-       del_gendisk(disk);
-       put_disk(disk);
+       struct pmem_device *pmem = __pmem;
+       kill_dax(pmem->dax_dev);
+       put_dax(pmem->dax_dev);
+       del_gendisk(pmem->disk);
+       put_disk(pmem->disk);
  }
  
  static int pmem_attach_disk(struct device *dev,
diff --cc fs/block_dev.c
Simple merge
diff --cc fs/dax.c
index 6433650be833876eea42cd36ca109e4298bff073,ce9dc9c3e829eef663d7f448ad1a6c7b0000a84c..43bbd6d1037d20099bc50393ab2b255f02e188a7
+++ b/fs/dax.c
@@@ -979,24 -956,34 +965,34 @@@ static bool dax_range_is_aligned(struc
        return true;
  }
  
- int __dax_zero_page_range(struct block_device *bdev, sector_t sector,
-               unsigned int offset, unsigned int length)
+ int __dax_zero_page_range(struct block_device *bdev,
+               struct dax_device *dax_dev, sector_t sector,
+               unsigned int offset, unsigned int size)
  {
-       struct blk_dax_ctl dax = {
-               .sector         = sector,
-               .size           = PAGE_SIZE,
-       };
-       if (dax_range_is_aligned(bdev, offset, length)) {
-               sector_t start_sector = dax.sector + (offset >> 9);
+       if (dax_range_is_aligned(bdev, offset, size)) {
+               sector_t start_sector = sector + (offset >> 9);
  
                return blkdev_issue_zeroout(bdev, start_sector,
-                               length >> 9, GFP_NOFS, 0);
 -                              size >> 9, GFP_NOFS, true);
++                              size >> 9, GFP_NOFS, 0);
        } else {
-               if (dax_map_atomic(bdev, &dax) < 0)
-                       return PTR_ERR(dax.addr);
-               clear_pmem(dax.addr + offset, length);
-               dax_unmap_atomic(bdev, &dax);
+               pgoff_t pgoff;
+               long rc, id;
+               void *kaddr;
+               pfn_t pfn;
+               rc = bdev_dax_pgoff(bdev, sector, size, &pgoff);
+               if (rc)
+                       return rc;
+               id = dax_read_lock();
+               rc = dax_direct_access(dax_dev, pgoff, PHYS_PFN(size), &kaddr,
+                               &pfn);
+               if (rc < 0) {
+                       dax_read_unlock(id);
+                       return rc;
+               }
+               clear_pmem(kaddr + offset, size);
+               dax_read_unlock(id);
        }
        return 0;
  }
diff --cc fs/ext2/inode.c
Simple merge
diff --cc fs/ext4/inode.c
Simple merge
diff --cc fs/iomap.c
Simple merge
Simple merge
Simple merge
Simple merge