mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02:00
block: remove i_bdev
Switch the block device lookup interfaces to directly work with a dev_t so that struct block_device references are only acquired by the blkdev_get variants (and the blk-cgroup special case). This means that we now don't need an extra reference in the inode and can generally simplify handling of struct block_device to keep the lookups contained in the core block layer code. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Hannes Reinecke <hare@suse.de> Acked-by: Tejun Heo <tj@kernel.org> Acked-by: Coly Li <colyli@suse.de> [bcache] Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
committed by
Jens Axboe
parent
7918f0f6fd
commit
4e7b5671c6
44
fs/super.c
44
fs/super.c
@@ -740,7 +740,14 @@ void iterate_supers_type(struct file_system_type *type,
|
||||
|
||||
EXPORT_SYMBOL(iterate_supers_type);
|
||||
|
||||
struct super_block *__get_super(struct block_device *bdev, bool excl)
|
||||
/**
|
||||
* get_super - get the superblock of a device
|
||||
* @bdev: device to get the superblock for
|
||||
*
|
||||
* Scans the superblock list and finds the superblock of the file system
|
||||
* mounted on the device given. %NULL is returned if no match is found.
|
||||
*/
|
||||
struct super_block *get_super(struct block_device *bdev)
|
||||
{
|
||||
struct super_block *sb;
|
||||
|
||||
@@ -755,17 +762,11 @@ rescan:
|
||||
if (sb->s_bdev == bdev) {
|
||||
sb->s_count++;
|
||||
spin_unlock(&sb_lock);
|
||||
if (!excl)
|
||||
down_read(&sb->s_umount);
|
||||
else
|
||||
down_write(&sb->s_umount);
|
||||
down_read(&sb->s_umount);
|
||||
/* still alive? */
|
||||
if (sb->s_root && (sb->s_flags & SB_BORN))
|
||||
return sb;
|
||||
if (!excl)
|
||||
up_read(&sb->s_umount);
|
||||
else
|
||||
up_write(&sb->s_umount);
|
||||
up_read(&sb->s_umount);
|
||||
/* nope, got unmounted */
|
||||
spin_lock(&sb_lock);
|
||||
__put_super(sb);
|
||||
@@ -776,19 +777,6 @@ rescan:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* get_super - get the superblock of a device
|
||||
* @bdev: device to get the superblock for
|
||||
*
|
||||
* Scans the superblock list and finds the superblock of the file system
|
||||
* mounted on the device given. %NULL is returned if no match is found.
|
||||
*/
|
||||
struct super_block *get_super(struct block_device *bdev)
|
||||
{
|
||||
return __get_super(bdev, false);
|
||||
}
|
||||
EXPORT_SYMBOL(get_super);
|
||||
|
||||
/**
|
||||
* get_active_super - get an active reference to the superblock of a device
|
||||
* @bdev: device to get the superblock for
|
||||
@@ -820,7 +808,7 @@ restart:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct super_block *user_get_super(dev_t dev)
|
||||
struct super_block *user_get_super(dev_t dev, bool excl)
|
||||
{
|
||||
struct super_block *sb;
|
||||
|
||||
@@ -832,11 +820,17 @@ rescan:
|
||||
if (sb->s_dev == dev) {
|
||||
sb->s_count++;
|
||||
spin_unlock(&sb_lock);
|
||||
down_read(&sb->s_umount);
|
||||
if (excl)
|
||||
down_write(&sb->s_umount);
|
||||
else
|
||||
down_read(&sb->s_umount);
|
||||
/* still alive? */
|
||||
if (sb->s_root && (sb->s_flags & SB_BORN))
|
||||
return sb;
|
||||
up_read(&sb->s_umount);
|
||||
if (excl)
|
||||
up_write(&sb->s_umount);
|
||||
else
|
||||
up_read(&sb->s_umount);
|
||||
/* nope, got unmounted */
|
||||
spin_lock(&sb_lock);
|
||||
__put_super(sb);
|
||||
|
Reference in New Issue
Block a user