• B
    btrfs: load block group size class when caching · c7eec3d9
    Boris Burkov 提交于
    Since the size class is an artifact of an arbitrary anti fragmentation
    strategy, it doesn't really make sense to persist it. Furthermore, most
    of the size class logic assumes fresh block groups. That is of course
    not a reasonable assumption -- we will be upgrading kernels with
    existing filesystems whose block groups are not classified.
    
    To work around those issues, implement logic to compute the size class
    of the block groups as we cache them in. To perfectly assess the state
    of a block group, we would have to read the entire extent tree (since
    the free space cache mashes together contiguous extent items) which
    would be prohibitively expensive for larger file systems with more
    extents.
    
    We can do it relatively cheaply by implementing a simple heuristic of
    sampling a handful of extents and picking the smallest one we see. In
    the happy case where the block group was classified, we will only see
    extents of the correct size. In the unhappy case, we will hopefully find
    one of the smaller extents, but there is no perfect answer anyway.
    Autorelocation will eventually churn up the block group if there is
    significant freeing anyway.
    
    There was no regression in mount performance at end state of the fsperf
    test suite, and the delay until the block group is marked cached is
    minimized by the constant number of extent samples.
    Signed-off-by: NBoris Burkov <boris@bur.io>
    Signed-off-by: NDavid Sterba <dsterba@suse.com>
    c7eec3d9
block-group.c 132.0 KB