Skip to content
  • Joe Thornber's avatar
    dm thin: range discard support · 34fbcf62
    Joe Thornber authored
    
    
    Previously REQ_DISCARD bios have been split into block sized chunks
    before submission to the thin target.  There are a couple of issues with
    this:
    
     - If the block size is small, a large discard request can
       get broken up into a great many bios which is both slow and causes
       a lot of memory pressure.
    
     - The thin pool block size and the discard granularity for the
       underlying data device need to be compatible if we want to passdown
       the discard.
    
    This patch relaxes the block size granularity for thin devices.  It
    makes use of the recent range locking added to the bio_prison to
    quiesce a whole range of thin blocks before unmapping them.  Once a
    thin range has been unmapped the discard can then be passed down to
    the data device for those sub ranges where the data blocks are no
    longer used (ie. they weren't shared in the first place).
    
    This patch also doesn't make any apologies about open-coding portions
    of block core as a means to supporting async discard completions in the
    near-term -- if/when late bio splitting lands it'll all get cleaned up.
    
    Signed-off-by: default avatarJoe Thornber <ejt@redhat.com>
    Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
    34fbcf62