summaryrefslogtreecommitdiff
path: root/drivers/dax/super.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-08-26 16:55:06 +0300
committerDan Williams <dan.j.williams@intel.com>2021-08-27 02:52:03 +0300
commit673a0658f6ac359131a881c0dcf1b91c2500ab9c (patch)
tree06b96da7f964db1e4d3f3c7462562fa7f055b281 /drivers/dax/super.c
parent1b7646014e0d838b06be7288e2dec3262948cc56 (diff)
downloadlinux-673a0658f6ac359131a881c0dcf1b91c2500ab9c.tar.xz
dax: move the dax_read_lock() locking into dax_supported
Move the dax_read_lock/dax_read_unlock pair from the callers into dax_supported to make it a little easier to use. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dan Williams <dan.j.williams@intel.com> Link: https://lore.kernel.org/r/20210826135510.6293-6-hch@lst.de Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dax/super.c')
-rw-r--r--drivers/dax/super.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/dax/super.c b/drivers/dax/super.c
index e13fde57c33e..0f74f83101ab 100644
--- a/drivers/dax/super.c
+++ b/drivers/dax/super.c
@@ -219,7 +219,6 @@ bool __bdev_dax_supported(struct block_device *bdev, int blocksize)
struct request_queue *q;
char buf[BDEVNAME_SIZE];
bool ret;
- int id;
q = bdev_get_queue(bdev);
if (!q || !blk_queue_dax(q)) {
@@ -235,10 +234,8 @@ bool __bdev_dax_supported(struct block_device *bdev, int blocksize)
return false;
}
- id = dax_read_lock();
ret = dax_supported(dax_dev, bdev, blocksize, 0,
i_size_read(bdev->bd_inode) / 512);
- dax_read_unlock(id);
put_dax(dax_dev);
@@ -356,13 +353,18 @@ EXPORT_SYMBOL_GPL(dax_direct_access);
bool dax_supported(struct dax_device *dax_dev, struct block_device *bdev,
int blocksize, sector_t start, sector_t len)
{
- if (!dax_dev)
- return false;
+ bool ret = false;
+ int id;
- if (!dax_alive(dax_dev))
+ if (!dax_dev)
return false;
- return dax_dev->ops->dax_supported(dax_dev, bdev, blocksize, start, len);
+ id = dax_read_lock();
+ if (dax_alive(dax_dev))
+ ret = dax_dev->ops->dax_supported(dax_dev, bdev, blocksize,
+ start, len);
+ dax_read_unlock(id);
+ return ret;
}
EXPORT_SYMBOL_GPL(dax_supported);