Message ID | 2627fbc83e4c07215bf831d6625b193d6491a750.1682798736.git.josef@toxicpanda.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs: various cleanups to make ctree.c sync easier | expand |
On 29.04.23 22:08, Josef Bacik wrote: > This is needed in btrfs-progs for the tools that convert the checksum > types for file systems and a few other things. We don't have it in the > kernel as we just want to get the size for the super blocks type. > However I don't want to have to manually add this every time we sync > ctree.c into btrfs-progs, so add the helper in the kernel with a note so > it doesn't get removed by a later cleanup. > > Signed-off-by: Josef Bacik <josef@toxicpanda.com> > --- > fs/btrfs/ctree.c | 8 +++++++- > fs/btrfs/ctree.h | 1 + > 2 files changed, 8 insertions(+), 1 deletion(-) > > diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c > index 7071f90c23e3..c95c62baef3e 100644 > --- a/fs/btrfs/ctree.c > +++ b/fs/btrfs/ctree.c > @@ -150,13 +150,19 @@ static inline void copy_leaf_items(const struct extent_buffer *dst, > nr_items * sizeof(struct btrfs_item)); > } > > +/* This exists for btrfs-progs usages. */ > +u16 btrfs_csum_type_size(u16 type) > +{ > + return btrfs_csums[type].size; > +} > + > int btrfs_super_csum_size(const struct btrfs_super_block *s) > { > u16 t = btrfs_super_csum_type(s); > /* > * csum type is validated at mount time > */ > - return btrfs_csums[t].size; > + return btrfs_csum_type_size(t); > } > > const char *btrfs_super_csum_name(u16 csum_type) > diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h > index 4c1986cd5bed..221e230787e3 100644 > --- a/fs/btrfs/ctree.h > +++ b/fs/btrfs/ctree.h > @@ -702,6 +702,7 @@ static inline bool btrfs_is_data_reloc_root(const struct btrfs_root *root) > return root->root_key.objectid == BTRFS_DATA_RELOC_TREE_OBJECTID; > } > > +u16 btrfs_csum_type_size(u16 type); > int btrfs_super_csum_size(const struct btrfs_super_block *s); > const char *btrfs_super_csum_name(u16 csum_type); > const char *btrfs_super_csum_driver(u16 csum_type); Same comment here, can we do an EXPORT_FOR_PROGS please.
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 7071f90c23e3..c95c62baef3e 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -150,13 +150,19 @@ static inline void copy_leaf_items(const struct extent_buffer *dst, nr_items * sizeof(struct btrfs_item)); } +/* This exists for btrfs-progs usages. */ +u16 btrfs_csum_type_size(u16 type) +{ + return btrfs_csums[type].size; +} + int btrfs_super_csum_size(const struct btrfs_super_block *s) { u16 t = btrfs_super_csum_type(s); /* * csum type is validated at mount time */ - return btrfs_csums[t].size; + return btrfs_csum_type_size(t); } const char *btrfs_super_csum_name(u16 csum_type) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 4c1986cd5bed..221e230787e3 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -702,6 +702,7 @@ static inline bool btrfs_is_data_reloc_root(const struct btrfs_root *root) return root->root_key.objectid == BTRFS_DATA_RELOC_TREE_OBJECTID; } +u16 btrfs_csum_type_size(u16 type); int btrfs_super_csum_size(const struct btrfs_super_block *s); const char *btrfs_super_csum_name(u16 csum_type); const char *btrfs_super_csum_driver(u16 csum_type);
This is needed in btrfs-progs for the tools that convert the checksum types for file systems and a few other things. We don't have it in the kernel as we just want to get the size for the super blocks type. However I don't want to have to manually add this every time we sync ctree.c into btrfs-progs, so add the helper in the kernel with a note so it doesn't get removed by a later cleanup. Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- fs/btrfs/ctree.c | 8 +++++++- fs/btrfs/ctree.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-)