Commit 1f0b8df7 authored by yupeng's avatar yupeng Committed by Ben Walker
Browse files

blobstore: implement spdk_bs_grow and bdev_lvol_grow_lvstore RPC



The bdev_lvol_grow_lvstore will grow the lvstore size if the undering
bdev size is increased. It invokes spdk_bs_grow internally. The
spdk_bs_grow will extend the used_clusters bitmap. If there is no
enough space resereved for the used_clusters bitmap, the api will
fail. The reserved space was calculated according to the num_md_pages
at blobstore creating time.

Signed-off-by: default avatarPeng Yu <yupeng0921@gmail.com>
Change-Id: If6e8c0794dbe4eaa7042acf5031de58138ce7bca
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9730


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 88833020
Loading
Loading
Loading
Loading
+38 −0
Original line number Diff line number Diff line
@@ -8024,6 +8024,44 @@ Example response:
}
~~~

### bdev_lvol_grow_lvstore {#rpc_bdev_lvol_grow_lvstore}

Grow the logical volume store to fill the underlying bdev

#### Parameters

Name                    | Optional | Type        | Description
----------------------- | -------- | ----------- | -----------
uuid                    | Optional | string      | UUID of the logical volume store to grow
lvs_name                | Optional | string      | Name of the logical volume store to grow

Either uuid or lvs_name must be specified, but not both.

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "bdev_lvol_grow_lvstore",
  "id": 1
  "params": {
    "uuid": "a9959197-b5e2-4f2d-8095-251ffb6985a5"
  }
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_lvol_create {#rpc_bdev_lvol_create}

Create a logical volume on a logical volume store.
+11 −0
Original line number Diff line number Diff line
@@ -257,6 +257,17 @@ void spdk_bs_opts_init(struct spdk_bs_opts *opts, size_t opts_size);
void spdk_bs_load(struct spdk_bs_dev *dev, struct spdk_bs_opts *opts,
		  spdk_bs_op_with_handle_complete cb_fn, void *cb_arg);

/**
 * Grow a blobstore to fill the underlying device
 *
 * \param dev Blobstore block device.
 * \param opts The structure which contains the option values for the blobstore.
 * \param cb_fn Called when the loading is complete.
 * \param cb_arg Argument passed to function cb_fn.
 */
void spdk_bs_grow(struct spdk_bs_dev *dev, struct spdk_bs_opts *opts,
		  spdk_bs_op_with_handle_complete cb_fn, void *cb_arg);

/**
 * Initialize a blobstore on the given device.
 *
+10 −0
Original line number Diff line number Diff line
@@ -239,6 +239,16 @@ struct spdk_io_channel *spdk_lvol_get_io_channel(struct spdk_lvol *lvol);
void spdk_lvs_load(struct spdk_bs_dev *bs_dev, spdk_lvs_op_with_handle_complete cb_fn,
		   void *cb_arg);

/**
 * Grow a lvstore to fill the underlying device
 *
 * \param bs_dev Pointer to the blobstore device.
 * \param cb_fn Completion callback.
 * \param cb_arg Completion callback custom arguments.
 */
void spdk_lvs_grow(struct spdk_bs_dev *bs_dev, spdk_lvs_op_with_handle_complete cb_fn,
		   void *cb_arg);

/**
 * Open a lvol.
 *
+9 −0
Original line number Diff line number Diff line
@@ -25,6 +25,15 @@ struct spdk_lvs_req {
	int				lvserrno;
};

struct spdk_lvs_grow_req {
	spdk_lvs_op_complete	cb_fn;
	void			*cb_arg;
	struct spdk_lvol_store	*lvol_store;
	struct lvol_store_bdev	*lvs_bdev;
	int			lvserrno;
	int			lvol_cnt;
};

struct spdk_lvol_req {
	spdk_lvol_op_complete   cb_fn;
	void                    *cb_arg;
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk

SO_VER := 7
SO_VER := 8
SO_MINOR := 0

C_SRCS = blobstore.c request.c zeroes.c blob_bs_dev.c
Loading