Lines Matching refs:fs_info

90 	 * main phase. The fs_info::balance_ctl is initialized.
815 static inline void btrfs_set_last_root_drop_gen(struct btrfs_fs_info *fs_info,
818 WRITE_ONCE(fs_info->last_root_drop_gen, gen);
821 static inline u64 btrfs_get_last_root_drop_gen(const struct btrfs_fs_info *fs_info)
823 return READ_ONCE(fs_info->last_root_drop_gen);
831 const struct btrfs_fs_info *fs_info, u64 csum_bytes)
833 const u64 num_csums = csum_bytes >> fs_info->sectorsize_bits;
835 return DIV_ROUND_UP_ULL(num_csums, fs_info->csums_per_leaf);
842 static inline u64 btrfs_calc_insert_metadata_size(const struct btrfs_fs_info *fs_info,
845 return (u64)fs_info->nodesize * BTRFS_MAX_LEVEL * 2 * num_items;
852 static inline u64 btrfs_calc_metadata_size(const struct btrfs_fs_info *fs_info,
855 return (u64)fs_info->nodesize * BTRFS_MAX_LEVEL * num_items;
858 #define BTRFS_MAX_EXTENT_ITEM_SIZE(r) ((BTRFS_LEAF_DATA_SIZE(r->fs_info) >> 4) - \
861 static inline bool btrfs_is_zoned(const struct btrfs_fs_info *fs_info)
863 return IS_ENABLED(CONFIG_BLK_DEV_ZONED) && fs_info->zone_size > 0;
867 * Count how many fs_info->max_extent_size cover the @size
869 static inline u32 count_max_extents(struct btrfs_fs_info *fs_info, u64 size)
872 if (!fs_info)
876 return div_u64(size + fs_info->max_extent_size - 1, fs_info->max_extent_size);
879 bool btrfs_exclop_start(struct btrfs_fs_info *fs_info,
881 bool btrfs_exclop_start_try_lock(struct btrfs_fs_info *fs_info,
883 void btrfs_exclop_start_unlock(struct btrfs_fs_info *fs_info);
884 void btrfs_exclop_finish(struct btrfs_fs_info *fs_info);
885 void btrfs_exclop_balance(struct btrfs_fs_info *fs_info,
889 void __btrfs_set_fs_incompat(struct btrfs_fs_info *fs_info, u64 flag,
891 void __btrfs_clear_fs_incompat(struct btrfs_fs_info *fs_info, u64 flag,
893 void __btrfs_set_fs_compat_ro(struct btrfs_fs_info *fs_info, u64 flag,
895 void __btrfs_clear_fs_compat_ro(struct btrfs_fs_info *fs_info, u64 flag,
898 #define __btrfs_fs_incompat(fs_info, flags) \
899 (!!(btrfs_super_incompat_flags((fs_info)->super_copy) & (flags)))
901 #define __btrfs_fs_compat_ro(fs_info, flags) \
902 (!!(btrfs_super_compat_ro_flags((fs_info)->super_copy) & (flags)))
910 #define btrfs_fs_incompat(fs_info, opt) \
911 __btrfs_fs_incompat((fs_info), BTRFS_FEATURE_INCOMPAT_##opt)
919 #define btrfs_fs_compat_ro(fs_info, opt) \
920 __btrfs_fs_compat_ro((fs_info), BTRFS_FEATURE_COMPAT_RO_##opt)
925 #define btrfs_test_opt(fs_info, opt) ((fs_info)->mount_opt & \
928 #define btrfs_set_and_info(fs_info, opt, fmt, args...) \
930 if (!btrfs_test_opt(fs_info, opt)) \
931 btrfs_info(fs_info, fmt, ##args); \
932 btrfs_set_opt(fs_info->mount_opt, opt); \
935 #define btrfs_clear_and_info(fs_info, opt, fmt, args...) \
937 if (btrfs_test_opt(fs_info, opt)) \
938 btrfs_info(fs_info, fmt, ##args); \
939 btrfs_clear_opt(fs_info->mount_opt, opt); \
942 static inline int btrfs_fs_closing(struct btrfs_fs_info *fs_info)
945 if (test_bit(BTRFS_FS_CLOSING_START, &fs_info->flags)) {
946 if (test_bit(BTRFS_FS_CLOSING_DONE, &fs_info->flags))
961 static inline int btrfs_need_cleaner_sleep(struct btrfs_fs_info *fs_info)
963 return test_bit(BTRFS_FS_STATE_RO, &fs_info->fs_state) ||
964 btrfs_fs_closing(fs_info);
967 static inline void btrfs_wake_unfinished_drop(struct btrfs_fs_info *fs_info)
969 clear_and_wake_up_bit(BTRFS_FS_UNFINISHED_DROPS, &fs_info->flags);
972 #define BTRFS_FS_ERROR(fs_info) (READ_ONCE((fs_info)->fs_error))
974 #define BTRFS_FS_LOG_CLEANUP_ERROR(fs_info) \
976 &(fs_info)->fs_state)))
982 static inline int btrfs_is_testing(struct btrfs_fs_info *fs_info)
984 return test_bit(BTRFS_FS_STATE_DUMMY_FS_INFO, &fs_info->fs_state);
993 static inline int btrfs_is_testing(struct btrfs_fs_info *fs_info)