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
10struct super_block;
11struct btrfs_fs_info;
12
13bool btrfs_check_options(struct btrfs_fs_info *info, unsigned long *mount_opt,
14			 unsigned long flags);
15int btrfs_sync_fs(struct super_block *sb, int wait);
16char *btrfs_get_subvol_name_from_objectid(struct btrfs_fs_info *fs_info,
17					  u64 subvol_objectid);
18void btrfs_set_free_space_cache_settings(struct btrfs_fs_info *fs_info);
19
20static inline struct btrfs_fs_info *btrfs_sb(struct super_block *sb)
21{
22	return sb->s_fs_info;
23}
24
25static 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
31static 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
38