{
struct percpu_counter *em_counter = &fs_info->evictable_extent_maps;
+ if (fs_info->fs_devices)
+ btrfs_close_devices(fs_info->fs_devices);
percpu_counter_destroy(&fs_info->stats_read_blocks);
percpu_counter_destroy(&fs_info->dirty_metadata_bytes);
percpu_counter_destroy(&fs_info->delalloc_bytes);
iput(fs_info->btree_inode);
fail:
- btrfs_close_devices(fs_info->fs_devices);
ASSERT(ret < 0);
return ret;
}
iput(fs_info->btree_inode);
btrfs_mapping_tree_free(fs_info);
- btrfs_close_devices(fs_info->fs_devices);
}
void btrfs_mark_buffer_dirty(struct btrfs_trans_handle *trans,
if (ret)
return ret;
- if (!(fc->sb_flags & SB_RDONLY) && fs_devices->rw_devices == 0) {
- ret = -EACCES;
- goto error;
- }
+ if (!(fc->sb_flags & SB_RDONLY) && fs_devices->rw_devices == 0)
+ return -EACCES;
bdev = fs_devices->latest_dev->bdev;
sb = sget_fc(fc, btrfs_fc_test_super, set_anon_super_fc);
- if (IS_ERR(sb)) {
- ret = PTR_ERR(sb);
- goto error;
- }
+ if (IS_ERR(sb))
+ return PTR_ERR(sb);
set_device_specific_options(fs_info);
/*
* Not the first mount of the fs thus got an existing super block.
* Will reuse the returned super block, fs_info and fs_devices.
- */
- ASSERT(fc->s_fs_info == fs_info);
-
- /*
+ *
* fc->s_fs_info is not touched and will be later freed by
* put_fs_context() through btrfs_free_fs_context().
*
- * But we have opened fs_devices at the beginning of the
- * function, thus still need to close them manually.
+ * The fs_info->fs_devices will also be closed by btrfs_free_fs_context().
*/
- btrfs_close_devices(fs_devices);
+ ASSERT(fc->s_fs_info == fs_info);
+
/*
* At this stage we may have RO flag mismatch between
* fc->sb_flags and sb->s_flags. Caller should detect such
fc->root = dget(sb->s_root);
return 0;
-
-error:
- btrfs_close_devices(fs_devices);
- return ret;
}
/*