[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 02/11] block/raw: add persistent reservation in/out driver
From: |
Changqi Lu |
Subject: |
[PATCH v2 02/11] block/raw: add persistent reservation in/out driver |
Date: |
Mon, 13 May 2024 11:52:21 +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.
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Changqi Lu <luchangqi.123@bytedance.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
---
block/raw-format.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/block/raw-format.c b/block/raw-format.c
index ac7e8495f6..7ba5b12101 100644
--- a/block/raw-format.c
+++ b/block/raw-format.c
@@ -454,6 +454,54 @@ 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 ignore_key)
+{
+ return bdrv_co_pr_register(bs->file->bs, old_key, new_key,
+ type, 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 +720,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 v2 00/11] Support persistent reservation operations, Changqi Lu, 2024/05/12
- [PATCH v2 02/11] block/raw: add persistent reservation in/out driver,
Changqi Lu <=
- [PATCH v2 01/11] block: add persistent reservation in/out api, Changqi Lu, 2024/05/12
- [PATCH v2 04/11] scsi/util: add helper functions for persistent reservation types conversion, Changqi Lu, 2024/05/12
- [PATCH v2 03/11] scsi/constant: add persistent reservation in/out protocol constants, Changqi Lu, 2024/05/12
- [PATCH v2 05/11] hw/scsi: add persistent reservation in/out api for scsi device, Changqi Lu, 2024/05/12
- [PATCH v2 06/11] block/nvme: add reservation command protocol constants, Changqi Lu, 2024/05/12
- [PATCH v2 07/11] hw/nvme: add helper functions for converting reservation types, Changqi Lu, 2024/05/12
- [PATCH v2 08/11] hw/nvme: enable ONCS reservations, Changqi Lu, 2024/05/12
- [PATCH v2 09/11] hw/nvme: enable namespace rescap function, Changqi Lu, 2024/05/12
- [PATCH v2 10/11] hw/nvme: add reservation protocal command, Changqi Lu, 2024/05/12
- [PATCH v2 11/11] block/iscsi: add persistent reservation in/out driver, Changqi Lu, 2024/05/12