From 7f0add250f829248281e1745d92648f72192a8f4 Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Wed, 26 Oct 2022 15:08:40 -0400 Subject: 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 Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba --- fs/btrfs/compression.c | 1 + fs/btrfs/defrag.c | 1 + fs/btrfs/export.c | 1 + fs/btrfs/extent_io.c | 1 + fs/btrfs/file-item.c | 1 + fs/btrfs/file.c | 1 + fs/btrfs/free-space-cache.c | 1 + fs/btrfs/fs.h | 17 ----------------- fs/btrfs/inode.c | 1 + fs/btrfs/lzo.c | 1 + fs/btrfs/messages.c | 1 + fs/btrfs/ordered-data.c | 1 + fs/btrfs/props.c | 1 + fs/btrfs/reflink.c | 1 + fs/btrfs/relocation.c | 1 + fs/btrfs/super.h | 17 +++++++++++++++++ fs/btrfs/volumes.c | 1 + 17 files changed, 32 insertions(+), 17 deletions(-) (limited to 'fs') diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index 61828f8375e6..e66fa18dbcf7 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -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" }; diff --git a/fs/btrfs/defrag.c b/fs/btrfs/defrag.c index ed82085acea3..48a9460d49c7 100644 --- a/fs/btrfs/defrag.c +++ b/fs/btrfs/defrag.c @@ -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; diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c index b6bc9684648f..744a02b7fd67 100644 --- a/fs/btrfs/export.c +++ b/fs/btrfs/export.c @@ -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) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 6373b1565250..bda420d697f4 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -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; diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c index 20d88cd0b602..036d50af5666 100644 --- a/fs/btrfs/file-item.c +++ b/fs/btrfs/file-item.c @@ -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) / \ diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index b94dc4b2c486..f9bea57abbde 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -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. diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index aef075b63188..797edb41d0aa 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c @@ -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 diff --git a/fs/btrfs/fs.h b/fs/btrfs/fs.h index 7d0da8509567..c7f2a512fba2 100644 --- a/fs/btrfs/fs.h +++ b/fs/btrfs/fs.h @@ -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); diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 0fda1c5ba28e..83e5ae6b74ef 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -68,6 +68,7 @@ #include "acl.h" #include "relocation.h" #include "verity.h" +#include "super.h" struct btrfs_iget_args { u64 ino; diff --git a/fs/btrfs/lzo.c b/fs/btrfs/lzo.c index 6751874a3e69..e7b1ceffcd33 100644 --- a/fs/btrfs/lzo.c +++ b/fs/btrfs/lzo.c @@ -16,6 +16,7 @@ #include "messages.h" #include "compression.h" #include "ctree.h" +#include "super.h" #define LZO_LEN 4 diff --git a/fs/btrfs/messages.c b/fs/btrfs/messages.c index 196757ee16f1..625bbbbb2608 100644 --- a/fs/btrfs/messages.c +++ b/fs/btrfs/messages.c @@ -5,6 +5,7 @@ #include "discard.h" #include "transaction.h" #include "space-info.h" +#include "super.h" #ifdef CONFIG_PRINTK diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index 2aea2a17ed95..8fda1949b71b 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c @@ -19,6 +19,7 @@ #include "qgroup.h" #include "subpage.h" #include "file.h" +#include "super.h" static struct kmem_cache *btrfs_ordered_extent_cache; diff --git a/fs/btrfs/props.c b/fs/btrfs/props.c index 9ad15d69718c..0755af0e53e3 100644 --- a/fs/btrfs/props.c +++ b/fs/btrfs/props.c @@ -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); diff --git a/fs/btrfs/reflink.c b/fs/btrfs/reflink.c index 3c962b5d8dbd..9d728107536e 100644 --- a/fs/btrfs/reflink.c +++ b/fs/btrfs/reflink.c @@ -14,6 +14,7 @@ #include "accessors.h" #include "file-item.h" #include "file.h" +#include "super.h" #define BTRFS_MAX_DEDUPE_LEN SZ_16M diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index f31a97d4f9ad..d119986d1599 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -34,6 +34,7 @@ #include "root-tree.h" #include "file-item.h" #include "relocation.h" +#include "super.h" /* * Relocation overview diff --git a/fs/btrfs/super.h b/fs/btrfs/super.h index c8875653e628..8dbb909b364f 100644 --- a/fs/btrfs/super.h +++ b/fs/btrfs/super.h @@ -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 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 5606060770eb..1c9f7a946657 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -39,6 +39,7 @@ #include "ioctl.h" #include "relocation.h" #include "scrub.h" +#include "super.h" static struct bio_set btrfs_bioset; -- cgit v1.2.3