1. 21 Nov, 2014 1 commit
    • Mike Snitzer's avatar
      dm thin: fix pool_io_hints to avoid looking at max_hw_sectors · d200c30e
      Mike Snitzer authored
      Simplify the pool_io_hints code that works to establish a max_sectors
      value that is a power-of-2 factor of the thin-pool's blocksize.  The
      biggest associated improvement is that the DM thin-pool is no longer
      concerning itself with the data device's max_hw_sectors when adjusting
      max_sectors.
      
      This fixes the relative fragility of the original "dm thin: adjust
      max_sectors_kb based on thinp blocksize" commit that only became
      apparent when testing was performed using a DM thin-pool ontop of a
      virtio_blk device.  One proposed upstream patch detailed the problems
      inherent in virtio_blk: https://lkml.org/lkml/2014/11/20/611
      
      So even though virtio_blk incorrectly set its max_hw_sectors it actually
      helped make it clear that we need DM thinp to be tolerant of any future
      Linux driver that incorrectly sets max_hw_sectors.
      
      We only need to be concerned with modifying the thin-pool device's
      max_sectors limit if it is smaller than the thin-pool's blocksize.  In
      this case the value of max_sectors does become a limiting factor when
      upper layers (e.g. filesystems) construct their bios.  But if the
      hardware can support IOs larger than the thin-pool's blocksize the user
      is encouraged to adjust the thin-pool's data device's max_sectors
      accordingly -- doing so will enable the thin-pool to inherit the
      established user-defined max_sectors.
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      d200c30e
  2. 19 Nov, 2014 5 commits
    • Mike Snitzer's avatar
      dm thin: suspend/resume active thin devices when reloading thin-pool · 583024d2
      Mike Snitzer authored
      Before this change it was expected that userspace would first suspend
      all active thin devices, reload/resize the thin-pool target, then resume
      all active thin devices.  Now the thin-pool suspend/resume will trigger
      the suspend/resume of all active thins via appropriate calls to
      dm_internal_suspend and dm_internal_resume.
      
      Store the mapped_device for each thin device in struct thin_c to make
      these calls possible.
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Acked-by: default avatarJoe Thornber <ejt@redhat.com>
      583024d2
    • Mike Snitzer's avatar
      dm: enhance internal suspend and resume interface · ffcc3936
      Mike Snitzer authored
      Rename dm_internal_{suspend,resume} to dm_internal_{suspend,resume}_fast
      -- dm-stats will continue using these methods to avoid all the extra
      suspend/resume logic that is not needed in order to quickly flush IO.
      
      Introduce dm_internal_suspend_noflush() variant that actually calls the
      mapped_device's target callbacks -- otherwise target-specific hooks are
      avoided (e.g. dm-thin's thin_presuspend and thin_postsuspend).  Common
      code between dm_internal_{suspend_noflush,resume} and
      dm_{suspend,resume} was factored out as __dm_{suspend,resume}.
      
      Update dm_internal_{suspend_noflush,resume} to always take and release
      the mapped_device's suspend_lock.  Also update dm_{suspend,resume} to be
      aware of potential for DM_INTERNAL_SUSPEND_FLAG to be set and respond
      accordingly by interruptibly waiting for the DM_INTERNAL_SUSPEND_FLAG to
      be cleared.  Add lockdep annotation to dm_suspend() and dm_resume().
      
      The existing DM_SUSPEND_FLAG remains unchanged.
      DM_INTERNAL_SUSPEND_FLAG is set by dm_internal_suspend_noflush() and
      cleared by dm_internal_resume().
      
      Both DM_SUSPEND_FLAG and DM_INTERNAL_SUSPEND_FLAG may be set if a device
      was already suspended when dm_internal_suspend_noflush() was called --
      this can be thought of as a "nested suspend".  A "nested suspend" can
      occur with legacy userspace dm-thin code that might suspend all active
      thin volumes before suspending the pool for resize.
      
      But otherwise, in the normal dm-thin-pool suspend case moving forward:
      the thin-pool will have DM_SUSPEND_FLAG set and all active thins from
      that thin-pool will have DM_INTERNAL_SUSPEND_FLAG set.
      
      Also add DM_INTERNAL_SUSPEND_FLAG to status report.  This new
      DM_INTERNAL_SUSPEND_FLAG state is being reported to assist with
      debugging (e.g. 'dmsetup info' will report an internally suspended
      device accordingly).
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Acked-by: default avatarJoe Thornber <ejt@redhat.com>
      ffcc3936
    • Mike Snitzer's avatar
      dm thin: do not allow thin device activation while pool is suspended · 80e96c54
      Mike Snitzer authored
      Otherwise IO could be issued to the pool while it is suspended.
      
      Care was taken to properly interlock between the thin and thin-pool
      targets when accessing the pool's 'suspended' flag.  The thin_ctr will
      not add a new thin device to the pool's active_thins list if the pool is
      susepended.
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Acked-by: default avatarJoe Thornber <ejt@redhat.com>
      80e96c54
    • Mike Snitzer's avatar
      dm: add presuspend_undo hook to target_type · d67ee213
      Mike Snitzer authored
      The DM thin-pool target now must undo the changes performed during
      pool_presuspend() so introduce presuspend_undo hook in target_type.
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Acked-by: default avatarJoe Thornber <ejt@redhat.com>
      d67ee213
    • Mike Snitzer's avatar
      dm: return earlier from dm_blk_ioctl if target doesn't implement .ioctl · 4d341d82
      Mike Snitzer authored
      No point checking if the device is suspended if the current target
      doesn't even implement .ioctl
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      4d341d82
  3. 13 Nov, 2014 3 commits
  4. 10 Nov, 2014 28 commits
  5. 04 Nov, 2014 1 commit
  6. 29 Oct, 2014 1 commit
  7. 21 Oct, 2014 1 commit