struct request_queue *q;
char buf[BDEVNAME_SIZE];
bool ret;
- int id;
q = bdev_get_queue(bdev);
if (!q || !blk_queue_dax(q)) {
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);
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);
int device_not_dax_capable(struct dm_target *ti, struct dm_dev *dev,
sector_t start, sector_t len, void *data)
{
- int blocksize = *(int *) data, id;
- bool rc;
+ int blocksize = *(int *) data;
- id = dax_read_lock();
- rc = !dax_supported(dev->dax_dev, dev->bdev, blocksize, start, len);
- dax_read_unlock(id);
-
- return rc;
+ return !dax_supported(dev->dax_dev, dev->bdev, blocksize, start, len);
}
/* Check devices support synchronous DAX */