GNU Linux-libre 6.9-gnu
[releases.git] / fs / btrfs / super.h
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(struct btrfs_fs_info *info, unsigned long *mount_opt,
14                          unsigned long flags);
15 int btrfs_sync_fs(struct super_block *sb, int wait);
16 char *btrfs_get_subvol_name_from_objectid(struct btrfs_fs_info *fs_info,
17                                           u64 subvol_objectid);
18 void btrfs_set_free_space_cache_settings(struct btrfs_fs_info *fs_info);
19
20 static inline struct btrfs_fs_info *btrfs_sb(struct super_block *sb)
21 {
22         return sb->s_fs_info;
23 }
24
25 static inline void btrfs_set_sb_rdonly(struct super_block *sb)
26 {
27         sb->s_flags |= SB_RDONLY;
28         set_bit(BTRFS_FS_STATE_RO, &btrfs_sb(sb)->fs_state);
29 }
30
31 static inline void btrfs_clear_sb_rdonly(struct super_block *sb)
32 {
33         sb->s_flags &= ~SB_RDONLY;
34         clear_bit(BTRFS_FS_STATE_RO, &btrfs_sb(sb)->fs_state);
35 }
36
37 #endif