[sheepdog] [PATCH] sheep: add operation to get cluster default setting
Hitoshi Mitake
mitake.hitoshi at lab.ntt.co.jp
Tue Jan 13 03:33:37 CET 2015
At Fri, 9 Jan 2015 20:12:06 +0900,
Teruaki Ishizaki wrote:
>
> Qemu backend driver for sheepdog used a hard-coded value
> 'SD_DATA_OBJ_SIZE' when you created VDI with "qemu-img"
> command.
>
> Then, this patch add operation "SD_OP_GET_CLUSTER_DEFAULT"
> to get a cluster default value of block_size_shift
> for creating a VDI.
>
> Signed-off-by: Teruaki Ishizaki <ishizaki.teruaki at lab.ntt.co.jp>
> ---
> include/sheepdog_proto.h | 8 ++++++++
> sheep/ops.c | 18 ++++++++++++++++++
> 2 files changed, 26 insertions(+), 0 deletions(-)
Applied, thanks.
Hitoshi
>
> diff --git a/include/sheepdog_proto.h b/include/sheepdog_proto.h
> index 5f6d157..9495742 100644
> --- a/include/sheepdog_proto.h
> +++ b/include/sheepdog_proto.h
> @@ -45,6 +45,7 @@
> #define SD_OP_READ_VDIS 0x15
> #define SD_OP_FLUSH_VDI 0x16
> #define SD_OP_DEL_VDI 0x17
> +#define SD_OP_GET_CLUSTER_DEFAULT 0x18
>
> /* macros in the SD_FLAG_CMD_XXX group are mutually exclusive */
> #define SD_FLAG_CMD_WRITE 0x01
> @@ -249,6 +250,13 @@ struct sd_rsp {
> uint32_t __pad2;
> uint8_t digest[20];
> } hash;
> + struct {
> + uint32_t __pad1;
> + uint8_t nr_copies;
> + uint8_t copy_policy;
> + uint8_t block_size_shift;
> + uint8_t __pad2;
> + } cluster_default;
>
> uint32_t __pad[8];
> };
> diff --git a/sheep/ops.c b/sheep/ops.c
> index 5d71dde..809854a 100644
> --- a/sheep/ops.c
> +++ b/sheep/ops.c
> @@ -1430,6 +1430,17 @@ static int local_vdi_state_snapshot_ctl(const struct sd_req *req,
> return SD_RES_SUCCESS;
> }
>
> +static int local_get_cluster_default(const struct sd_req *req,
> + struct sd_rsp *rsp,
> + void *data, const struct sd_node *sender)
> +{
> + rsp->cluster_default.nr_copies = sys->cinfo.nr_copies;
> + rsp->cluster_default.copy_policy = sys->cinfo.copy_policy;
> + rsp->cluster_default.block_size_shift = sys->cinfo.block_size_shift;
> +
> + return SD_RES_SUCCESS;
> +}
> +
> static int cluster_inode_coherence(const struct sd_req *req,
> struct sd_rsp *rsp, void *data,
> const struct sd_node *sender)
> @@ -1852,6 +1863,13 @@ static struct sd_op_template sd_ops[] = {
> .process_main = local_vdi_state_snapshot_ctl,
> },
>
> + [SD_OP_GET_CLUSTER_DEFAULT] = {
> + .name = "GET_CLUSTER_DEFAULT",
> + .type = SD_OP_TYPE_LOCAL,
> + .force = true,
> + .process_main = local_get_cluster_default,
> + },
> +
> /* gateway I/O operations */
> [SD_OP_CREATE_AND_WRITE_OBJ] = {
> .name = "CREATE_AND_WRITE_OBJ",
> --
> 1.7.1
>
> --
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> https://lists.wpkg.org/mailman/listinfo/sheepdog
More information about the sheepdog
mailing list