diff options
author | Liu Bo <bo.li.liu@oracle.com> | 2017-10-23 23:02:54 -0600 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-01-22 16:08:10 +0100 |
commit | 9f5316c17b0833c606b94d91beb6518c2e8a8012 (patch) | |
tree | b8dfd6d916f24932ea15fd6c91dc7e17c119847b | |
parent | 1805f2ca3f27f25c8e637edc4b40bab237f9d07c (diff) | |
download | linux-9f5316c17b0833c606b94d91beb6518c2e8a8012.tar.gz |
Btrfs: free btrfs_device in place
It's pointless to defer it to a kthread helper as we're not under a
special context.
For reference, commit 1f78160ce1b1 ("Btrfs: using rcu lock in the reader
side of devices list") introduced RCU freeing for device structures.
Originally the blkdev_put was called from free_device and rcu_barrier had
to be called. This is no longer required, bdev and our device structures
are now freed separately.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
[ enhance changelog ]
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | fs/btrfs/volumes.c | 14 | ||||
-rw-r--r-- | fs/btrfs/volumes.h | 1 |
2 files changed, 2 insertions, 13 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index a25684287501..f3c4ad2ddfe6 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -824,26 +824,16 @@ again: mutex_unlock(&uuid_mutex); } -static void __free_device(struct work_struct *work) +static void free_device(struct rcu_head *head) { struct btrfs_device *device; - device = container_of(work, struct btrfs_device, rcu_work); + device = container_of(head, struct btrfs_device, rcu); rcu_string_free(device->name); bio_put(device->flush_bio); kfree(device); } -static void free_device(struct rcu_head *head) -{ - struct btrfs_device *device; - - device = container_of(head, struct btrfs_device, rcu); - - INIT_WORK(&device->rcu_work, __free_device); - schedule_work(&device->rcu_work); -} - static void btrfs_close_bdev(struct btrfs_device *device) { if (device->bdev && device->writeable) { diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h index ff15208344a7..bf0d53a96b4a 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h @@ -133,7 +133,6 @@ struct btrfs_device { struct btrfs_work work; struct rcu_head rcu; - struct work_struct rcu_work; /* readahead state */ spinlock_t reada_lock; |