On Thu, Oct 11, 2018 at 03:54:08PM -0400, Josef Bacik wrote: > From: Josef Bacik <jba...@fb.com> > > We can't use entry->bytes if our entry is a bitmap entry, we need to use > entry->max_extent_size in that case. Fix up all the logic to make this > consistent. > > Signed-off-by: Josef Bacik <jba...@fb.com> > --- > fs/btrfs/free-space-cache.c | 29 +++++++++++++++++++---------- > 1 file changed, 19 insertions(+), 10 deletions(-) > > diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c > index e077ad3b4549..2e96ee7da3ec 100644 > --- a/fs/btrfs/free-space-cache.c > +++ b/fs/btrfs/free-space-cache.c > @@ -1770,6 +1770,18 @@ static int search_bitmap(struct btrfs_free_space_ctl > *ctl, > return -1; > } > > +static void set_max_extent_size(struct btrfs_free_space *entry,
I find this a bit confusing, in the code it's like set_max_extent_size(entry, max_extent_size) so it reads like 'set max extent size of the entry to value', while the function does the opposite. That the 2nd parameter is a pointer does not help either. A function comment explaining that would not help as it's confusing at the callsites. *max_extent_size = get_max_extent_size(entry, *max_extent_size) This is more obvious what it does but can't be called an improvement regarding readability. Other ideas?