mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
a6a8f22a4a
Currently we pre-load the space cache settings in btrfs_parse_options, however when we switch to the new mount API the mount option parsing will happen before we have the super block loaded. Add a helper to set the appropriate options based on the fs settings, this will allow us to have consistent free space cache settings. This also folds in the space cache related decisions we make for subpage sectorsize support, so all of this is done in one place. Since this was being called by parse options it looks like we're changing the behavior of remount, but in fact we aren't. The pre-loading of the free space cache settings is done because we want to handle the case of users not using any space_cache options, we'll derive the appropriate mount option based on the on disk state. On remount this wouldn't reset anything as we'll have cleared the v1 cache generation if we mounted -o nospace_cache. Similarly it's impossible to turn off the free space tree without specifically saying -o nospace_cache,clear_cache, which will delete the free space tree and clear the compat_ro option. Again in this case calling this code in remount wouldn't result in any change. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Anand Jain <anand.jain@oracle.com> Acked-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
31 lines
817 B
C
31 lines
817 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
#ifndef BTRFS_SUPER_H
|
|
#define BTRFS_SUPER_H
|
|
|
|
int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
|
|
unsigned long new_flags);
|
|
int btrfs_sync_fs(struct super_block *sb, int wait);
|
|
char *btrfs_get_subvol_name_from_objectid(struct btrfs_fs_info *fs_info,
|
|
u64 subvol_objectid);
|
|
void btrfs_set_free_space_cache_settings(struct btrfs_fs_info *fs_info);
|
|
|
|
static inline struct btrfs_fs_info *btrfs_sb(struct super_block *sb)
|
|
{
|
|
return sb->s_fs_info;
|
|
}
|
|
|
|
static inline void btrfs_set_sb_rdonly(struct super_block *sb)
|
|
{
|
|
sb->s_flags |= SB_RDONLY;
|
|
set_bit(BTRFS_FS_STATE_RO, &btrfs_sb(sb)->fs_state);
|
|
}
|
|
|
|
static inline void btrfs_clear_sb_rdonly(struct super_block *sb)
|
|
{
|
|
sb->s_flags &= ~SB_RDONLY;
|
|
clear_bit(BTRFS_FS_STATE_RO, &btrfs_sb(sb)->fs_state);
|
|
}
|
|
|
|
#endif
|