Commit ad5fc351 authored by Tomasz Zawadzki's avatar Tomasz Zawadzki
Browse files

bdev/lvol: use spdk_bs_grow_live() in grow lvs RPC



This patch adds spdk_lvs_grow_live() pipes through to
spdk_bs_grow_live() and use it when
bdev_lvol_grow_lvstore RPC is called.

Growing the size of lvs still needs to be explicit
RPC call by the user.

Moved include for blob_bdev.h to header of the whole
bdev module. This way spdk_bdev_update_bs_blockcnt()
can be called when RPC is called.

Please note that there already exists a test with this
RPC - blobstore_grow.sh. Next patch in series
adds test calling grow while I/O is being performed.

Signed-off-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I9e896c65a8b017d0d20b77d3758901e588e9e70c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/20322


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
parent 1fb5e31f
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -337,7 +337,8 @@ void spdk_lvs_load_ext(struct spdk_bs_dev *bs_dev, const struct spdk_lvs_opts *l
		       spdk_lvs_op_with_handle_complete cb_fn, void *cb_arg);

/**
 * Grow a lvstore to fill the underlying device
 * Grow a lvstore to fill the underlying device.
 * Cannot be used on loaded lvstore.
 *
 * \param bs_dev Pointer to the blobstore device.
 * \param cb_fn Completion callback.
@@ -346,6 +347,15 @@ void spdk_lvs_load_ext(struct spdk_bs_dev *bs_dev, const struct spdk_lvs_opts *l
void spdk_lvs_grow(struct spdk_bs_dev *bs_dev, spdk_lvs_op_with_handle_complete cb_fn,
		   void *cb_arg);

/**
 * Grow a loaded lvstore to fill the underlying device.
 *
 * \param lvs Pointer to lvolstore.
 * \param cb_fn Completion callback.
 * \param cb_arg Completion callback custom arguments.
 */
void spdk_lvs_grow_live(struct spdk_lvol_store *lvs, spdk_lvs_op_complete cb_fn, void *cb_arg);

/**
 * Open a lvol.
 *
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk

SO_VER := 9
SO_MINOR := 0
SO_MINOR := 1

C_SRCS = lvol.c
LIBNAME = lvol
+33 −0
Original line number Diff line number Diff line
@@ -1734,6 +1734,39 @@ spdk_lvol_decouple_parent(struct spdk_lvol *lvol, spdk_lvol_op_complete cb_fn, v
				     lvol_inflate_cb, req);
}

static void
lvs_grow_live_cb(void *cb_arg, int lvolerrno)
{
	struct spdk_lvs_req *req = (struct spdk_lvs_req *)cb_arg;

	if (req->cb_fn) {
		req->cb_fn(req->cb_arg, lvolerrno);
	}
	free(req);
	return;
}

void
spdk_lvs_grow_live(struct spdk_lvol_store *lvs, spdk_lvs_op_complete cb_fn, void *cb_arg)
{
	struct spdk_lvs_req *req;

	req = calloc(1, sizeof(*req));
	if (req == NULL) {
		SPDK_ERRLOG("Cannot alloc memory for request structure\n");
		if (cb_fn) {
			cb_fn(cb_arg, -ENOMEM);
		}
		return;
	}

	req->cb_fn = cb_fn;
	req->cb_arg = cb_arg;
	req->lvol_store = lvs;

	spdk_bs_grow_live(lvs->blobstore, lvs_grow_live_cb, req);
}

void
spdk_lvs_grow(struct spdk_bs_dev *bs_dev, spdk_lvs_op_with_handle_complete cb_fn, void *cb_arg)
{
+1 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@
	spdk_lvs_unload;
	spdk_lvs_destroy;
	spdk_lvs_grow;
	spdk_lvs_grow_live;
	spdk_lvol_create;
	spdk_lvol_create_snapshot;
	spdk_lvol_create_clone;
+0 −1
Original line number Diff line number Diff line
@@ -4,7 +4,6 @@
 *   Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 */

#include "spdk/blob_bdev.h"
#include "spdk/rpc.h"
#include "spdk/bdev_module.h"
#include "spdk/log.h"
Loading