Commit 1008fe6d authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

block: remove the all_bdevs list

Instead just iterate over the inodes for the block device superblock.
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 47b5e003
...@@ -773,7 +773,6 @@ static void init_once(void *foo) ...@@ -773,7 +773,6 @@ static void init_once(void *foo)
memset(bdev, 0, sizeof(*bdev)); memset(bdev, 0, sizeof(*bdev));
mutex_init(&bdev->bd_mutex); mutex_init(&bdev->bd_mutex);
INIT_LIST_HEAD(&bdev->bd_list);
#ifdef CONFIG_SYSFS #ifdef CONFIG_SYSFS
INIT_LIST_HEAD(&bdev->bd_holder_disks); INIT_LIST_HEAD(&bdev->bd_holder_disks);
#endif #endif
...@@ -789,9 +788,6 @@ static void bdev_evict_inode(struct inode *inode) ...@@ -789,9 +788,6 @@ static void bdev_evict_inode(struct inode *inode)
truncate_inode_pages_final(&inode->i_data); truncate_inode_pages_final(&inode->i_data);
invalidate_inode_buffers(inode); /* is it needed here? */ invalidate_inode_buffers(inode); /* is it needed here? */
clear_inode(inode); clear_inode(inode);
spin_lock(&bdev_lock);
list_del_init(&bdev->bd_list);
spin_unlock(&bdev_lock);
/* Detach inode from wb early as bdi_put() may free bdi->wb */ /* Detach inode from wb early as bdi_put() may free bdi->wb */
inode_detach_wb(inode); inode_detach_wb(inode);
if (bdev->bd_bdi != &noop_backing_dev_info) { if (bdev->bd_bdi != &noop_backing_dev_info) {
...@@ -866,8 +862,6 @@ static int bdev_set(struct inode *inode, void *data) ...@@ -866,8 +862,6 @@ static int bdev_set(struct inode *inode, void *data)
return 0; return 0;
} }
static LIST_HEAD(all_bdevs);
struct block_device *bdget(dev_t dev) struct block_device *bdget(dev_t dev)
{ {
struct block_device *bdev; struct block_device *bdev;
...@@ -892,9 +886,6 @@ struct block_device *bdget(dev_t dev) ...@@ -892,9 +886,6 @@ struct block_device *bdget(dev_t dev)
inode->i_bdev = bdev; inode->i_bdev = bdev;
inode->i_data.a_ops = &def_blk_aops; inode->i_data.a_ops = &def_blk_aops;
mapping_set_gfp_mask(&inode->i_data, GFP_USER); mapping_set_gfp_mask(&inode->i_data, GFP_USER);
spin_lock(&bdev_lock);
list_add(&bdev->bd_list, &all_bdevs);
spin_unlock(&bdev_lock);
unlock_new_inode(inode); unlock_new_inode(inode);
} }
return bdev; return bdev;
...@@ -915,13 +906,14 @@ EXPORT_SYMBOL(bdgrab); ...@@ -915,13 +906,14 @@ EXPORT_SYMBOL(bdgrab);
long nr_blockdev_pages(void) long nr_blockdev_pages(void)
{ {
struct block_device *bdev; struct inode *inode;
long ret = 0; long ret = 0;
spin_lock(&bdev_lock);
list_for_each_entry(bdev, &all_bdevs, bd_list) { spin_lock(&blockdev_superblock->s_inode_list_lock);
ret += bdev->bd_inode->i_mapping->nrpages; list_for_each_entry(inode, &blockdev_superblock->s_inodes, i_sb_list)
} ret += inode->i_mapping->nrpages;
spin_unlock(&bdev_lock); spin_unlock(&blockdev_superblock->s_inode_list_lock);
return ret; return ret;
} }
......
...@@ -40,7 +40,6 @@ struct block_device { ...@@ -40,7 +40,6 @@ struct block_device {
int bd_invalidated; int bd_invalidated;
struct gendisk * bd_disk; struct gendisk * bd_disk;
struct backing_dev_info *bd_bdi; struct backing_dev_info *bd_bdi;
struct list_head bd_list;
/* The counter of freeze processes */ /* The counter of freeze processes */
int bd_fsfreeze_count; int bd_fsfreeze_count;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment