mbox series

[00/38] btrfs-progs: sync ctree.c into btrfs-progs

Message ID cover.1692800904.git.josef@toxicpanda.com (mailing list archive)
Headers show
Series btrfs-progs: sync ctree.c into btrfs-progs | expand

Message

Josef Bacik Aug. 23, 2023, 2:32 p.m. UTC
Hello,

I started back up my extent tree v2 work and noticed not all my ctree.c sync
patches made it in the last submission as I missed some comments.

This patchset is much larger than what was left, as I broke up the changes more
discreetly.  In my original submission I had ignored some of the tree wide
changes in favor of expediency, and had modified ctree.c more to match what we
had in btrfs-progs.

This time I've updated everything that was different in ctree.c in the rest of
btrfs-progs to make the actual sync'ing of ctree.c more straightforward.  I had
to modify a few things in ctree.c, but they are very small and specific, no more
updates of any of the global functions we depend on.

The downside is this patchset is massive.  The upside is the patches are small
and self contained, with the obvious exception of the actual ctree.c sync.

This also will make subsequent sync'ing of other source files much easier, as
I've changed a good deal of the very common helpers to match what exists in the
kernel.

This passes all the tests.  There are a few behavior changes, but for the most
part it's just updating helpers to match kernel definitions and moving code
around.  Thanks,

Josef

Josef Bacik (38):
  btrfs-progs: stop using add_root_to_dirty_list in check
  btrfs-progs: remove useless add_root_to_dirty_list call in mkfs
  btrfs-progs: remove add_root_to_dirty_list call when creating free
    space tree
  btrfs-progs: make add_root_to_dirty_list static and unexport it
  btrfs-progs: pass btrfs_trans_handle through btrfs_clear_buffer_dirty
  btrfs-progs: update read_node_slot to match the kernel definition
  btrfs-progs: update btrfs_bin_search to match the kernel definition
  btrfs-progs: update btrfs_set_item_key_safe to match kernel definition
  btrfs-progs: update btrfs_print_leaf to match the kernel definition
  btrfs-progs: update btrfs_truncate_item to match the kernel definition
  btrfs-progs: update btrfs_extend_item to match the kernel definition
  btrfs-progs: sync memcpy_extent_buffer from the kernel
  btrfs-progs: drop btrfs_init_path
  btrfs-progs: move btrfs_set_item_key_unsafe to check/
  btrfs-progs: move btrfs_record_file_extent and code into a new file
  btrfs-progs: make a local copy of btrfs_next_sibling_block in
    print-tree.c
  btrfs-progs: don't set the ->commit_root in btrfs_create_tree
  btrfs-progs: remove btrfs_create_root
  btrfs-progs: move btrfs_uuid_tree_add into mkfs/main.c
  btrfs-progs: make btrfs_del_ptr a void
  btrfs-progs: replace blocksize with parent argument for
    btrfs_alloc_tree_block
  btrfs-progs: use path->search_for_extension
  btrfs-progs: init new tree blocks in btrfs_alloc_tree_block
  btrfs-progs: add dwarves to the package list for ci
  btrfs-progs: add kerncompat helpers for ctree.c sync
  btrfs-progs: add trans_lock to fs_info
  btrfs-progs: add commit_root_sem to btrfs_fs_info
  btrfs-progs: update btrfs_cow_block to match the in-kernel definition
  btrfs-progs: update btrfs_insert_empty_items to match the kernel
  btrfs-progs: update btrfs_insert_empty_item to match the kernel
  btrfs-progs: update btrfs_del_ptr to match the kernel
  btrfs-progs: update btrfs_insert_item to match the kernel
  btrfs-progs: update btrfs_leaf_free_space to match the kernel
  btrfs-progs: use btrfs_tree_parent_check for btrfs_read_extent_buffer
  btrfs-progs: update read_tree_block to take a btrfs_parent_tree_check
  btrfs-progs: inline btrfs_name_hash and btrfs_extref_hash
  btrfs-progs: update btrfs_split_item to match the in-kernel definition
  btrfs-progs: sync ctree.c from kernel

 Makefile                                      |    1 +
 btrfs-corrupt-block.c                         |   17 +-
 btrfs-find-root.c                             |    5 +-
 btrfs-map-logical.c                           |    1 +
 check/clear-cache.c                           |   12 +-
 check/main.c                                  |  135 +-
 check/mode-common.c                           |   42 +-
 check/mode-lowmem.c                           |  109 +-
 check/qgroup-verify.c                         |   21 +-
 check/repair.c                                |   66 +-
 check/repair.h                                |    5 +
 ci/images/ci-centos-7-x86_64/Dockerfile       |    2 +-
 ci/images/ci-centos-8-x86_64/Dockerfile       |    2 +-
 ci/images/ci-musl-x86_64/Dockerfile           |    2 +-
 .../ci-openSUSE-Leap-15.3-x86_64/Dockerfile   |    2 +-
 .../ci-openSUSE-Leap-15.4-x86_64/Dockerfile   |    2 +-
 .../ci-openSUSE-tumbleweed-x86_64/Dockerfile  |    2 +-
 cmds/inspect-dump-tree.c                      |   25 +-
 cmds/inspect-tree-stats.c                     |   14 +-
 cmds/rescue-chunk-recover.c                   |   16 +-
 cmds/rescue.c                                 |    2 +-
 cmds/restore.c                                |   39 +-
 common/extent-tree-utils.c                    |  282 +
 common/extent-tree-utils.h                    |   28 +
 convert/main.c                                |   10 +-
 convert/source-fs.c                           |    5 +-
 convert/source-reiserfs.c                     |    1 +
 image/common.c                                |    3 +-
 image/image-create.c                          |   14 +-
 image/image-restore.c                         |   12 +-
 image/main.c                                  |    1 +
 include/kerncompat.h                          |   76 +
 kernel-lib/trace.h                            |    6 +
 kernel-shared/backref.c                       |   17 +-
 kernel-shared/ctree.c                         | 4658 ++++++++++++-----
 kernel-shared/ctree.h                         |  162 +-
 kernel-shared/dir-item.c                      |    4 +-
 kernel-shared/disk-io.c                       |   41 +-
 kernel-shared/disk-io.h                       |    9 +-
 kernel-shared/extent-tree.c                   |  281 +-
 kernel-shared/extent_io.c                     |    9 +-
 kernel-shared/extent_io.h                     |    7 +-
 kernel-shared/file-item.c                     |   15 +-
 kernel-shared/file.c                          |    3 +-
 kernel-shared/free-space-cache.c              |    4 +-
 kernel-shared/free-space-tree.c               |    1 -
 kernel-shared/inode-item.c                    |    5 +-
 kernel-shared/inode.c                         |    5 +-
 kernel-shared/print-tree.c                    |   72 +-
 kernel-shared/print-tree.h                    |    7 +-
 kernel-shared/transaction.c                   |    7 +-
 kernel-shared/volumes.c                       |    6 +-
 mkfs/main.c                                   |   89 +-
 mkfs/rootdir.c                                |   11 +-
 quick-test.c                                  |    6 +-
 tune/change-csum.c                            |   13 +-
 tune/change-uuid.c                            |   10 +-
 tune/convert-bgt.c                            |   13 +-
 58 files changed, 4276 insertions(+), 2139 deletions(-)
 create mode 100644 common/extent-tree-utils.c
 create mode 100644 common/extent-tree-utils.h

Comments

David Sterba Aug. 23, 2023, 5:41 p.m. UTC | #1
On Wed, Aug 23, 2023 at 10:32:26AM -0400, Josef Bacik wrote:
> Hello,
> 
> I started back up my extent tree v2 work and noticed not all my ctree.c sync
> patches made it in the last submission as I missed some comments.
> 
> This patchset is much larger than what was left, as I broke up the changes more
> discreetly.  In my original submission I had ignored some of the tree wide
> changes in favor of expediency, and had modified ctree.c more to match what we
> had in btrfs-progs.
> 
> This time I've updated everything that was different in ctree.c in the rest of
> btrfs-progs to make the actual sync'ing of ctree.c more straightforward.  I had
> to modify a few things in ctree.c, but they are very small and specific, no more
> updates of any of the global functions we depend on.
> 
> The downside is this patchset is massive.  The upside is the patches are small
> and self contained, with the obvious exception of the actual ctree.c sync.
> 
> This also will make subsequent sync'ing of other source files much easier, as
> I've changed a good deal of the very common helpers to match what exists in the
> kernel.
> 
> This passes all the tests.  There are a few behavior changes, but for the most
> part it's just updating helpers to match kernel definitions and moving code
> around.  Thanks,
> 
> Josef
> 
> Josef Bacik (38):
>   btrfs-progs: stop using add_root_to_dirty_list in check
>   btrfs-progs: remove useless add_root_to_dirty_list call in mkfs
>   btrfs-progs: remove add_root_to_dirty_list call when creating free
>     space tree
>   btrfs-progs: make add_root_to_dirty_list static and unexport it
>   btrfs-progs: pass btrfs_trans_handle through btrfs_clear_buffer_dirty
>   btrfs-progs: update read_node_slot to match the kernel definition
>   btrfs-progs: update btrfs_bin_search to match the kernel definition
>   btrfs-progs: update btrfs_set_item_key_safe to match kernel definition
>   btrfs-progs: update btrfs_print_leaf to match the kernel definition
>   btrfs-progs: update btrfs_truncate_item to match the kernel definition
>   btrfs-progs: update btrfs_extend_item to match the kernel definition
>   btrfs-progs: sync memcpy_extent_buffer from the kernel
>   btrfs-progs: drop btrfs_init_path
>   btrfs-progs: move btrfs_set_item_key_unsafe to check/
>   btrfs-progs: move btrfs_record_file_extent and code into a new file
>   btrfs-progs: make a local copy of btrfs_next_sibling_block in
>     print-tree.c
>   btrfs-progs: don't set the ->commit_root in btrfs_create_tree
>   btrfs-progs: remove btrfs_create_root
>   btrfs-progs: move btrfs_uuid_tree_add into mkfs/main.c
>   btrfs-progs: make btrfs_del_ptr a void
>   btrfs-progs: replace blocksize with parent argument for
>     btrfs_alloc_tree_block
>   btrfs-progs: use path->search_for_extension
>   btrfs-progs: init new tree blocks in btrfs_alloc_tree_block
>   btrfs-progs: add dwarves to the package list for ci
>   btrfs-progs: add kerncompat helpers for ctree.c sync
>   btrfs-progs: add trans_lock to fs_info
>   btrfs-progs: add commit_root_sem to btrfs_fs_info
>   btrfs-progs: update btrfs_cow_block to match the in-kernel definition
>   btrfs-progs: update btrfs_insert_empty_items to match the kernel
>   btrfs-progs: update btrfs_insert_empty_item to match the kernel
>   btrfs-progs: update btrfs_del_ptr to match the kernel
>   btrfs-progs: update btrfs_insert_item to match the kernel
>   btrfs-progs: update btrfs_leaf_free_space to match the kernel
>   btrfs-progs: use btrfs_tree_parent_check for btrfs_read_extent_buffer
>   btrfs-progs: update read_tree_block to take a btrfs_parent_tree_check
>   btrfs-progs: inline btrfs_name_hash and btrfs_extref_hash
>   btrfs-progs: update btrfs_split_item to match the in-kernel definition
>   btrfs-progs: sync ctree.c from kernel

I've skimmed the series, there maybe some minor things to fix up so I'll
apply it soon. The last patch is however too big, I get that you did not
want to split it further but I think it's still better to do it in
smaller batches grouped by functionality or a helper. Also there's the
copyright notice change, this hasn't been decided what to do with that
in userspace. I'll take another look.
David Sterba Aug. 25, 2023, 9:35 p.m. UTC | #2
On Wed, Aug 23, 2023 at 10:32:26AM -0400, Josef Bacik wrote:
> Hello,
> 
> I started back up my extent tree v2 work and noticed not all my ctree.c sync
> patches made it in the last submission as I missed some comments.
> 
> This patchset is much larger than what was left, as I broke up the changes more
> discreetly.  In my original submission I had ignored some of the tree wide
> changes in favor of expediency, and had modified ctree.c more to match what we
> had in btrfs-progs.
> 
> This time I've updated everything that was different in ctree.c in the rest of
> btrfs-progs to make the actual sync'ing of ctree.c more straightforward.  I had
> to modify a few things in ctree.c, but they are very small and specific, no more
> updates of any of the global functions we depend on.
> 
> The downside is this patchset is massive.  The upside is the patches are small
> and self contained, with the obvious exception of the actual ctree.c sync.
> 
> This also will make subsequent sync'ing of other source files much easier, as
> I've changed a good deal of the very common helpers to match what exists in the
> kernel.
> 
> This passes all the tests.  There are a few behavior changes, but for the most
> part it's just updating helpers to match kernel definitions and moving code
> around.  Thanks,
> 
> Josef
> 
> Josef Bacik (38):
>   btrfs-progs: stop using add_root_to_dirty_list in check
>   btrfs-progs: remove useless add_root_to_dirty_list call in mkfs
>   btrfs-progs: remove add_root_to_dirty_list call when creating free
>     space tree
>   btrfs-progs: make add_root_to_dirty_list static and unexport it
>   btrfs-progs: pass btrfs_trans_handle through btrfs_clear_buffer_dirty
>   btrfs-progs: update read_node_slot to match the kernel definition
>   btrfs-progs: update btrfs_bin_search to match the kernel definition
>   btrfs-progs: update btrfs_set_item_key_safe to match kernel definition
>   btrfs-progs: update btrfs_print_leaf to match the kernel definition
>   btrfs-progs: update btrfs_truncate_item to match the kernel definition
>   btrfs-progs: update btrfs_extend_item to match the kernel definition
>   btrfs-progs: sync memcpy_extent_buffer from the kernel
>   btrfs-progs: drop btrfs_init_path
>   btrfs-progs: move btrfs_set_item_key_unsafe to check/
>   btrfs-progs: move btrfs_record_file_extent and code into a new file
>   btrfs-progs: make a local copy of btrfs_next_sibling_block in
>     print-tree.c
>   btrfs-progs: don't set the ->commit_root in btrfs_create_tree
>   btrfs-progs: remove btrfs_create_root
>   btrfs-progs: move btrfs_uuid_tree_add into mkfs/main.c
>   btrfs-progs: make btrfs_del_ptr a void
>   btrfs-progs: replace blocksize with parent argument for
>     btrfs_alloc_tree_block
>   btrfs-progs: use path->search_for_extension
>   btrfs-progs: init new tree blocks in btrfs_alloc_tree_block
>   btrfs-progs: add dwarves to the package list for ci
>   btrfs-progs: add kerncompat helpers for ctree.c sync
>   btrfs-progs: add trans_lock to fs_info
>   btrfs-progs: add commit_root_sem to btrfs_fs_info
>   btrfs-progs: update btrfs_cow_block to match the in-kernel definition
>   btrfs-progs: update btrfs_insert_empty_items to match the kernel
>   btrfs-progs: update btrfs_insert_empty_item to match the kernel
>   btrfs-progs: update btrfs_del_ptr to match the kernel
>   btrfs-progs: update btrfs_insert_item to match the kernel
>   btrfs-progs: update btrfs_leaf_free_space to match the kernel
>   btrfs-progs: use btrfs_tree_parent_check for btrfs_read_extent_buffer
>   btrfs-progs: update read_tree_block to take a btrfs_parent_tree_check
>   btrfs-progs: inline btrfs_name_hash and btrfs_extref_hash
>   btrfs-progs: update btrfs_split_item to match the in-kernel definition

1-37 applied, with some minor fixups, thanks. This change granularity is
good.