Commit 7f0add25 authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba

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: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent c03b2207
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "subpage.h" #include "subpage.h"
#include "zoned.h" #include "zoned.h"
#include "file-item.h" #include "file-item.h"
#include "super.h"
static const char* const btrfs_compress_types[] = { "", "zlib", "lzo", "zstd" }; static const char* const btrfs_compress_types[] = { "", "zlib", "lzo", "zstd" };
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "subpage.h" #include "subpage.h"
#include "defrag.h" #include "defrag.h"
#include "file-item.h" #include "file-item.h"
#include "super.h"
static struct kmem_cache *btrfs_inode_defrag_cachep; static struct kmem_cache *btrfs_inode_defrag_cachep;
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "print-tree.h" #include "print-tree.h"
#include "export.h" #include "export.h"
#include "accessors.h" #include "accessors.h"
#include "super.h"
#define BTRFS_FID_SIZE_NON_CONNECTABLE (offsetof(struct btrfs_fid, \ #define BTRFS_FID_SIZE_NON_CONNECTABLE (offsetof(struct btrfs_fid, \
parent_objectid) / 4) parent_objectid) / 4)
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "file-item.h" #include "file-item.h"
#include "file.h" #include "file.h"
#include "dev-replace.h" #include "dev-replace.h"
#include "super.h"
static struct kmem_cache *extent_buffer_cache; static struct kmem_cache *extent_buffer_cache;
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "fs.h" #include "fs.h"
#include "accessors.h" #include "accessors.h"
#include "file-item.h" #include "file-item.h"
#include "super.h"
#define __MAX_CSUM_ITEMS(r, size) ((unsigned long)(((BTRFS_LEAF_DATA_SIZE(r) - \ #define __MAX_CSUM_ITEMS(r, size) ((unsigned long)(((BTRFS_LEAF_DATA_SIZE(r) - \
sizeof(struct btrfs_item) * 2) / \ sizeof(struct btrfs_item) * 2) / \
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "file-item.h" #include "file-item.h"
#include "ioctl.h" #include "ioctl.h"
#include "file.h" #include "file.h"
#include "super.h"
/* simple helper to fault in pages and copy. This should go away /* simple helper to fault in pages and copy. This should go away
* and be replaced with calls into generic code. * and be replaced with calls into generic code.
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "accessors.h" #include "accessors.h"
#include "file-item.h" #include "file-item.h"
#include "file.h" #include "file.h"
#include "super.h"
#define BITS_PER_BITMAP (PAGE_SIZE * 8UL) #define BITS_PER_BITMAP (PAGE_SIZE * 8UL)
#define MAX_CACHE_BYTES_PER_GIG SZ_64K #define MAX_CACHE_BYTES_PER_GIG SZ_64K
......
...@@ -801,11 +801,6 @@ static inline u64 btrfs_get_last_root_drop_gen(const struct btrfs_fs_info *fs_in ...@@ -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); 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 * 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. * 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) ...@@ -947,18 +942,6 @@ static inline int btrfs_need_cleaner_sleep(struct btrfs_fs_info *fs_info)
btrfs_fs_closing(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) 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); clear_and_wake_up_bit(BTRFS_FS_UNFINISHED_DROPS, &fs_info->flags);
......
...@@ -68,6 +68,7 @@ ...@@ -68,6 +68,7 @@
#include "acl.h" #include "acl.h"
#include "relocation.h" #include "relocation.h"
#include "verity.h" #include "verity.h"
#include "super.h"
struct btrfs_iget_args { struct btrfs_iget_args {
u64 ino; u64 ino;
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "messages.h" #include "messages.h"
#include "compression.h" #include "compression.h"
#include "ctree.h" #include "ctree.h"
#include "super.h"
#define LZO_LEN 4 #define LZO_LEN 4
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "discard.h" #include "discard.h"
#include "transaction.h" #include "transaction.h"
#include "space-info.h" #include "space-info.h"
#include "super.h"
#ifdef CONFIG_PRINTK #ifdef CONFIG_PRINTK
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "qgroup.h" #include "qgroup.h"
#include "subpage.h" #include "subpage.h"
#include "file.h" #include "file.h"
#include "super.h"
static struct kmem_cache *btrfs_ordered_extent_cache; static struct kmem_cache *btrfs_ordered_extent_cache;
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "space-info.h" #include "space-info.h"
#include "fs.h" #include "fs.h"
#include "accessors.h" #include "accessors.h"
#include "super.h"
#define BTRFS_PROP_HANDLERS_HT_BITS 8 #define BTRFS_PROP_HANDLERS_HT_BITS 8
static DEFINE_HASHTABLE(prop_handlers_ht, BTRFS_PROP_HANDLERS_HT_BITS); static DEFINE_HASHTABLE(prop_handlers_ht, BTRFS_PROP_HANDLERS_HT_BITS);
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "accessors.h" #include "accessors.h"
#include "file-item.h" #include "file-item.h"
#include "file.h" #include "file.h"
#include "super.h"
#define BTRFS_MAX_DEDUPE_LEN SZ_16M #define BTRFS_MAX_DEDUPE_LEN SZ_16M
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "root-tree.h" #include "root-tree.h"
#include "file-item.h" #include "file-item.h"
#include "relocation.h" #include "relocation.h"
#include "super.h"
/* /*
* Relocation overview * Relocation overview
......
...@@ -9,4 +9,21 @@ int btrfs_sync_fs(struct super_block *sb, int wait); ...@@ -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, char *btrfs_get_subvol_name_from_objectid(struct btrfs_fs_info *fs_info,
u64 subvol_objectid); 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 #endif
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "ioctl.h" #include "ioctl.h"
#include "relocation.h" #include "relocation.h"
#include "scrub.h" #include "scrub.h"
#include "super.h"
static struct bio_set btrfs_bioset; static struct bio_set btrfs_bioset;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment