btrfs: move super_block specific helpers into super.h

This will make syncing fs.h to user space a little easier if we can pull
the super block specific helpers out of fs.h and put them in super.h.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Josef Bacik 2022-10-26 15:08:40 -04:00 committed by David Sterba
parent c03b22076b
commit 7f0add250f
17 changed files with 32 additions and 17 deletions

View File

@ -35,6 +35,7 @@
#include "subpage.h"
#include "zoned.h"
#include "file-item.h"
#include "super.h"
static const char* const btrfs_compress_types[] = { "", "zlib", "lzo", "zstd" };

View File

@ -15,6 +15,7 @@
#include "subpage.h"
#include "defrag.h"
#include "file-item.h"
#include "super.h"
static struct kmem_cache *btrfs_inode_defrag_cachep;

View File

@ -8,6 +8,7 @@
#include "print-tree.h"
#include "export.h"
#include "accessors.h"
#include "super.h"
#define BTRFS_FID_SIZE_NON_CONNECTABLE (offsetof(struct btrfs_fid, \
parent_objectid) / 4)

View File

@ -35,6 +35,7 @@
#include "file-item.h"
#include "file.h"
#include "dev-replace.h"
#include "super.h"
static struct kmem_cache *extent_buffer_cache;

View File

@ -20,6 +20,7 @@
#include "fs.h"
#include "accessors.h"
#include "file-item.h"
#include "super.h"
#define __MAX_CSUM_ITEMS(r, size) ((unsigned long)(((BTRFS_LEAF_DATA_SIZE(r) - \
sizeof(struct btrfs_item) * 2) / \

View File

@ -36,6 +36,7 @@
#include "file-item.h"
#include "ioctl.h"
#include "file.h"
#include "super.h"
/* simple helper to fault in pages and copy. This should go away
* and be replaced with calls into generic code.

View File

@ -29,6 +29,7 @@
#include "accessors.h"
#include "file-item.h"
#include "file.h"
#include "super.h"
#define BITS_PER_BITMAP (PAGE_SIZE * 8UL)
#define MAX_CACHE_BYTES_PER_GIG SZ_64K

View File

@ -801,11 +801,6 @@ static inline u64 btrfs_get_last_root_drop_gen(const struct btrfs_fs_info *fs_in
return READ_ONCE(fs_info->last_root_drop_gen);
}
static inline struct btrfs_fs_info *btrfs_sb(struct super_block *sb)
{
return sb->s_fs_info;
}
/*
* Take the number of bytes to be checksummed and figure out how many leaves
* it would require to store the csums for that many bytes.
@ -947,18 +942,6 @@ static inline int btrfs_need_cleaner_sleep(struct btrfs_fs_info *fs_info)
btrfs_fs_closing(fs_info);
}
static inline void btrfs_set_sb_rdonly(struct super_block *sb)
{
sb->s_flags |= SB_RDONLY;
set_bit(BTRFS_FS_STATE_RO, &btrfs_sb(sb)->fs_state);
}
static inline void btrfs_clear_sb_rdonly(struct super_block *sb)
{
sb->s_flags &= ~SB_RDONLY;
clear_bit(BTRFS_FS_STATE_RO, &btrfs_sb(sb)->fs_state);
}
static inline void btrfs_wake_unfinished_drop(struct btrfs_fs_info *fs_info)
{
clear_and_wake_up_bit(BTRFS_FS_UNFINISHED_DROPS, &fs_info->flags);

View File

@ -68,6 +68,7 @@
#include "acl.h"
#include "relocation.h"
#include "verity.h"
#include "super.h"
struct btrfs_iget_args {
u64 ino;

View File

@ -16,6 +16,7 @@
#include "messages.h"
#include "compression.h"
#include "ctree.h"
#include "super.h"
#define LZO_LEN 4

View File

@ -5,6 +5,7 @@
#include "discard.h"
#include "transaction.h"
#include "space-info.h"
#include "super.h"
#ifdef CONFIG_PRINTK

View File

@ -19,6 +19,7 @@
#include "qgroup.h"
#include "subpage.h"
#include "file.h"
#include "super.h"
static struct kmem_cache *btrfs_ordered_extent_cache;

View File

@ -14,6 +14,7 @@
#include "space-info.h"
#include "fs.h"
#include "accessors.h"
#include "super.h"
#define BTRFS_PROP_HANDLERS_HT_BITS 8
static DEFINE_HASHTABLE(prop_handlers_ht, BTRFS_PROP_HANDLERS_HT_BITS);

View File

@ -14,6 +14,7 @@
#include "accessors.h"
#include "file-item.h"
#include "file.h"
#include "super.h"
#define BTRFS_MAX_DEDUPE_LEN SZ_16M

View File

@ -34,6 +34,7 @@
#include "root-tree.h"
#include "file-item.h"
#include "relocation.h"
#include "super.h"
/*
* Relocation overview

View File

@ -9,4 +9,21 @@ int btrfs_sync_fs(struct super_block *sb, int wait);
char *btrfs_get_subvol_name_from_objectid(struct btrfs_fs_info *fs_info,
u64 subvol_objectid);
static inline struct btrfs_fs_info *btrfs_sb(struct super_block *sb)
{
return sb->s_fs_info;
}
static inline void btrfs_set_sb_rdonly(struct super_block *sb)
{
sb->s_flags |= SB_RDONLY;
set_bit(BTRFS_FS_STATE_RO, &btrfs_sb(sb)->fs_state);
}
static inline void btrfs_clear_sb_rdonly(struct super_block *sb)
{
sb->s_flags &= ~SB_RDONLY;
clear_bit(BTRFS_FS_STATE_RO, &btrfs_sb(sb)->fs_state);
}
#endif

View File

@ -39,6 +39,7 @@
#include "ioctl.h"
#include "relocation.h"
#include "scrub.h"
#include "super.h"
static struct bio_set btrfs_bioset;