mbox series

[0/6] Block group structure cleanups

Message ID cover.1571848791.git.dsterba@suse.com (mailing list archive)
Headers show
Series Block group structure cleanups | expand

Message

David Sterba Oct. 23, 2019, 4:48 p.m. UTC
The block group cache structure has two embedded members that belong to
the on-disk format but were used for the in-memory structures. It's been
like that forever and I wonder why nobody was bothered by that. Switch
to normal members and rename a few things on along the way.

The size of block_group_cache is down from 528 to 504 so it should not
fit better to slab pages. Further shrinkage is possible.

David Sterba (6):
  btrfs: move block_group_item::used to block group
  btrfs: move block_group_item::flags to block group
  btrfs: remove embedded block_group_cache::item
  btrfs: rename block_group_item on-stack accessors to follow naming
  btrfs: rename extent buffer block group item accessors
  btrfs: add dedicated members for start and length of a block group

 fs/btrfs/block-group.c                 | 191 +++++++++++++------------
 fs/btrfs/block-group.h                 |   5 +-
 fs/btrfs/ctree.h                       |  12 +-
 fs/btrfs/extent-tree.c                 |  31 ++--
 fs/btrfs/free-space-cache.c            |  39 +++--
 fs/btrfs/free-space-tree.c             |  83 ++++++-----
 fs/btrfs/ioctl.c                       |   5 +-
 fs/btrfs/print-tree.c                  |   6 +-
 fs/btrfs/reada.c                       |   4 +-
 fs/btrfs/relocation.c                  |  18 +--
 fs/btrfs/scrub.c                       |  10 +-
 fs/btrfs/space-info.c                  |   3 +-
 fs/btrfs/sysfs.c                       |   4 +-
 fs/btrfs/tests/btrfs-tests.c           |   5 +-
 fs/btrfs/tests/free-space-tree-tests.c |  75 +++++-----
 fs/btrfs/tree-checker.c                |  10 +-
 fs/btrfs/volumes.c                     |  19 ++-
 include/trace/events/btrfs.h           |  21 ++-
 18 files changed, 264 insertions(+), 277 deletions(-)

Comments

Qu Wenruo Oct. 24, 2019, 1:48 a.m. UTC | #1
On 2019/10/24 上午12:48, David Sterba wrote:
> The block group cache structure has two embedded members that belong to
> the on-disk format but were used for the in-memory structures. It's been
> like that forever and I wonder why nobody was bothered by that. Switch
> to normal members and rename a few things on along the way.
> 
> The size of block_group_cache is down from 528 to 504 so it should not
> fit better to slab pages. Further shrinkage is possible.

Great work!

The patchset doesn't only reduce the memory usage (which is already
awesome for large fs), but also provide more flexibility for later block
group item change.

All previously on-disk format related members are now all refactor,
providing a pretty good basis for later bgi change. Awesome!

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

> 
> David Sterba (6):
>   btrfs: move block_group_item::used to block group
>   btrfs: move block_group_item::flags to block group
>   btrfs: remove embedded block_group_cache::item
>   btrfs: rename block_group_item on-stack accessors to follow naming
>   btrfs: rename extent buffer block group item accessors
>   btrfs: add dedicated members for start and length of a block group
> 
>  fs/btrfs/block-group.c                 | 191 +++++++++++++------------
>  fs/btrfs/block-group.h                 |   5 +-
>  fs/btrfs/ctree.h                       |  12 +-
>  fs/btrfs/extent-tree.c                 |  31 ++--
>  fs/btrfs/free-space-cache.c            |  39 +++--
>  fs/btrfs/free-space-tree.c             |  83 ++++++-----
>  fs/btrfs/ioctl.c                       |   5 +-
>  fs/btrfs/print-tree.c                  |   6 +-
>  fs/btrfs/reada.c                       |   4 +-
>  fs/btrfs/relocation.c                  |  18 +--
>  fs/btrfs/scrub.c                       |  10 +-
>  fs/btrfs/space-info.c                  |   3 +-
>  fs/btrfs/sysfs.c                       |   4 +-
>  fs/btrfs/tests/btrfs-tests.c           |   5 +-
>  fs/btrfs/tests/free-space-tree-tests.c |  75 +++++-----
>  fs/btrfs/tree-checker.c                |  10 +-
>  fs/btrfs/volumes.c                     |  19 ++-
>  include/trace/events/btrfs.h           |  21 ++-
>  18 files changed, 264 insertions(+), 277 deletions(-)
>
Nikolay Borisov Oct. 24, 2019, 12:09 p.m. UTC | #2
On 23.10.19 г. 19:48 ч., David Sterba wrote:
> The block group cache structure has two embedded members that belong to
> the on-disk format but were used for the in-memory structures. It's been
> like that forever and I wonder why nobody was bothered by that. Switch
> to normal members and rename a few things on along the way.
> 
> The size of block_group_cache is down from 528 to 504 so it should not
> fit better to slab pages. Further shrinkage is possible.
> 
> David Sterba (6):
>   btrfs: move block_group_item::used to block group
>   btrfs: move block_group_item::flags to block group
>   btrfs: remove embedded block_group_cache::item
>   btrfs: rename block_group_item on-stack accessors to follow naming
>   btrfs: rename extent buffer block group item accessors
>   btrfs: add dedicated members for start and length of a block group
> 
>  fs/btrfs/block-group.c                 | 191 +++++++++++++------------
>  fs/btrfs/block-group.h                 |   5 +-
>  fs/btrfs/ctree.h                       |  12 +-
>  fs/btrfs/extent-tree.c                 |  31 ++--
>  fs/btrfs/free-space-cache.c            |  39 +++--
>  fs/btrfs/free-space-tree.c             |  83 ++++++-----
>  fs/btrfs/ioctl.c                       |   5 +-
>  fs/btrfs/print-tree.c                  |   6 +-
>  fs/btrfs/reada.c                       |   4 +-
>  fs/btrfs/relocation.c                  |  18 +--
>  fs/btrfs/scrub.c                       |  10 +-
>  fs/btrfs/space-info.c                  |   3 +-
>  fs/btrfs/sysfs.c                       |   4 +-
>  fs/btrfs/tests/btrfs-tests.c           |   5 +-
>  fs/btrfs/tests/free-space-tree-tests.c |  75 +++++-----
>  fs/btrfs/tree-checker.c                |  10 +-
>  fs/btrfs/volumes.c                     |  19 ++-
>  include/trace/events/btrfs.h           |  21 ++-
>  18 files changed, 264 insertions(+), 277 deletions(-)
> 


I quitte like the series, especially the last patch which puts sanity
into how we refer to bg start/size.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>