1. 01 Nov, 2017 5 commits
    • Zygo Blaxell's avatar
      btrfs: add a flag to iterate_inodes_from_logical to find all extent refs for uncompressed extents · c995ab3c
      Zygo Blaxell authored
      The LOGICAL_INO ioctl provides a backward mapping from extent bytenr and
      offset (encoded as a single logical address) to a list of extent refs.
      LOGICAL_INO complements TREE_SEARCH, which provides the forward mapping
      (extent ref -> extent bytenr and offset, or logical address).  These are
      useful capabilities for programs that manipulate extents and extent
      references from userspace (e.g. dedup and defrag utilities).
      
      When the extents are uncompressed (and not encrypted and not other),
      check_extent_in_eb performs filtering of the extent refs to remove any
      extent refs which do not contain the same extent offset as the 'logical'
      parameter's extent offset.  This prevents LOGICAL_INO from returning
      references to more than a single block.
      
      To find the set of extent references to an uncompressed extent from [a, b),
      userspace has to run a loop like this pseudocode:
      
      	for (i = a; i < b; ++i)
      		extent_ref_set += LOGICAL_INO(i);
      
      At each iteration of the loop (up to 32768 iterations for a 128M extent),
      data we are interested in is collected in the kernel, then deleted by
      the filter in check_extent_in_eb.
      
      When the extents are compressed (or encrypted or other), the 'logical'
      parameter must be an extent bytenr (the 'a' parameter in the loop).
      No filtering by extent offset is done (or possible?) so the result is
      the complete set of extent refs for the entire extent.  This removes
      the need for the loop, since we get all the extent refs in one call.
      
      Add an 'ignore_offset' argument to iterate_inodes_from_logical,
      [...several levels of function call graph...], and check_extent_in_eb, so
      that we can disable the extent offset filtering for uncompressed extents.
      This flag can be set by an improved version of the LOGICAL_INO ioctl to
      get either behavior as desired.
      
      There is no functional change in this patch.  The new flag is always
      false.
      Signed-off-by: default avatarZygo Blaxell <ce3g8jdj@umail.furryterror.org>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      [ minor coding style fixes ]
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      c995ab3c
    • Nikolay Borisov's avatar
      btrfs: send: remove unused code · eb7b9d6a
      Nikolay Borisov authored
      This code was first introduced in 31db9f7c ("Btrfs: introduce
      BTRFS_IOC_SEND for btrfs send/receive") and it was not functional, then
      it got slightly refactored in e938c8ad ("Btrfs: code cleanups for
      send/receive"), alas it was still dead. So let's remove it for good!
      Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      eb7b9d6a
    • Anand Jain's avatar
      btrfs: remove BUG_ON in btrfs_rm_dev_replace_free_srcdev() · 6dd38f81
      Anand Jain authored
      That was only an extra check to tackle a few bugs around this area, now
      its safe to remove it.  Replace it by an ASSERT.
      Signed-off-by: default avatarAnand Jain <anand.jain@oracle.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      6dd38f81
    • Adam Borowski's avatar
      btrfs: allow setting zlib compression level via :9 · fa4d885a
      Adam Borowski authored
      This is bikeshedding, but it seems people are drastically more likely to
      understand "zlib:9" as compression level rather than an algorithm
      version compared to "zlib9".
      
      Based on feedback on the mailinglist, the ":9" will be the only accepted
      syntax. The level must be a single digit. Unrecognized format will
      result to the default, for forward compatibility in a similar way the
      compression algorithm specifier was relaxed in commit
      a7164fa4 ("btrfs: prepare for extensions in compression
      options").
      Signed-off-by: default avatarAdam Borowski <kilobyte@angband.pl>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      [ tighten the accepted format ]
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      fa4d885a
    • David Sterba's avatar
      btrfs: allow to set compression level for zlib · f51d2b59
      David Sterba authored
      Preliminary support for setting compression level for zlib, the
      following works:
      
      $ mount -o compess=zlib                 # default
      $ mount -o compess=zlib0                # same
      $ mount -o compess=zlib9                # level 9, slower sync, less data
      $ mount -o compess=zlib1                # level 1, faster sync, more data
      $ mount -o remount,compress=zlib3	# level set by remount
      
      The compress-force works the same as compress'.  The level is visible in
      the same format in /proc/mounts. Level set via file property does not
      work yet.
      
      Required patch: "btrfs: prepare for extensions in compression options"
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      f51d2b59
  2. 30 Oct, 2017 35 commits