xref: /linux/fs/btrfs/super.h (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 
3 #ifndef BTRFS_SUPER_H
4 #define BTRFS_SUPER_H
5 
6 #include <linux/types.h>
7 #include <linux/fs.h>
8 #include "fs.h"
9 
10 struct super_block;
11 struct btrfs_fs_info;
12 
13 bool btrfs_check_options(const struct btrfs_fs_info *info,
14 			 unsigned long long *mount_opt,
15 			 unsigned long flags);
16 int btrfs_sync_fs(struct super_block *sb, int wait);
17 char *btrfs_get_subvol_name_from_objectid(struct btrfs_fs_info *fs_info,
18 					  u64 subvol_objectid);
19 void btrfs_set_free_space_cache_settings(struct btrfs_fs_info *fs_info);
20 
21 static inline struct btrfs_fs_info *btrfs_sb(struct super_block *sb)
22 {
23 	return sb->s_fs_info;
24 }
25 
26 static inline void btrfs_set_sb_rdonly(struct super_block *sb)
27 {
28 	sb->s_flags |= SB_RDONLY;
29 	set_bit(BTRFS_FS_STATE_RO, &btrfs_sb(sb)->fs_state);
30 }
31 
32 static inline void btrfs_clear_sb_rdonly(struct super_block *sb)
33 {
34 	sb->s_flags &= ~SB_RDONLY;
35 	clear_bit(BTRFS_FS_STATE_RO, &btrfs_sb(sb)->fs_state);
36 }
37 
38 #endif
39