summaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/volumes.c20
-rw-r--r--fs/btrfs/volumes.h1
2 files changed, 8 insertions, 13 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 66b8b492d6f5..2bde9e9c188e 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1231,14 +1231,6 @@ again:
1231 mutex_unlock(&uuid_mutex); 1231 mutex_unlock(&uuid_mutex);
1232} 1232}
1233 1233
1234static void free_device_rcu(struct rcu_head *head)
1235{
1236 struct btrfs_device *device;
1237
1238 device = container_of(head, struct btrfs_device, rcu);
1239 btrfs_free_device(device);
1240}
1241
1242static void btrfs_close_bdev(struct btrfs_device *device) 1234static void btrfs_close_bdev(struct btrfs_device *device)
1243{ 1235{
1244 if (!device->bdev) 1236 if (!device->bdev)
@@ -1286,7 +1278,8 @@ static void btrfs_close_one_device(struct btrfs_device *device)
1286 list_replace_rcu(&device->dev_list, &new_device->dev_list); 1278 list_replace_rcu(&device->dev_list, &new_device->dev_list);
1287 new_device->fs_devices = device->fs_devices; 1279 new_device->fs_devices = device->fs_devices;
1288 1280
1289 call_rcu(&device->rcu, free_device_rcu); 1281 synchronize_rcu();
1282 btrfs_free_device(device);
1290} 1283}
1291 1284
1292static int close_fs_devices(struct btrfs_fs_devices *fs_devices) 1285static int close_fs_devices(struct btrfs_fs_devices *fs_devices)
@@ -2243,7 +2236,8 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path,
2243 btrfs_scratch_superblocks(device->bdev, device->name->str); 2236 btrfs_scratch_superblocks(device->bdev, device->name->str);
2244 2237
2245 btrfs_close_bdev(device); 2238 btrfs_close_bdev(device);
2246 call_rcu(&device->rcu, free_device_rcu); 2239 synchronize_rcu();
2240 btrfs_free_device(device);
2247 2241
2248 if (cur_devices->open_devices == 0) { 2242 if (cur_devices->open_devices == 0) {
2249 while (fs_devices) { 2243 while (fs_devices) {
@@ -2311,7 +2305,8 @@ void btrfs_rm_dev_replace_free_srcdev(struct btrfs_fs_info *fs_info,
2311 } 2305 }
2312 2306
2313 btrfs_close_bdev(srcdev); 2307 btrfs_close_bdev(srcdev);
2314 call_rcu(&srcdev->rcu, free_device_rcu); 2308 synchronize_rcu();
2309 btrfs_free_device(srcdev);
2315 2310
2316 /* if this is no devs we rather delete the fs_devices */ 2311 /* if this is no devs we rather delete the fs_devices */
2317 if (!fs_devices->num_devices) { 2312 if (!fs_devices->num_devices) {
@@ -2369,7 +2364,8 @@ void btrfs_destroy_dev_replace_tgtdev(struct btrfs_device *tgtdev)
2369 btrfs_scratch_superblocks(tgtdev->bdev, tgtdev->name->str); 2364 btrfs_scratch_superblocks(tgtdev->bdev, tgtdev->name->str);
2370 2365
2371 btrfs_close_bdev(tgtdev); 2366 btrfs_close_bdev(tgtdev);
2372 call_rcu(&tgtdev->rcu, free_device_rcu); 2367 synchronize_rcu();
2368 btrfs_free_device(tgtdev);
2373} 2369}
2374 2370
2375static struct btrfs_device *btrfs_find_device_by_path( 2371static struct btrfs_device *btrfs_find_device_by_path(
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index b9912b910d6d..d3658a4e65db 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -118,7 +118,6 @@ struct btrfs_device {
118 struct scrub_ctx *scrub_ctx; 118 struct scrub_ctx *scrub_ctx;
119 119
120 struct btrfs_work work; 120 struct btrfs_work work;
121 struct rcu_head rcu;
122 121
123 /* readahead state */ 122 /* readahead state */
124 atomic_t reada_in_flight; 123 atomic_t reada_in_flight;