summaryrefslogtreecommitdiff
path: root/fs/btrfs/super.h
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2022-10-26 22:08:40 +0300
committerDavid Sterba <dsterba@suse.com>2022-12-05 20:00:47 +0300
commit7f0add250f829248281e1745d92648f72192a8f4 (patch)
tree2dd8a57be390b8b54c31417b6c5bfd0ae427d402 /fs/btrfs/super.h
parentc03b22076bd2c9fe88c055a35637a836d986db76 (diff)
downloadlinux-7f0add250f829248281e1745d92648f72192a8f4.tar.xz
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>
Diffstat (limited to 'fs/btrfs/super.h')
-rw-r--r--fs/btrfs/super.h17
1 files changed, 17 insertions, 0 deletions
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