Commit d6427151 authored by Daniel Verkamp's avatar Daniel Verkamp Committed by Jim Harris
Browse files

lvol: remove vbdev APIs from public lvol.h API



The vbdev_* functions that were declared in lvol.h are all internal to
the lvol vbdev implementation; they don't need to be in the public
header.

vbdev_get_lvs_bdev_by_lvs() is moved to the top of the file so it
doesn't need a forward declaration (no code change).

Change-Id: I98282d3cb0008da5c5b5059eee335219dc929f1c
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/389894


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent c6d32d39
Loading
Loading
Loading
Loading
+0 −28
Original line number Diff line number Diff line
@@ -168,36 +168,8 @@ void spdk_lvol_close(struct spdk_lvol *lvol, spdk_lvol_op_complete cb_fn, void *
 * \param lvol Handle to lvol
 * \return IO channel
 */

struct spdk_io_channel *spdk_lvol_get_io_channel(struct spdk_lvol *lvol);

/**
 * \brief Search for handle to lvolstore bdev
 * \param lvs_orig Handle to spdk_lvol_store
 * \return Handle to lvol_store_bdev or NULL if not found.
 */
struct lvol_store_bdev *vbdev_get_lvs_bdev_by_lvs(struct spdk_lvol_store *lvs_orig);

/**
 * \brief Search for handle to lvol
 * \param name Name of bdev
 * \return Handle to spdk_lvol or NULL if not found.
 */
struct spdk_lvol *vbdev_get_lvol_by_name(const char *name);

/**
 * \brief Search for handle lvolstore
 * \param uuid_str UUID of lvolstore
 * \return Handle to spdk_lvol_store or NULL if not found.
 */
struct spdk_lvol_store *vbdev_get_lvol_store_by_uuid(const char *uuid_str);

/**
 * \brief Search for handle to lvolstore
 * \param name name of lvolstore
 * \return Handle to spdk_lvol_store or NULL if not found.
 */
struct spdk_lvol_store *vbdev_get_lvol_store_by_name(const char *name);
void spdk_lvs_load(struct spdk_bs_dev *bs_dev, spdk_lvs_op_with_handle_complete cb_fn,
		   void *cb_arg);
void spdk_lvol_open(struct spdk_lvol *lvol, spdk_lvol_op_with_handle_complete cb_fn, void *cb_arg);
+22 −22
Original line number Diff line number Diff line
@@ -44,6 +44,27 @@ SPDK_DECLARE_BDEV_MODULE(lvol);
static TAILQ_HEAD(, lvol_store_bdev) g_spdk_lvol_pairs = TAILQ_HEAD_INITIALIZER(
			g_spdk_lvol_pairs);

static struct lvol_store_bdev *
vbdev_get_lvs_bdev_by_lvs(struct spdk_lvol_store *lvs_orig)
{
	struct spdk_lvol_store *lvs = NULL;
	struct lvol_store_bdev *lvs_bdev = vbdev_lvol_store_first();

	while (lvs_bdev != NULL) {
		lvs = lvs_bdev->lvs;
		if (lvs == lvs_orig) {
			if (lvs_bdev->req != NULL) {
				/* We do not allow access to lvs that are being destroyed */
				return NULL;
			} else {
				return lvs_bdev;
			}
		}
		lvs_bdev = vbdev_lvol_store_next(lvs_bdev);
	}
	return NULL;
}

static void
vbdev_lvs_hotremove_cb(void *ctx)
{
@@ -325,28 +346,7 @@ vbdev_get_lvol_store_by_name(const char *name)
	return NULL;
}

struct lvol_store_bdev *
vbdev_get_lvs_bdev_by_lvs(struct spdk_lvol_store *lvs_orig)
{
	struct spdk_lvol_store *lvs = NULL;
	struct lvol_store_bdev *lvs_bdev = vbdev_lvol_store_first();

	while (lvs_bdev != NULL) {
		lvs = lvs_bdev->lvs;
		if (lvs == lvs_orig) {
			if (lvs_bdev->req != NULL) {
				/* We do not allow access to lvs that are being destroyed */
				return NULL;
			} else {
				return lvs_bdev;
			}
		}
		lvs_bdev = vbdev_lvol_store_next(lvs_bdev);
	}
	return NULL;
}

struct spdk_lvol *
static struct spdk_lvol *
vbdev_get_lvol_by_name(const char *name)
{
	struct spdk_lvol *lvol, *tmp_lvol;
+15 −0
Original line number Diff line number Diff line
@@ -57,4 +57,19 @@ int vbdev_lvol_create(struct spdk_lvol_store *lvs, const char *name, size_t sz,
		      void *cb_arg);

int vbdev_lvol_resize(char *name, size_t sz, spdk_lvol_op_complete cb_fn, void *cb_arg);

/**
 * \brief Search for handle lvolstore
 * \param uuid_str UUID of lvolstore
 * \return Handle to spdk_lvol_store or NULL if not found.
 */
struct spdk_lvol_store *vbdev_get_lvol_store_by_uuid(const char *uuid_str);

/**
 * \brief Search for handle to lvolstore
 * \param name name of lvolstore
 * \return Handle to spdk_lvol_store or NULL if not found.
 */
struct spdk_lvol_store *vbdev_get_lvol_store_by_name(const char *name);

#endif /* SPDK_VBDEV_LVOL_H */