diff options
| -rw-r--r-- | fs/btrfs/free-space-cache.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 253cb74b0e27..d773f229d14d 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c | |||
| @@ -1149,7 +1149,8 @@ int btrfs_wait_cache_io(struct btrfs_root *root, | |||
| 1149 | if (!inode) | 1149 | if (!inode) |
| 1150 | return 0; | 1150 | return 0; |
| 1151 | 1151 | ||
| 1152 | root = root->fs_info->tree_root; | 1152 | if (block_group) |
| 1153 | root = root->fs_info->tree_root; | ||
| 1153 | 1154 | ||
| 1154 | /* Flush the dirty pages in the cache file. */ | 1155 | /* Flush the dirty pages in the cache file. */ |
| 1155 | ret = flush_dirty_cache(inode); | 1156 | ret = flush_dirty_cache(inode); |
| @@ -3463,9 +3464,12 @@ int btrfs_write_out_ino_cache(struct btrfs_root *root, | |||
| 3463 | if (!btrfs_test_opt(root, INODE_MAP_CACHE)) | 3464 | if (!btrfs_test_opt(root, INODE_MAP_CACHE)) |
| 3464 | return 0; | 3465 | return 0; |
| 3465 | 3466 | ||
| 3467 | memset(&io_ctl, 0, sizeof(io_ctl)); | ||
| 3466 | ret = __btrfs_write_out_cache(root, inode, ctl, NULL, &io_ctl, | 3468 | ret = __btrfs_write_out_cache(root, inode, ctl, NULL, &io_ctl, |
| 3467 | trans, path, 0) || | 3469 | trans, path, 0); |
| 3468 | btrfs_wait_cache_io(root, trans, NULL, &io_ctl, path, 0); | 3470 | if (!ret) |
| 3471 | ret = btrfs_wait_cache_io(root, trans, NULL, &io_ctl, path, 0); | ||
| 3472 | |||
| 3469 | if (ret) { | 3473 | if (ret) { |
| 3470 | btrfs_delalloc_release_metadata(inode, inode->i_size); | 3474 | btrfs_delalloc_release_metadata(inode, inode->i_size); |
| 3471 | #ifdef DEBUG | 3475 | #ifdef DEBUG |
