diff options
Diffstat (limited to 'fs/btrfs/free-space-cache.c')
-rw-r--r-- | fs/btrfs/free-space-cache.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index d6c03f7f136b..a71978578fa7 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c | |||
@@ -651,15 +651,13 @@ static int __load_free_space_cache(struct btrfs_root *root, struct inode *inode, | |||
651 | struct io_ctl io_ctl; | 651 | struct io_ctl io_ctl; |
652 | struct btrfs_key key; | 652 | struct btrfs_key key; |
653 | struct btrfs_free_space *e, *n; | 653 | struct btrfs_free_space *e, *n; |
654 | struct list_head bitmaps; | 654 | LIST_HEAD(bitmaps); |
655 | u64 num_entries; | 655 | u64 num_entries; |
656 | u64 num_bitmaps; | 656 | u64 num_bitmaps; |
657 | u64 generation; | 657 | u64 generation; |
658 | u8 type; | 658 | u8 type; |
659 | int ret = 0; | 659 | int ret = 0; |
660 | 660 | ||
661 | INIT_LIST_HEAD(&bitmaps); | ||
662 | |||
663 | /* Nothing in the space cache, goodbye */ | 661 | /* Nothing in the space cache, goodbye */ |
664 | if (!i_size_read(inode)) | 662 | if (!i_size_read(inode)) |
665 | return 0; | 663 | return 0; |
@@ -1243,6 +1241,7 @@ int btrfs_write_out_cache(struct btrfs_root *root, | |||
1243 | struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl; | 1241 | struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl; |
1244 | struct inode *inode; | 1242 | struct inode *inode; |
1245 | int ret = 0; | 1243 | int ret = 0; |
1244 | enum btrfs_disk_cache_state dcs = BTRFS_DC_WRITTEN; | ||
1246 | 1245 | ||
1247 | root = root->fs_info->tree_root; | 1246 | root = root->fs_info->tree_root; |
1248 | 1247 | ||
@@ -1266,9 +1265,7 @@ int btrfs_write_out_cache(struct btrfs_root *root, | |||
1266 | ret = __btrfs_write_out_cache(root, inode, ctl, block_group, trans, | 1265 | ret = __btrfs_write_out_cache(root, inode, ctl, block_group, trans, |
1267 | path, block_group->key.objectid); | 1266 | path, block_group->key.objectid); |
1268 | if (ret) { | 1267 | if (ret) { |
1269 | spin_lock(&block_group->lock); | 1268 | dcs = BTRFS_DC_ERROR; |
1270 | block_group->disk_cache_state = BTRFS_DC_ERROR; | ||
1271 | spin_unlock(&block_group->lock); | ||
1272 | ret = 0; | 1269 | ret = 0; |
1273 | #ifdef DEBUG | 1270 | #ifdef DEBUG |
1274 | btrfs_err(root->fs_info, | 1271 | btrfs_err(root->fs_info, |
@@ -1277,6 +1274,9 @@ int btrfs_write_out_cache(struct btrfs_root *root, | |||
1277 | #endif | 1274 | #endif |
1278 | } | 1275 | } |
1279 | 1276 | ||
1277 | spin_lock(&block_group->lock); | ||
1278 | block_group->disk_cache_state = dcs; | ||
1279 | spin_unlock(&block_group->lock); | ||
1280 | iput(inode); | 1280 | iput(inode); |
1281 | return ret; | 1281 | return ret; |
1282 | } | 1282 | } |
@@ -2903,7 +2903,6 @@ int btrfs_find_space_cluster(struct btrfs_root *root, | |||
2903 | trace_btrfs_find_cluster(block_group, offset, bytes, empty_size, | 2903 | trace_btrfs_find_cluster(block_group, offset, bytes, empty_size, |
2904 | min_bytes); | 2904 | min_bytes); |
2905 | 2905 | ||
2906 | INIT_LIST_HEAD(&bitmaps); | ||
2907 | ret = setup_cluster_no_bitmap(block_group, cluster, &bitmaps, offset, | 2906 | ret = setup_cluster_no_bitmap(block_group, cluster, &bitmaps, offset, |
2908 | bytes + empty_size, | 2907 | bytes + empty_size, |
2909 | cont1_bytes, min_bytes); | 2908 | cont1_bytes, min_bytes); |