1. 15 7月, 2019 1 次提交
  2. 15 6月, 2019 1 次提交
  3. 21 5月, 2019 1 次提交
  4. 01 5月, 2019 1 次提交
    • B
      dm: add dust target · e4f3fabd
      Bryan Gurney 提交于
      Add the dm-dust target, which simulates the behavior of bad sectors
      at arbitrary locations, and the ability to enable the emulation of
      the read failures at an arbitrary time.
      
      This target behaves similarly to a linear target.  At a given time,
      the user can send a message to the target to start failing read
      requests on specific blocks.  When the failure behavior is enabled,
      reads of blocks configured "bad" will fail with EIO.
      
      Writes of blocks configured "bad" will result in the following:
      
      1. Remove the block from the "bad block list".
      2. Successfully complete the write.
      
      After this point, the block will successfully contain the written
      data, and will service reads and writes normally.  This emulates the
      behavior of a "remapped sector" on a hard disk drive.
      
      dm-dust provides logging of which blocks have been added or removed
      to the "bad block list", as well as logging when a block has been
      removed from the bad block list.  These messages can be used
      alongside the messages from the driver using a dm-dust device to
      analyze the driver's behavior when a read fails at a given time.
      
      (This logging can be reduced via a "quiet" mode, if desired.)
      
      NOTE: If the block size is larger than 512 bytes, only the first sector
      of each "dust block" is detected.  Placing a limiting layer above a dust
      target, to limit the minimum I/O size to the dust block size, will
      ensure proper emulation of the given large block size.
      Signed-off-by: NBryan Gurney <bgurney@redhat.com>
      Co-developed-by: NJoe Shimkus <jshimkus@redhat.com>
      Co-developed-by: NJohn Dorminy <jdorminy@redhat.com>
      Co-developed-by: NJohn Pittman <jpittman@redhat.com>
      Co-developed-by: NThomas Jaskiewicz <tjaskiew@redhat.com>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      e4f3fabd
  5. 06 3月, 2019 1 次提交
    • H
      dm: add support to directly boot to a mapped device · 6bbc923d
      Helen Koike 提交于
      Add a "create" module parameter, which allows device-mapper targets to
      be configured at boot time. This enables early use of DM targets in the
      boot process (as the root device or otherwise) without the need of an
      initramfs.
      
      The syntax used in the boot param is based on the concise format from
      the dmsetup tool to follow the rule of least surprise:
      
      	dmsetup table --concise /dev/mapper/lroot
      
      Which is:
      	dm-mod.create=<name>,<uuid>,<minor>,<flags>,<table>[,<table>+][;<name>,<uuid>,<minor>,<flags>,<table>[,<table>+]+]
      
      Where,
      	<name>		::= The device name.
      	<uuid>		::= xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | ""
      	<minor>		::= The device minor number | ""
      	<flags>		::= "ro" | "rw"
      	<table>		::= <start_sector> <num_sectors> <target_type> <target_args>
      	<target_type>	::= "verity" | "linear" | ...
      
      For example, the following could be added in the boot parameters:
      dm-mod.create="lroot,,,rw, 0 4096 linear 98:16 0, 4096 4096 linear 98:32 0" root=/dev/dm-0
      
      Only the targets that were tested are allowed and the ones that don't
      change any block device when the device is create as read-only. For
      example, mirror and cache targets are not allowed. The rationale behind
      this is that if the user makes a mistake, choosing the wrong device to
      be the mirror or the cache can corrupt data.
      
      The only targets initially allowed are:
      * crypt
      * delay
      * linear
      * snapshot-origin
      * striped
      * verity
      Co-developed-by: NWill Drewry <wad@chromium.org>
      Co-developed-by: NKees Cook <keescook@chromium.org>
      Co-developed-by: NEnric Balletbo i Serra <enric.balletbo@collabora.com>
      Signed-off-by: NHelen Koike <helen.koike@collabora.com>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      6bbc923d
  6. 11 10月, 2018 1 次提交
  7. 08 6月, 2018 1 次提交
    • M
      dm: add writecache target · 48debafe
      Mikulas Patocka 提交于
      The writecache target caches writes on persistent memory or SSD.
      It is intended for databases or other programs that need extremely low
      commit latency.
      
      The writecache target doesn't cache reads because reads are supposed to
      be cached in page cache in normal RAM.
      
      If persistent memory isn't available this target can still be used in
      SSD mode.
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: Colin Ian King <colin.king@canonical.com> # fix missing goto
      Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> # fix compilation issue with !DAX
      Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> # use msecs_to_jiffies
      Acked-by: Dan Williams <dan.j.williams@intel.com> # reworks to unify ARM and x86 flushing
      Signed-off-by: NMike Snitzer <msnitzer@redhat.com>
      48debafe
  8. 03 4月, 2018 1 次提交
  9. 17 1月, 2018 1 次提交
  10. 02 11月, 2017 1 次提交
  11. 19 6月, 2017 1 次提交
    • D
      dm zoned: drive-managed zoned block device target · 3b1a94c8
      Damien Le Moal 提交于
      The dm-zoned device mapper target provides transparent write access
      to zoned block devices (ZBC and ZAC compliant block devices).
      dm-zoned hides to the device user (a file system or an application
      doing raw block device accesses) any constraint imposed on write
      requests by the device, equivalent to a drive-managed zoned block
      device model.
      
      Write requests are processed using a combination of on-disk buffering
      using the device conventional zones and direct in-place processing for
      requests aligned to a zone sequential write pointer position.
      A background reclaim process implemented using dm_kcopyd_copy ensures
      that conventional zones are always available for executing unaligned
      write requests. The reclaim process overhead is minimized by managing
      buffer zones in a least-recently-written order and first targeting the
      oldest buffer zones. Doing so, blocks under regular write access (such
      as metadata blocks of a file system) remain stored in conventional
      zones, resulting in no apparent overhead.
      
      dm-zoned implementation focus on simplicity and on minimizing overhead
      (CPU, memory and storage overhead). For a 14TB host-managed disk with
      256 MB zones, dm-zoned memory usage per disk instance is at most about
      3 MB and as little as 5 zones will be used internally for storing metadata
      and performing buffer zone reclaim operations. This is achieved using
      zone level indirection rather than a full block indirection system for
      managing block movement between zones.
      
      dm-zoned primary target is host-managed zoned block devices but it can
      also be used with host-aware device models to mitigate potential
      device-side performance degradation due to excessive random writing.
      
      Zoned block devices can be formatted and checked for use with the dm-zoned
      target using the dmzadm utility available at:
      
      https://github.com/hgst/dm-zoned-toolsSigned-off-by: NDamien Le Moal <damien.lemoal@wdc.com>
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Reviewed-by: NBart Van Assche <bart.vanassche@sandisk.com>
      [Mike Snitzer partly refactored Damien's original work to cleanup the code]
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      3b1a94c8
  12. 04 5月, 2017 1 次提交
  13. 21 4月, 2017 1 次提交
    • D
      dm: add dax_device and dax_operations support · f26c5719
      Dan Williams 提交于
      Allocate a dax_device to represent the capacity of a device-mapper
      instance. Provide a ->direct_access() method via the new dax_operations
      indirection that mirrors the functionality of the current direct_access
      support via block_device_operations.  Once fs/dax.c has been converted
      to use dax_operations the old dm_blk_direct_access() will be removed.
      
      A new helper dm_dax_get_live_target() is introduced to separate some of
      the dm-specifics from the direct_access implementation.
      
      This enabling is only for the top-level dm representation to upper
      layers. Converting target direct_access implementations is deferred to a
      separate patch.
      
      Cc: Toshi Kani <toshi.kani@hpe.com>
      Reviewed-by: NMike Snitzer <snitzer@redhat.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      f26c5719
  14. 30 3月, 2017 1 次提交
  15. 28 3月, 2017 1 次提交
  16. 25 3月, 2017 1 次提交
    • M
      dm: add integrity target · 7eada909
      Mikulas Patocka 提交于
      The dm-integrity target emulates a block device that has additional
      per-sector tags that can be used for storing integrity information.
      
      A general problem with storing integrity tags with every sector is that
      writing the sector and the integrity tag must be atomic - i.e. in case of
      crash, either both sector and integrity tag or none of them is written.
      
      To guarantee write atomicity the dm-integrity target uses a journal. It
      writes sector data and integrity tags into a journal, commits the journal
      and then copies the data and integrity tags to their respective location.
      
      The dm-integrity target can be used with the dm-crypt target - in this
      situation the dm-crypt target creates the integrity data and passes them
      to the dm-integrity target via bio_integrity_payload attached to the bio.
      In this mode, the dm-crypt and dm-integrity targets provide authenticated
      disk encryption - if the attacker modifies the encrypted device, an I/O
      error is returned instead of random data.
      
      The dm-integrity target can also be used as a standalone target, in this
      mode it calculates and verifies the integrity tag internally. In this
      mode, the dm-integrity target can be used to detect silent data
      corruption on the disk or in the I/O path.
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NMilan Broz <gmazyland@gmail.com>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      7eada909
  17. 08 3月, 2017 1 次提交
    • J
      dm cache: significant rework to leverage dm-bio-prison-v2 · b29d4986
      Joe Thornber 提交于
      The cache policy interfaces have been updated to work well with the new
      bio-prison v2 interface's ability to queue work immediately (promotion,
      demotion, etc) -- overriding benefit being reduced latency on processing
      IO through the cache.  Previously such work would be left for the DM
      cache core to queue on various lists and then process in batches later
      -- this caused a serious delay in latency for IO driven by the cache.
      
      The background tracker code was factored out so that all cache policies
      can make use of it.
      
      Also, the "cleaner" policy has been removed and is now a variant of the
      smq policy that simply disallows migrations.
      Signed-off-by: NJoe Thornber <ejt@redhat.com>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      b29d4986
  18. 15 11月, 2016 1 次提交
    • J
      dm block manager: make block locking optional · 2e8ed711
      Joe Thornber 提交于
      The block manager's locking is useful for catching cycles that may
      result from certain btree metadata corruption.  But in general it serves
      as a developer tool to catch bugs in code.  Unless you're finding that
      DM thin provisioning is hanging due to infinite loops within the block
      manager's access to btree nodes you can safely disable this feature.
      Signed-off-by: NJoe Thornber <ejt@redhat.com>
      Signed-off-by: Arnd Bergmann <arnd@arndb.de> # do/while(0) macro fix
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      2e8ed711
  19. 11 3月, 2016 2 次提交
  20. 10 12月, 2015 2 次提交
    • S
      dm verity: add support for forward error correction · a739ff3f
      Sami Tolvanen 提交于
      Add support for correcting corrupted blocks using Reed-Solomon.
      
      This code uses RS(255, N) interleaved across data and hash
      blocks. Each error-correcting block covers N bytes evenly
      distributed across the combined total data, so that each byte is a
      maximum distance away from the others. This makes it possible to
      recover from several consecutive corrupted blocks with relatively
      small space overhead.
      
      In addition, using verity hashes to locate erasures nearly doubles
      the effectiveness of error correction. Being able to detect
      corrupted blocks also improves performance, because only corrupted
      blocks need to corrected.
      
      For a 2 GiB partition, RS(255, 253) (two parity bytes for each
      253-byte block) can correct up to 16 MiB of consecutive corrupted
      blocks if erasures can be located, and 8 MiB if they cannot, with
      16 MiB space overhead.
      Signed-off-by: NSami Tolvanen <samitolvanen@google.com>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      a739ff3f
    • M
      dm bufio: store stacktrace in buffers to help find buffer leaks · 86bad0c7
      Mikulas Patocka 提交于
      The option DM_DEBUG_BLOCK_STACK_TRACING is moved from persistent-data
      directory to device mapper directory because it will now be used by
      persistent-data and bufio.  When the option is enabled, each bufio buffer
      stores the stacktrace of the last dm_bufio_get(), dm_bufio_read() or
      dm_bufio_new() call that increased the hold count to 1.  The buffer's
      stacktrace is printed if the buffer was not released before the bufio
      client is destroyed.
      
      When DM_DEBUG_BLOCK_STACK_TRACING is enabled, any bufio buffer leaks are
      considered warnings - i.e. the kernel continues afterwards.  If not
      enabled, buffer leaks are considered BUGs and the kernel with crash.
      Reasoning on this disposition is: if we only ever warned on buffer leaks
      users would generally ignore them and the problematic code would never
      get fixed.
      
      Successfully used to find source of bufio leaks fixed with commit
      fce079f63c3 ("dm btree: fix bufio buffer leaks in dm_btree_del() error
      path").
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      86bad0c7
  21. 09 11月, 2015 1 次提交
  22. 12 9月, 2015 1 次提交
  23. 07 8月, 2015 1 次提交
  24. 27 7月, 2015 1 次提交
  25. 12 6月, 2015 1 次提交
    • J
      dm cache: add stochastic-multi-queue (smq) policy · 66a63635
      Joe Thornber 提交于
      The stochastic-multi-queue (smq) policy addresses some of the problems
      with the current multiqueue (mq) policy.
      
      Memory usage
      ------------
      
      The mq policy uses a lot of memory; 88 bytes per cache block on a 64
      bit machine.
      
      SMQ uses 28bit indexes to implement it's data structures rather than
      pointers.  It avoids storing an explicit hit count for each block.  It
      has a 'hotspot' queue rather than a pre cache which uses a quarter of
      the entries (each hotspot block covers a larger area than a single
      cache block).
      
      All these mean smq uses ~25bytes per cache block.  Still a lot of
      memory, but a substantial improvement nontheless.
      
      Level balancing
      ---------------
      
      MQ places entries in different levels of the multiqueue structures
      based on their hit count (~ln(hit count)).  This means the bottom
      levels generally have the most entries, and the top ones have very
      few.  Having unbalanced levels like this reduces the efficacy of the
      multiqueue.
      
      SMQ does not maintain a hit count, instead it swaps hit entries with
      the least recently used entry from the level above.  The over all
      ordering being a side effect of this stochastic process.  With this
      scheme we can decide how many entries occupy each multiqueue level,
      resulting in better promotion/demotion decisions.
      
      Adaptability
      ------------
      
      The MQ policy maintains a hit count for each cache block.  For a
      different block to get promoted to the cache it's hit count has to
      exceed the lowest currently in the cache.  This means it can take a
      long time for the cache to adapt between varying IO patterns.
      Periodically degrading the hit counts could help with this, but I
      haven't found a nice general solution.
      
      SMQ doesn't maintain hit counts, so a lot of this problem just goes
      away.  In addition it tracks performance of the hotspot queue, which
      is used to decide which blocks to promote.  If the hotspot queue is
      performing badly then it starts moving entries more quickly between
      levels.  This lets it adapt to new IO patterns very quickly.
      
      Performance
      -----------
      
      In my tests SMQ shows substantially better performance than MQ.  Once
      this matures a bit more I'm sure it'll become the default policy.
      Signed-off-by: NJoe Thornber <ejt@redhat.com>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      66a63635
  26. 16 4月, 2015 2 次提交
    • J
      dm: add log writes target · 0e9cebe7
      Josef Bacik 提交于
      Introduce a new target that is meant for file system developers to test file
      system integrity at particular points in the life of a file system.  We capture
      all write requests and associated data and log them to a separate device
      for later replay.  There is a userspace utility to do this replay.  The
      idea behind this is to give file system developers a tool to verify that
      the file system is always consistent.
      Signed-off-by: NJosef Bacik <jbacik@fb.com>
      Reviewed-by: NZach Brown <zab@zabbo.net>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      0e9cebe7
    • M
      dm: add 'use_blk_mq' module param and expose in per-device ro sysfs attr · 17e149b8
      Mike Snitzer 提交于
      Request-based DM's blk-mq support defaults to off; but a user can easily
      change the default using the dm_mod.use_blk_mq module/boot option.
      
      Also, you can check what mode a given request-based DM device is using
      with: cat /sys/block/dm-X/dm/use_blk_mq
      
      This change enabled further cleanup and reduced work (e.g. the
      md->io_pool and md->rq_pool isn't created if using blk-mq).
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      17e149b8
  27. 23 2月, 2015 1 次提交
  28. 10 2月, 2015 1 次提交
  29. 07 1月, 2015 2 次提交
  30. 28 3月, 2014 1 次提交
    • J
      dm: add era target · eec40579
      Joe Thornber 提交于
      dm-era is a target that behaves similar to the linear target.  In
      addition it keeps track of which blocks were written within a user
      defined period of time called an 'era'.  Each era target instance
      maintains the current era as a monotonically increasing 32-bit
      counter.
      
      Use cases include tracking changed blocks for backup software, and
      partially invalidating the contents of a cache to restore cache
      coherency after rolling back a vendor snapshot.
      
      dm-era is primarily expected to be paired with the dm-cache target.
      Signed-off-by: NJoe Thornber <ejt@redhat.com>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      eec40579
  31. 04 3月, 2014 1 次提交
  32. 15 1月, 2014 2 次提交
    • M
      dm sysfs: fix a module unload race · 2995fa78
      Mikulas Patocka 提交于
      This reverts commit be35f486 ("dm: wait until embedded kobject is
      released before destroying a device") and provides an improved fix.
      
      The kobject release code that calls the completion must be placed in a
      non-module file, otherwise there is a module unload race (if the process
      calling dm_kobject_release is preempted and the DM module unloaded after
      the completion is triggered, but before dm_kobject_release returns).
      
      To fix this race, this patch moves the completion code to dm-builtin.c
      which is always compiled directly into the kernel if BLK_DEV_DM is
      selected.
      
      The patch introduces a new dm_kobject_holder structure, its purpose is
      to keep the completion and kobject in one place, so that it can be
      accessed from non-module code without the need to export the layout of
      struct mapped_device to that code.
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      Cc: stable@vger.kernel.org
      2995fa78
    • M
      dm snapshot: use dm-bufio · 55494bf2
      Mikulas Patocka 提交于
      Use dm-bufio for initial loading of the exceptions.
      Introduce a new function dm_bufio_forget that frees the given buffer.
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      55494bf2
  33. 07 1月, 2014 1 次提交
  34. 10 11月, 2013 1 次提交
  35. 11 7月, 2013 1 次提交
    • J
      dm: add switch target · 9d0eb0ab
      Jim Ramsay 提交于
      dm-switch is a new target that maps IO to underlying block devices
      efficiently when there is a large number of fixed-sized address regions
      but there is no simple pattern to allow for a compact mapping
      representation such as dm-stripe.
      
      Though we have developed this target for a specific storage device, Dell
      EqualLogic, we have made an effort to keep it as general purpose as
      possible in the hope that others may benefit.
      
      Originally developed by Jim Ramsay. Simplified by Mikulas Patocka.
      Signed-off-by: NJim Ramsay <jim_ramsay@dell.com>
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      9d0eb0ab