diff options
author | Dan Williams <dan.j.williams@intel.com> | 2017-08-30 09:16:38 -0700 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2017-08-30 09:16:38 -0700 |
commit | 78f35473508118df5ea04b9515ac3f1aaec0a980 (patch) | |
tree | 176dba5e8788be7cd4bb4d422e21b25fa190ec67 /drivers/dax | |
parent | 14ccee78fc82f5512908f4424f541549a5705b89 (diff) | |
download | blackbird-obmc-linux-78f35473508118df5ea04b9515ac3f1aaec0a980.tar.gz blackbird-obmc-linux-78f35473508118df5ea04b9515ac3f1aaec0a980.zip |
dax: introduce a fs_dax_get_by_bdev() helper
Add a helper that can replace the following common pattern:
if (blk_queue_dax(bdev->bd_queue))
fs_dax_get_by_host(bdev->bd_disk->disk_name);
This will be used to move dax_device lookup from iomap-operation time to
fs-mount time.
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dax')
-rw-r--r-- | drivers/dax/super.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/dax/super.c b/drivers/dax/super.c index 938eb4868f7f..b699aac268a6 100644 --- a/drivers/dax/super.c +++ b/drivers/dax/super.c @@ -46,6 +46,8 @@ void dax_read_unlock(int id) EXPORT_SYMBOL_GPL(dax_read_unlock); #ifdef CONFIG_BLOCK +#include <linux/blkdev.h> + int bdev_dax_pgoff(struct block_device *bdev, sector_t sector, size_t size, pgoff_t *pgoff) { @@ -59,6 +61,14 @@ int bdev_dax_pgoff(struct block_device *bdev, sector_t sector, size_t size, } EXPORT_SYMBOL(bdev_dax_pgoff); +struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev) +{ + if (!blk_queue_dax(bdev->bd_queue)) + return NULL; + return fs_dax_get_by_host(bdev->bd_disk->disk_name); +} +EXPORT_SYMBOL_GPL(fs_dax_get_by_bdev); + /** * __bdev_dax_supported() - Check if the device supports dax for filesystem * @sb: The superblock of the device |