Commit 3a4174e6 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

block: switch bdgrab to use igrab

All of the current callers already have a reference, but to prepare for
additional users ensure bdgrab returns NULL if the block device is being
freed.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 612c6aa7
......@@ -894,10 +894,14 @@ static struct block_device *bdget(dev_t dev)
/**
* bdgrab -- Grab a reference to an already referenced block device
* @bdev: Block device to grab a reference to.
*
* Returns the block_device with an additional reference when successful,
* or NULL if the inode is already beeing freed.
*/
struct block_device *bdgrab(struct block_device *bdev)
{
ihold(bdev->bd_inode);
if (!igrab(bdev->bd_inode))
return NULL;
return bdev;
}
EXPORT_SYMBOL(bdgrab);
......
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