mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
btrfs: remove btrfs_disk_cache_state
With neither the writer nor the loader left, nothing acts on disk_cache_state. Remove it, the need_clear handling when reading block groups, and the enum. While at it, drop the unused cache_generation field from struct btrfs_block_group. lookup_free_space_inode() converted old style space inodes by clearing disk_cache_state so the cache would be rewritten with the new inode flags. Without that it only sets flags on the in-memory inode, which every remaining caller truncates or deletes right after, so drop the conversion too. Assisted-by: LLM Signed-off-by: Tal Zussman <tz2294@columbia.edu> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
324ad3a989
commit
d8a4bb425e
|
|
@ -2496,8 +2496,7 @@ static int check_chunk_block_group_mappings(struct btrfs_fs_info *fs_info)
|
|||
|
||||
static int read_one_block_group(struct btrfs_fs_info *info,
|
||||
struct btrfs_block_group_item_v2 *bgi,
|
||||
const struct btrfs_key *key,
|
||||
bool need_clear)
|
||||
const struct btrfs_key *key)
|
||||
{
|
||||
struct btrfs_block_group *cache;
|
||||
const bool mixed = btrfs_fs_incompat(info, MIXED_GROUPS);
|
||||
|
|
@ -2523,20 +2522,6 @@ static int read_one_block_group(struct btrfs_fs_info *info,
|
|||
|
||||
btrfs_set_free_space_tree_thresholds(cache);
|
||||
|
||||
if (need_clear) {
|
||||
/*
|
||||
* When we mount with old space cache, we need to
|
||||
* set BTRFS_DC_CLEAR and set dirty flag.
|
||||
*
|
||||
* a) Setting 'BTRFS_DC_CLEAR' makes sure that we
|
||||
* truncate the old free space cache inode and
|
||||
* setup a new one.
|
||||
* b) Setting 'dirty flag' makes sure that we flush
|
||||
* the new space cache info onto disk.
|
||||
*/
|
||||
if (btrfs_test_opt(info, SPACE_CACHE))
|
||||
cache->disk_cache_state = BTRFS_DC_CLEAR;
|
||||
}
|
||||
if (!mixed && ((cache->flags & BTRFS_BLOCK_GROUP_METADATA) &&
|
||||
(cache->flags & BTRFS_BLOCK_GROUP_DATA))) {
|
||||
btrfs_err(info,
|
||||
|
|
@ -2677,8 +2662,6 @@ int btrfs_read_block_groups(struct btrfs_fs_info *info)
|
|||
struct btrfs_block_group *cache;
|
||||
struct btrfs_space_info *space_info;
|
||||
struct btrfs_key key;
|
||||
bool need_clear = false;
|
||||
u64 cache_gen;
|
||||
|
||||
/*
|
||||
* Either no extent root (with ibadroots rescue option) or we have
|
||||
|
|
@ -2699,13 +2682,6 @@ int btrfs_read_block_groups(struct btrfs_fs_info *info)
|
|||
if (!path)
|
||||
return -ENOMEM;
|
||||
|
||||
cache_gen = btrfs_super_cache_generation(info->super_copy);
|
||||
if (btrfs_test_opt(info, SPACE_CACHE) &&
|
||||
btrfs_super_generation(info->super_copy) != cache_gen)
|
||||
need_clear = true;
|
||||
if (btrfs_test_opt(info, CLEAR_CACHE))
|
||||
need_clear = true;
|
||||
|
||||
while (1) {
|
||||
struct btrfs_block_group_item_v2 bgi;
|
||||
struct extent_buffer *leaf;
|
||||
|
|
@ -2734,7 +2710,7 @@ int btrfs_read_block_groups(struct btrfs_fs_info *info)
|
|||
|
||||
btrfs_item_key_to_cpu(leaf, &key, slot);
|
||||
btrfs_release_path(path);
|
||||
ret = read_one_block_group(info, &bgi, &key, need_clear);
|
||||
ret = read_one_block_group(info, &bgi, &key);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
key.objectid += key.offset;
|
||||
|
|
@ -3597,10 +3573,6 @@ int btrfs_update_block_group(struct btrfs_trans_handle *trans,
|
|||
spin_lock(&space_info->lock);
|
||||
spin_lock(&cache->lock);
|
||||
|
||||
if (btrfs_test_opt(info, SPACE_CACHE) &&
|
||||
cache->disk_cache_state < BTRFS_DC_CLEAR)
|
||||
cache->disk_cache_state = BTRFS_DC_CLEAR;
|
||||
|
||||
old_val = cache->used;
|
||||
if (alloc) {
|
||||
old_val += num_bytes;
|
||||
|
|
|
|||
|
|
@ -20,13 +20,6 @@ struct btrfs_fs_info;
|
|||
struct btrfs_inode;
|
||||
struct btrfs_trans_handle;
|
||||
|
||||
enum btrfs_disk_cache_state {
|
||||
BTRFS_DC_WRITTEN,
|
||||
BTRFS_DC_ERROR,
|
||||
BTRFS_DC_CLEAR,
|
||||
BTRFS_DC_SETUP,
|
||||
};
|
||||
|
||||
enum btrfs_block_group_size_class {
|
||||
/* Unset */
|
||||
BTRFS_BG_SZ_NONE,
|
||||
|
|
@ -131,7 +124,6 @@ struct btrfs_block_group {
|
|||
u64 delalloc_bytes;
|
||||
u64 bytes_super;
|
||||
u64 flags;
|
||||
u64 cache_generation;
|
||||
u64 global_root_id;
|
||||
u64 remap_bytes;
|
||||
u32 identity_remap_count;
|
||||
|
|
@ -171,8 +163,6 @@ struct btrfs_block_group {
|
|||
unsigned long full_stripe_len;
|
||||
unsigned long runtime_flags;
|
||||
|
||||
enum btrfs_disk_cache_state disk_cache_state;
|
||||
|
||||
/* Cache tracking stuff */
|
||||
enum btrfs_caching_type cached;
|
||||
struct btrfs_caching_control *caching_ctl;
|
||||
|
|
|
|||
|
|
@ -4863,10 +4863,6 @@ void btrfs_cleanup_dirty_bgs(struct btrfs_transaction *cur_trans,
|
|||
dirty_list);
|
||||
|
||||
list_del_init(&cache->dirty_list);
|
||||
spin_lock(&cache->lock);
|
||||
cache->disk_cache_state = BTRFS_DC_ERROR;
|
||||
spin_unlock(&cache->lock);
|
||||
|
||||
spin_unlock(&cur_trans->dirty_bgs_lock);
|
||||
btrfs_put_block_group(cache);
|
||||
btrfs_dec_delayed_refs_rsv_bg_updates(fs_info);
|
||||
|
|
|
|||
|
|
@ -124,7 +124,6 @@ struct inode *lookup_free_space_inode(struct btrfs_block_group *block_group,
|
|||
{
|
||||
struct btrfs_fs_info *fs_info = block_group->fs_info;
|
||||
struct inode *inode = NULL;
|
||||
u32 flags = BTRFS_INODE_NODATASUM | BTRFS_INODE_NODATACOW;
|
||||
|
||||
spin_lock(&block_group->lock);
|
||||
if (block_group->inode)
|
||||
|
|
@ -139,13 +138,6 @@ struct inode *lookup_free_space_inode(struct btrfs_block_group *block_group,
|
|||
return inode;
|
||||
|
||||
spin_lock(&block_group->lock);
|
||||
if (!((BTRFS_I(inode)->flags & flags) == flags)) {
|
||||
btrfs_info(fs_info, "Old style space inode found, converting.");
|
||||
BTRFS_I(inode)->flags |= BTRFS_INODE_NODATASUM |
|
||||
BTRFS_INODE_NODATACOW;
|
||||
block_group->disk_cache_state = BTRFS_DC_CLEAR;
|
||||
}
|
||||
|
||||
if (!test_and_set_bit(BLOCK_GROUP_FLAG_IREF, &block_group->runtime_flags))
|
||||
block_group->inode = BTRFS_I(igrab(inode));
|
||||
spin_unlock(&block_group->lock);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user