mbox series

[00/18] btrfs: migrate to "block size" to describe the

Message ID cover.1734514696.git.wqu@suse.com (mailing list archive)
Headers show
Series btrfs: migrate to "block size" to describe the | expand

Message

Qu Wenruo Dec. 18, 2024, 9:41 a.m. UTC
[BACKGROUND]
Since day 1, btrfs uses a different terminology, sector size, to
describe the minimum data block size.

Meanwhile all other filesystems (ext4, xfs, jfs, bcachefs, reiserfs) are
using "block size" to describe the same unit.

Furthermore, kernel itself has its own sector size, fixed to 512 bytes,
as the minimal block IO unit.

This will cause extra confusiong when we're talking with other MM/FS
developers.

[IMPEMENTATION]
To reduce the confusion, this patchset will do such a huge migration in
different steps:

- Introduce btrfs_fs_info::blocksize as an alias for
  btrfs_fs_info::sectorsize
  This is done by introducing an anonymous union, allowing @sectorsize
  and @blocksize to share the same value, and do the migration on a
  per-file basis.

  This covers @blocsize, @blocksize_bits, @blocks_per_page.

- Rename involved users, comments and local variables

- Rename related function names, parameters and even some macros
  This affects scrub and raid56 most, as I follow the strict "sector"
  terminology when reworking on those functionality.

  Thus they will receive very heavy renames.

- Finish the btrfs_fs_info::sectorsize rename

- Add btrfs_super_block::blocksize as an alias for sectorsize
- Add btrfs_ioctl_fs_info_args::blocksize as an alias for sectorsize
  Unlike the btrfs_fs_info::blocksize change which is purely inside
  btrfs, those structures are exported as on-disk format and ioctl
  parameters.

  To keep the compatibility for older programs which may never update
  their code, make @blocksize and @sectorsize co-exist as unions, to
  avoid breakage for older programs.

Qu Wenruo (18):
  btrfs: rename btrfs_fs_info::sectorsize to blocksize for disk-io.c
  btrfs: migrate subpage.[ch] to use block size terminology
  btrfs: migrate tree-checker.c to use block size terminology
  btrfs: migrate scrub.c to use block size terminology
  btrfs: migrate extent_io.[ch] to use block size terminology
  btrfs: migrate compression related code to use block size terminology
  btrfs: migrate free space cache code to use block size terminology
  btrfs: migrate file-item.c to use block size terminology
  btrfs: migrate file.c to use block size terminology
  btrfs: migrate inode.c and btrfs_inode.h to use block size terminology
  btrfs: migrate raid56.[ch] to use block size terminology
  btrfs: migrate defrag.c to use block size terminology
  btrfs: migrate bio.[ch] to use block size terminology
  btrfs: migrate the remaining sector size users to use block size
    terminology
  btrfs: migrate selftests to use block size terminology
  btrfs: finish the rename of btrfs_fs_info::sectorsize
  btrfs: migrate btrfs_super_block::sectorsize to blocksize
  btrfs: migrate the ioctl interfaces to use block size terminology

 fs/btrfs/accessors.h                    |   6 +-
 fs/btrfs/bio.c                          |  24 +-
 fs/btrfs/bio.h                          |   4 +-
 fs/btrfs/block-group.c                  |   4 +-
 fs/btrfs/btrfs_inode.h                  |   2 +-
 fs/btrfs/compression.c                  |  30 +-
 fs/btrfs/defrag.c                       |  52 +-
 fs/btrfs/delalloc-space.c               |  26 +-
 fs/btrfs/delayed-inode.c                |   2 +-
 fs/btrfs/delayed-ref.c                  |  12 +-
 fs/btrfs/delayed-ref.h                  |   4 +-
 fs/btrfs/dev-replace.c                  |  12 +-
 fs/btrfs/direct-io.c                    |   6 +-
 fs/btrfs/disk-io.c                      |  82 +--
 fs/btrfs/extent-tree.c                  |  14 +-
 fs/btrfs/extent_io.c                    | 124 ++--
 fs/btrfs/extent_io.h                    |  16 +-
 fs/btrfs/extent_map.h                   |   2 +-
 fs/btrfs/fiemap.c                       |   6 +-
 fs/btrfs/file-item.c                    |  94 +--
 fs/btrfs/file.c                         | 138 ++--
 fs/btrfs/free-space-cache.c             |   8 +-
 fs/btrfs/free-space-tree.c              |  28 +-
 fs/btrfs/fs.h                           |  19 +-
 fs/btrfs/inode-item.c                   |   8 +-
 fs/btrfs/inode.c                        | 140 ++--
 fs/btrfs/ioctl.c                        |  14 +-
 fs/btrfs/lzo.c                          |  80 +--
 fs/btrfs/print-tree.c                   |  14 +-
 fs/btrfs/qgroup.c                       |  10 +-
 fs/btrfs/qgroup.h                       |   2 +-
 fs/btrfs/raid56.c                       | 810 ++++++++++++------------
 fs/btrfs/raid56.h                       |  36 +-
 fs/btrfs/reflink.c                      |  22 +-
 fs/btrfs/relocation.c                   |  16 +-
 fs/btrfs/scrub.c                        | 442 ++++++-------
 fs/btrfs/send.c                         |  36 +-
 fs/btrfs/subpage.c                      |  92 +--
 fs/btrfs/subpage.h                      |   8 +-
 fs/btrfs/super.c                        |  10 +-
 fs/btrfs/sysfs.c                        |   4 +-
 fs/btrfs/tests/btrfs-tests.c            |  38 +-
 fs/btrfs/tests/btrfs-tests.h            |  18 +-
 fs/btrfs/tests/delayed-refs-tests.c     |   4 +-
 fs/btrfs/tests/extent-buffer-tests.c    |   8 +-
 fs/btrfs/tests/extent-io-tests.c        |  34 +-
 fs/btrfs/tests/free-space-tests.c       | 104 +--
 fs/btrfs/tests/free-space-tree-tests.c  |  28 +-
 fs/btrfs/tests/inode-tests.c            | 266 ++++----
 fs/btrfs/tests/qgroup-tests.c           |  12 +-
 fs/btrfs/tests/raid-stripe-tree-tests.c |   8 +-
 fs/btrfs/tree-checker.c                 | 100 +--
 fs/btrfs/tree-log.c                     |   6 +-
 fs/btrfs/volumes.c                      |  26 +-
 fs/btrfs/zlib.c                         |   2 +-
 fs/btrfs/zoned.c                        |   6 +-
 fs/btrfs/zstd.c                         |   6 +-
 include/uapi/linux/btrfs.h              |  21 +-
 include/uapi/linux/btrfs_tree.h         |  13 +-
 59 files changed, 1590 insertions(+), 1569 deletions(-)