super.h 948 B

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