@@ -3114,12 +3114,56 @@ static int dm_pr_clear(struct block_device *bdev, u64 key)
return r;
}
+static int dm_pr_read_keys(struct block_device *bdev, struct pr_keys *keys,
+ int keys_data_len)
+{
+ struct mapped_device *md = bdev->bd_disk->private_data;
+ const struct pr_ops *ops;
+ int r, srcu_idx;
+
+ r = dm_prepare_ioctl(md, &srcu_idx, &bdev);
+ if (r < 0)
+ goto out;
+
+ ops = bdev->bd_disk->fops->pr_ops;
+ if (ops && ops->pr_read_keys)
+ r = ops->pr_read_keys(bdev, keys, keys_data_len);
+ else
+ r = -EOPNOTSUPP;
+out:
+ dm_unprepare_ioctl(md, srcu_idx);
+ return r;
+}
+
+static int dm_pr_read_reservation(struct block_device *bdev,
+ struct pr_held_reservation *rsv)
+{
+ struct mapped_device *md = bdev->bd_disk->private_data;
+ const struct pr_ops *ops;
+ int r, srcu_idx;
+
+ r = dm_prepare_ioctl(md, &srcu_idx, &bdev);
+ if (r < 0)
+ goto out;
+
+ ops = bdev->bd_disk->fops->pr_ops;
+ if (ops && ops->pr_read_reservation)
+ r = ops->pr_read_reservation(bdev, rsv);
+ else
+ r = -EOPNOTSUPP;
+out:
+ dm_unprepare_ioctl(md, srcu_idx);
+ return r;
+}
+
static const struct pr_ops dm_pr_ops = {
.pr_register = dm_pr_register,
.pr_reserve = dm_pr_reserve,
.pr_release = dm_pr_release,
.pr_preempt = dm_pr_preempt,
.pr_clear = dm_pr_clear,
+ .pr_read_keys = dm_pr_read_keys,
+ .pr_read_reservation = dm_pr_read_reservation,
};
static const struct block_device_operations dm_blk_dops = {
This adds support in dm for the block PR read keys and read reservation callouts. Signed-off-by: Mike Christie <michael.christie@oracle.com> --- drivers/md/dm.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)