mbox series

[00/10] btrfs-progs: prep work for syncing ctree.c

Message ID cover.1681939107.git.josef@toxicpanda.com (mailing list archive)
Headers show
Series btrfs-progs: prep work for syncing ctree.c | expand

Message

Josef Bacik April 19, 2023, 9:20 p.m. UTC
Hello,

These patches update a lot of the different ctree.c related helpers that have
diverged from the kernel in order to make ite easier syncing ctree.c directly.
This also syncs locking.[ch], but this is to just stub out the locking.  This
will make it easier to sync ctree.c as well since there's locking in the kernel
that didn't exist when we had this in btrfs-progs.

This series depends on

	btrfs-progs: prep work for syncing files into kernel-shared
	btrfs-progs: sync basic code from the kernel

Thanks,

Josef

Josef Bacik (10):
  btrfs-progs: const-ify the extent buffer helpers
  btrfs-progs: bring root->state into btrfs-progs
  btrfs-progs: rename btrfs_alloc_free_block to btrfs_alloc_tree_block
  btrfs-progs: sync locking.h and stub out all the helpers
  btrfs-progs: add btrfs_locking_nest to btrfs_alloc_tree_block
  btrfs-progs: add some missing extent buffer helpers
  btrfs-progs: rename btrfs_set_block_flags ->
    btrfs_set_disk_extent_flags
  btrfs-progs: cleanup args for btrfs_set_disk_extent_flags
  btrfs-progs: rename clear_extent_buffer_dirty =>
    btrfs_clear_buffer_dirty
  btrfs-progs: make __btrfs_cow_block static

 Makefile                    |   1 +
 check/main.c                |   7 +-
 cmds/rescue-chunk-recover.c |   4 +-
 cmds/rescue.c               |   2 +-
 include/kerncompat.h        |   4 +
 kernel-shared/ctree.c       |  72 +++++-----
 kernel-shared/ctree.h       |  82 ++++++++++--
 kernel-shared/disk-io.c     |  33 +++--
 kernel-shared/extent-tree.c |  28 ++--
 kernel-shared/extent_io.c   |  28 ++--
 kernel-shared/extent_io.h   |  15 ++-
 kernel-shared/locking.c     |  22 +++
 kernel-shared/locking.h     | 258 ++++++++++++++++++++++++++++++++++++
 kernel-shared/transaction.c |   4 +-
 14 files changed, 464 insertions(+), 96 deletions(-)
 create mode 100644 kernel-shared/locking.c
 create mode 100644 kernel-shared/locking.h

Comments

David Sterba May 3, 2023, 9:54 a.m. UTC | #1
On Wed, Apr 19, 2023 at 05:20:40PM -0400, Josef Bacik wrote:
> Hello,
> 
> These patches update a lot of the different ctree.c related helpers that have
> diverged from the kernel in order to make ite easier syncing ctree.c directly.
> This also syncs locking.[ch], but this is to just stub out the locking.  This
> will make it easier to sync ctree.c as well since there's locking in the kernel
> that didn't exist when we had this in btrfs-progs.
> 
> This series depends on
> 
> 	btrfs-progs: prep work for syncing files into kernel-shared
> 	btrfs-progs: sync basic code from the kernel
> 
> Thanks,
> 
> Josef
> 
> Josef Bacik (10):
>   btrfs-progs: const-ify the extent buffer helpers
>   btrfs-progs: bring root->state into btrfs-progs
>   btrfs-progs: rename btrfs_alloc_free_block to btrfs_alloc_tree_block
>   btrfs-progs: sync locking.h and stub out all the helpers
>   btrfs-progs: add btrfs_locking_nest to btrfs_alloc_tree_block
>   btrfs-progs: add some missing extent buffer helpers
>   btrfs-progs: rename btrfs_set_block_flags ->
>     btrfs_set_disk_extent_flags
>   btrfs-progs: cleanup args for btrfs_set_disk_extent_flags
>   btrfs-progs: rename clear_extent_buffer_dirty =>
>     btrfs_clear_buffer_dirty
>   btrfs-progs: make __btrfs_cow_block static

Added to devel. However, this fails build on Centos7 image with warnings
like

    [CC]     kernel-shared/backref.o
In file included from ./kernel-shared/ctree.h:30:0,
                 from kernel-shared/volumes.h:23,
                 from btrfs.c:24:
./kernel-shared/accessors.h: In function 'btrfs_device_total_bytes':
./kernel-shared/accessors.h:118:58: error: expected ',' before ')' token
         sizeof(((struct btrfs_dev_item *)0))->total_bytes);
                                                          ^
./kernel-shared/accessors.h: In function 'btrfs_set_device_total_bytes':
./kernel-shared/accessors.h:132:58: error: expected ',' before ')' token
         sizeof(((struct btrfs_dev_item *)0))->total_bytes);
                                                          ^

The code is same as in kernel e.g.

 114 static inline u64 btrfs_device_total_bytes(const struct extent_buffer *eb,
 115                                            struct btrfs_dev_item *s)
 116 {
 117         static_assert(sizeof(u64) ==
 118                       sizeof(((struct btrfs_dev_item *)0))->total_bytes);
 119         return btrfs_get_64(eb, s, offsetof(struct btrfs_dev_item,
 120                                             total_bytes));
 121 }