1. 17 1月, 2020 1 次提交
  2. 06 7月, 2019 1 次提交
  3. 05 6月, 2019 1 次提交
  4. 26 5月, 2019 2 次提交
    • D
      vfs: Convert dax to use the new mount API · 75d4e06f
      David Howells 提交于
      Convert the dax filesystem to the new internal mount API as the old
      one will be obsoleted and removed.  This allows greater flexibility in
      communication of mount parameters between userspace, the VFS and the
      filesystem.
      
      See Documentation/filesystems/mount_api.txt for more information.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      cc: Dan Williams <dan.j.williams@intel.com>
      cc: Vishal Verma <vishal.l.verma@intel.com>
      cc: Keith Busch <keith.busch@intel.com>
      cc: Dave Jiang <dave.jiang@intel.com>
      cc: linux-nvdimm@lists.01.org
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      75d4e06f
    • A
      mount_pseudo(): drop 'name' argument, switch to d_make_root() · 1f58bb18
      Al Viro 提交于
      Once upon a time we used to set ->d_name of e.g. pipefs root
      so that d_path() on pipes would work.  These days it's
      completely pointless - dentries of pipes are not even connected
      to pipefs root.  However, mount_pseudo() had set the root
      dentry name (passed as the second argument) and callers
      kept inventing names to pass to it.  Including those that
      didn't *have* any non-root dentries to start with...
      
      All of that had been pointless for about 8 years now; it's
      time to get rid of that cargo-culting...
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      1f58bb18
  5. 21 5月, 2019 2 次提交
  6. 02 5月, 2019 1 次提交
  7. 21 2月, 2019 1 次提交
  8. 07 1月, 2019 2 次提交
    • D
      device-dax: Introduce bus + driver model · 9567da0b
      Dan Williams 提交于
      In support of multiple device-dax instances per device-dax-region and
      allowing the 'kmem' driver to attach to dax-instances instead of the
      current device-node access, convert the dax sub-system from a class to a
      bus. Recall that the kmem driver takes reserved / special purpose
      memories and assigns them to be managed by the core-mm.
      
      Aside from the fact the device-dax instances are registered and probed
      on a bus, two other lifetime-management changes are made:
      
      1/ Delay attaching a cdev until driver probe time
      
      2/ A new run_dax() helper is introduced to allow restoring dax-operation
         after a kill_dax() event. So, at driver ->probe() time we run_dax()
         and at ->remove() time we kill_dax() and invalidate all mappings.
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      9567da0b
    • D
      device-dax: Start defining a dax bus model · 51cf784c
      Dan Williams 提交于
      Towards eliminating the dax_class, move the dax-device-attribute
      enabling to a new bus.c file in the core. The amount of code
      thrash of sub-sequent patches is reduced as no logic changes are made,
      just pure code movement.
      
      A temporary export of unregister_dex_dax() and dax_attribute_groups is
      needed to preserve compilation, but those symbols become static again in
      a follow-on patch.
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      51cf784c
  9. 31 7月, 2018 1 次提交
  10. 29 6月, 2018 1 次提交
  11. 07 6月, 2018 1 次提交
  12. 31 5月, 2018 2 次提交
  13. 23 5月, 2018 1 次提交
    • D
      dax: Introduce a ->copy_to_iter dax operation · b3a9a0c3
      Dan Williams 提交于
      Similar to the ->copy_from_iter() operation, a platform may want to
      deploy an architecture or device specific routine for handling reads
      from a dax_device like /dev/pmemX. On x86 this routine will point to a
      machine check safe version of copy_to_iter(). For now, add the plumbing
      to device-mapper and the dax core.
      
      Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
      Cc: Mike Snitzer <snitzer@redhat.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      b3a9a0c3
  14. 22 5月, 2018 1 次提交
    • D
      mm: introduce MEMORY_DEVICE_FS_DAX and CONFIG_DEV_PAGEMAP_OPS · e7638488
      Dan Williams 提交于
      In preparation for fixing dax-dma-vs-unmap issues, filesystems need to
      be able to rely on the fact that they will get wakeups on dev_pagemap
      page-idle events. Introduce MEMORY_DEVICE_FS_DAX and
      generic_dax_page_free() as common indicator / infrastructure for dax
      filesytems to require. With this change there are no users of the
      MEMORY_DEVICE_HOST designation, so remove it.
      
      The HMM sub-system extended dev_pagemap to arrange a callback when a
      dev_pagemap managed page is freed. Since a dev_pagemap page is free /
      idle when its reference count is 1 it requires an additional branch to
      check the page-type at put_page() time. Given put_page() is a hot-path
      we do not want to incur that check if HMM is not in use, so a static
      branch is used to avoid that overhead when not necessary.
      
      Now, the FS_DAX implementation wants to reuse this mechanism for
      receiving dev_pagemap ->page_free() callbacks. Rework the HMM-specific
      static-key into a generic mechanism that either HMM or FS_DAX code paths
      can enable.
      
      For ARCH=um builds, and any other arch that lacks ZONE_DEVICE support,
      care must be taken to compile out the DEV_PAGEMAP_OPS infrastructure.
      However, we still need to support FS_DAX in the FS_DAX_LIMITED case
      implemented by the s390/dcssblk driver.
      
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Reported-by: Nkbuild test robot <lkp@intel.com>
      Reported-by: NThomas Meyer <thomas@m3y3r.de>
      Reported-by: NDave Jiang <dave.jiang@intel.com>
      Cc: "Jérôme Glisse" <jglisse@redhat.com>
      Reviewed-by: NJan Kara <jack@suse.cz>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      e7638488
  15. 31 3月, 2018 1 次提交
  16. 27 2月, 2018 1 次提交
  17. 20 1月, 2018 1 次提交
    • D
      dax: require 'struct page' by default for filesystem dax · 569d0365
      Dan Williams 提交于
      If a dax buffer from a device that does not map pages is passed to
      read(2) or write(2) as a target for direct-I/O it triggers SIGBUS. If
      gdb attempts to examine the contents of a dax buffer from a device that
      does not map pages it triggers SIGBUS. If fork(2) is called on a process
      with a dax mapping from a device that does not map pages it triggers
      SIGBUS. 'struct page' is required otherwise several kernel code paths
      break in surprising ways. Disable filesystem-dax on devices that do not
      map pages.
      
      In addition to needing pfn_to_page() to be valid we also require devmap
      pages.  We need this to detect dax pages in the get_user_pages_fast()
      path and so that we can stop managing the VM_MIXEDMAP flag. For DAX
      drivers that have not supported get_user_pages() to date we allow them
      to opt-in to supporting DAX with the CONFIG_FS_DAX_LIMITED configuration
      option which requires ->direct_access() to return pfn_t_special() pfns.
      This leaves DAX support in brd disabled and scheduled for removal.
      
      Note that when the initial dax support was being merged a few years back
      there was concern that struct page was unsuitable for use with next
      generation persistent memory devices. The theoretical concern was that
      struct page access, being such a hotly used data structure in the
      kernel, would lead to media wear out. While that was a reasonable
      conservative starting position it has not held true in practice. We have
      long since committed to using devm_memremap_pages() to support higher
      order kernel functionality that needs get_user_pages() and
      pfn_to_page().
      
      
      Cc: Jeff Moyer <jmoyer@redhat.com>
      Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Reviewed-by: NJan Kara <jack@suse.cz>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NGerald Schaefer <gerald.schaefer@de.ibm.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      569d0365
  18. 15 11月, 2017 3 次提交
  19. 29 9月, 2017 1 次提交
  20. 11 9月, 2017 1 次提交
    • M
      dax: remove the pmem_dax_ops->flush abstraction · c3ca015f
      Mikulas Patocka 提交于
      Commit abebfbe2 ("dm: add ->flush() dax operation support") is
      buggy. A DM device may be composed of multiple underlying devices and
      all of them need to be flushed. That commit just routes the flush
      request to the first device and ignores the other devices.
      
      It could be fixed by adding more complex logic to the device mapper. But
      there is only one implementation of the method pmem_dax_ops->flush - that
      is pmem_dax_flush() - and it calls arch_wb_cache_pmem(). Consequently, we
      don't need the pmem_dax_ops->flush abstraction at all, we can call
      arch_wb_cache_pmem() directly from dax_flush() because dax_dev->ops->flush
      can't ever reach anything different from arch_wb_cache_pmem().
      
      It should be also pointed out that for some uses of persistent memory it
      is needed to flush only a very small amount of data (such as 1 cacheline),
      and it would be overkill if we go through that device mapper machinery for
      a single flushed cache line.
      
      Fix this by removing the pmem_dax_ops->flush abstraction and call
      arch_wb_cache_pmem() directly from dax_flush(). Also, remove the device
      mapper code that forwards the flushes.
      
      Fixes: abebfbe2 ("dm: add ->flush() dax operation support")
      Cc: stable@vger.kernel.org
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Reviewed-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      c3ca015f
  21. 04 9月, 2017 1 次提交
    • D
      dax: fix FS_DAX=n BLOCK=y compilation · 26f2f4de
      Dan Williams 提交于
      The 0day kbuild robot reports:
      
      >> drivers//dax/super.c:64:20: error: redefinition of 'fs_dax_get_by_bdev'
          struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev)
                             ^~~~~~~~~~~~~~~~~~
         In file included from drivers//dax/super.c:22:0:
         include/linux/dax.h:76:34: note: previous definition of 'fs_dax_get_by_bdev' was here
          static inline struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev)
                                           ^~~~~~~~~~~~~~~~~~
      
      Protect the definition of fs_dax_get_by_bdev() in drivers/dax/super.c
      with an ifdef.
      
      Fixes: 78f35473 ("dax: introduce a fs_dax_get_by_bdev() helper")
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Darrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: NJan Kara <jack@suse.cz>
      Reported-by: Nkbuild test robot <fengguang.wu@intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      26f2f4de
  22. 31 8月, 2017 1 次提交
  23. 27 7月, 2017 1 次提交
  24. 30 6月, 2017 2 次提交
    • D
      libnvdimm, pmem, dax: export a cache control attribute · 6e0c90d6
      Dan Williams 提交于
      The dax_flush() operation can be turned into a nop on platforms where
      firmware arranges for cpu caches to be flushed on a power-fail event.
      The ACPI 6.2 specification defines a mechanism for the platform to
      indicate this capability so the kernel can select the proper default.
      However, for other platforms, the administrator must toggle this setting
      manually.
      
      Given this flush setting is a dax-specific mechanism we advertise it
      through a 'dax' attribute group hanging off a host device. For example,
      a 'pmem0' block-device gets a 'dax' sysfs-subdirectory with a
      'write_cache' attribute to control response to dax cache flush requests.
      This is similar to the 'queue/write_cache' attribute that appears under
      block devices.
      
      Cc: Jan Kara <jack@suse.cz>
      Cc: Jeff Moyer <jmoyer@redhat.com>
      Cc: Matthew Wilcox <mawilcox@microsoft.com>
      Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
      Suggested-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      6e0c90d6
    • D
      dax: convert to bitmask for flags · 9a60c3ef
      Dan Williams 提交于
      In preparation for adding more flags, convert the existing flag to a
      bit-flag.
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      9a60c3ef
  25. 28 6月, 2017 1 次提交
  26. 16 6月, 2017 1 次提交
  27. 10 6月, 2017 1 次提交
  28. 09 6月, 2017 1 次提交
    • D
      device-dax: fix 'dax' device filesystem inode destruction crash · b9d39d17
      Dan Williams 提交于
      The inode destruction path for the 'dax' device filesystem incorrectly
      assumes that the inode was initialized through 'alloc_dax()'. However,
      if someone attempts to directly mount the dax filesystem with 'mount -t
      dax dax mnt' that will bypass 'alloc_dax()' and the following failure
      signatures may occur as a result:
      
       kill_dax() must be called before final iput()
       WARNING: CPU: 2 PID: 1188 at drivers/dax/super.c:243 dax_destroy_inode+0x48/0x50
       RIP: 0010:dax_destroy_inode+0x48/0x50
       Call Trace:
        destroy_inode+0x3b/0x60
        evict+0x139/0x1c0
        iput+0x1f9/0x2d0
        dentry_unlink_inode+0xc3/0x160
        __dentry_kill+0xcf/0x180
        ? dput+0x37/0x3b0
        dput+0x3a3/0x3b0
        do_one_tree+0x36/0x40
        shrink_dcache_for_umount+0x2d/0x90
        generic_shutdown_super+0x1f/0x120
        kill_anon_super+0x12/0x20
        deactivate_locked_super+0x43/0x70
        deactivate_super+0x4e/0x60
      
       general protection fault: 0000 [#1] SMP DEBUG_PAGEALLOC
       RIP: 0010:kfree+0x6d/0x290
       Call Trace:
        <IRQ>
        dax_i_callback+0x22/0x60
        ? dax_destroy_inode+0x50/0x50
        rcu_process_callbacks+0x298/0x740
      
       ida_remove called for id=0 which is not allocated.
       WARNING: CPU: 0 PID: 0 at lib/idr.c:383 ida_remove+0x110/0x120
       [..]
       Call Trace:
        <IRQ>
        ida_simple_remove+0x2b/0x50
        ? dax_destroy_inode+0x50/0x50
        dax_i_callback+0x3c/0x60
        rcu_process_callbacks+0x298/0x740
      
      Add missing initialization of the 'struct dax_device' and inode so that
      the destruction path does not kfree() or ida_simple_remove()
      uninitialized data.
      
      Fixes: 7b6be844 ("dax: refactor dax-fs into a generic provider of 'struct dax_device' instances")
      Reported-by: NSasha Levin <alexander.levin@verizon.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      b9d39d17
  29. 14 5月, 2017 1 次提交
  30. 10 5月, 2017 1 次提交
  31. 09 5月, 2017 1 次提交
    • D
      block, dax: move "select DAX" from BLOCK to FS_DAX · ef510424
      Dan Williams 提交于
      For configurations that do not enable DAX filesystems or drivers, do not
      require the DAX core to be built.
      
      Given that the 'direct_access' method has been removed from
      'block_device_operations', we can also go ahead and remove the
      block-related dax helper functions from fs/block_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_DAX=n case.
      
      Filesystems need to include dax.h to call bdev_dax_supported().
      
      Cc: linux-xfs@vger.kernel.org
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Cc: Matthew Wilcox <mawilcox@microsoft.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: "Darrick J. Wong" <darrick.wong@oracle.com>
      Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
      Reviewed-by: NJan Kara <jack@suse.com>
      Reported-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      ef510424
  32. 21 4月, 2017 1 次提交
    • D
      dax: introduce dax_direct_access() · b0686260
      Dan Williams 提交于
      Replace bdev_direct_access() with dax_direct_access() that uses
      dax_device and dax_operations instead of a block_device and
      block_device_operations for dax. Once all consumers of the old api have
      been converted bdev_direct_access() will be deleted.
      
      Given that block device partitioning decisions can cause dax page
      alignment constraints to be violated this also introduces the
      bdev_dax_pgoff() helper. It handles calculating a logical pgoff relative
      to the dax_device and also checks for page alignment.
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      b0686260
  33. 20 4月, 2017 1 次提交
    • D
      dax: introduce dax_operations · 6568b08b
      Dan Williams 提交于
      Track a set of dax_operations per dax_device that can be set at
      alloc_dax() time. These operations will be used to stop the abuse of
      block_device_operations for communicating dax capabilities to
      filesystems. It will also be used to replace the "pmem api" and move
      pmem-specific cache maintenance, and other dax-driver-specific
      filesystem-dax operations, to dax device methods. In particular this
      allows us to stop abusing __copy_user_nocache(), via memcpy_to_pmem(),
      with a driver specific replacement.
      
      This is a standalone introduction of the operations. Follow on patches
      convert each dax-driver and teach fs/dax.c to use ->direct_access() from
      dax_operations instead of block_device_operations.
      Suggested-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      6568b08b