On Fri, Sep 22, 2017 at 01:58:45PM -0400, Zygo Blaxell wrote: > 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: Zygo Blaxell <ce3g8...@umail.furryterror.org>
Reviewed-by: David Sterba <dste...@suse.com> -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html