[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v7 02/10] block/raw: add persistent reservation in/out driver
From: |
Changqi Lu |
Subject: |
[PATCH v7 02/10] block/raw: add persistent reservation in/out driver |
Date: |
Fri, 5 Jul 2024 18:56:06 +0800 |
Add persistent reservation in/out operations for raw driver.
The following methods are implemented: bdrv_co_pr_read_keys,
bdrv_co_pr_read_reservation, bdrv_co_pr_register, bdrv_co_pr_reserve,
bdrv_co_pr_release, bdrv_co_pr_clear and bdrv_co_pr_preempt.
Signed-off-by: Changqi Lu <luchangqi.123@bytedance.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
block/raw-format.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/block/raw-format.c b/block/raw-format.c
index ac7e8495f6..3746bc1bd3 100644
--- a/block/raw-format.c
+++ b/block/raw-format.c
@@ -454,6 +454,55 @@ raw_co_ioctl(BlockDriverState *bs, unsigned long int req,
void *buf)
return bdrv_co_ioctl(bs->file->bs, req, buf);
}
+static int coroutine_fn GRAPH_RDLOCK
+raw_co_pr_read_keys(BlockDriverState *bs, uint32_t *generation,
+ uint32_t num_keys, uint64_t *keys)
+{
+
+ return bdrv_co_pr_read_keys(bs->file->bs, generation, num_keys, keys);
+}
+
+static int coroutine_fn GRAPH_RDLOCK
+raw_co_pr_read_reservation(BlockDriverState *bs, uint32_t *generation,
+ uint64_t *key, BlockPrType *type)
+{
+ return bdrv_co_pr_read_reservation(bs->file->bs, generation, key, type);
+}
+
+static int coroutine_fn GRAPH_RDLOCK
+raw_co_pr_register(BlockDriverState *bs, uint64_t old_key,
+ uint64_t new_key, BlockPrType type,
+ bool ptpl, bool ignore_key)
+{
+ return bdrv_co_pr_register(bs->file->bs, old_key, new_key,
+ type, ptpl, ignore_key);
+}
+
+static int coroutine_fn GRAPH_RDLOCK
+raw_co_pr_reserve(BlockDriverState *bs, uint64_t key, BlockPrType type)
+{
+ return bdrv_co_pr_reserve(bs->file->bs, key, type);
+}
+
+static int coroutine_fn GRAPH_RDLOCK
+raw_co_pr_release(BlockDriverState *bs, uint64_t key, BlockPrType type)
+{
+ return bdrv_co_pr_release(bs->file->bs, key, type);
+}
+
+static int coroutine_fn GRAPH_RDLOCK
+raw_co_pr_clear(BlockDriverState *bs, uint64_t key)
+{
+ return bdrv_co_pr_clear(bs->file->bs, key);
+}
+
+static int coroutine_fn GRAPH_RDLOCK
+raw_co_pr_preempt(BlockDriverState *bs, uint64_t old_key,
+ uint64_t new_key, BlockPrType type, bool abort)
+{
+ return bdrv_co_pr_preempt(bs->file->bs, old_key, new_key, type, abort);
+}
+
static int GRAPH_RDLOCK raw_has_zero_init(BlockDriverState *bs)
{
return bdrv_has_zero_init(bs->file->bs);
@@ -672,6 +721,13 @@ BlockDriver bdrv_raw = {
.strong_runtime_opts = raw_strong_runtime_opts,
.mutable_opts = mutable_opts,
.bdrv_cancel_in_flight = raw_cancel_in_flight,
+ .bdrv_co_pr_read_keys = raw_co_pr_read_keys,
+ .bdrv_co_pr_read_reservation = raw_co_pr_read_reservation,
+ .bdrv_co_pr_register = raw_co_pr_register,
+ .bdrv_co_pr_reserve = raw_co_pr_reserve,
+ .bdrv_co_pr_release = raw_co_pr_release,
+ .bdrv_co_pr_clear = raw_co_pr_clear,
+ .bdrv_co_pr_preempt = raw_co_pr_preempt,
};
static void bdrv_raw_init(void)
--
2.20.1
- [PATCH v7 00/10] Support persistent reservation operations, Changqi Lu, 2024/07/05
- [PATCH v7 01/10] block: add persistent reservation in/out api, Changqi Lu, 2024/07/05
- [PATCH v7 02/10] block/raw: add persistent reservation in/out driver,
Changqi Lu <=
- [PATCH v7 03/10] scsi/constant: add persistent reservation in/out protocol constants, Changqi Lu, 2024/07/05
- [PATCH v7 04/10] scsi/util: add helper functions for persistent reservation types conversion, Changqi Lu, 2024/07/05
- [PATCH v7 05/10] hw/scsi: add persistent reservation in/out api for scsi device, Changqi Lu, 2024/07/05
- [PATCH v7 06/10] block/nvme: add reservation command protocol constants, Changqi Lu, 2024/07/05
- [PATCH v7 07/10] hw/nvme: add helper functions for converting reservation types, Changqi Lu, 2024/07/05
- [PATCH v7 09/10] hw/nvme: add reservation protocal command, Changqi Lu, 2024/07/05
- [PATCH v7 10/10] block/iscsi: add persistent reservation in/out driver, Changqi Lu, 2024/07/05