Commit 11f129ee authored by Yankun Li's avatar Yankun Li Committed by Konrad Sztyber
Browse files

reduce: Get the information of compress vol



Add public API spdk_reduce_vol_get_info to get information,
Add new spdk_reduce_vol_info structure, Currently it contains
only one attribute allocated_io_units.

allocated_io_units track the allocated_backing_io_units array,
collects statistics on allocated I/O units.

Change-Id: Id59d0e73263c52cf5118d86e1f0ed620efa63361
Signed-off-by: default avatarYankun Li <yankun@staff.sina.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/25207


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Community-CI: Community CI Samsung <spdk.community.ci.samsung@gmail.com>
Reviewed-by: default avatarChangpeng Liu <changpeliu@tencent.com>
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: default avatarGangCao <gang.cao@intel.com>
parent 6249f303
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -21,6 +21,10 @@ If multipathing shall be enabled for nvme bdev, `bdev_opts.multipath` shall be s
Added public API `spdk_nvmf_send_discovery_log_notice` to send discovery log page
change notice to client.

### reduce

Add `spdk_reduce_vol_get_info()` to get the information for the compressed volume.

## v24.09

### accel
+17 −0
Original line number Diff line number Diff line
@@ -19,6 +19,15 @@ extern "C" {

#define REDUCE_MAX_IOVECS	33

/**
 * Describes the information of spdk_reduce_vol.
 */
struct spdk_reduce_vol_info {
	/* Statistics on the number of allocated io units */
	uint64_t		allocated_io_units;
	/* TODO: Migrate other vol properties to this structure */
};

/**
 * Describes the parameters of an spdk_reduce_vol.
 */
@@ -278,6 +287,14 @@ void spdk_reduce_vol_print_info(struct spdk_reduce_vol *vol);
 */
const char *spdk_reduce_vol_get_pm_path(const struct spdk_reduce_vol *vol);

/**
 * Get the information for a libreduce compressed volume.
 *
 * \param vol Previously loaded or initialized compressed volume.
 * \return spdk_reduce_vol_info structure for the compressed volume.
 */
const struct spdk_reduce_vol_info *spdk_reduce_vol_get_info(const struct spdk_reduce_vol *vol);

#ifdef __cplusplus
}
#endif
+11 −0
Original line number Diff line number Diff line
@@ -120,6 +120,7 @@ struct spdk_reduce_vol_request {

struct spdk_reduce_vol {
	struct spdk_reduce_vol_params		params;
	struct spdk_reduce_vol_info		info;
	uint32_t				backing_io_units_per_chunk;
	uint32_t				backing_lba_per_io_unit;
	uint32_t				logical_blocks_per_chunk;
@@ -463,6 +464,12 @@ _allocate_vol_requests(struct spdk_reduce_vol *vol)
	return rc;
}

const struct spdk_reduce_vol_info *
spdk_reduce_vol_get_info(const struct spdk_reduce_vol *vol)
{
	return &vol->info;
}

static void
_init_load_cleanup(struct spdk_reduce_vol *vol, struct reduce_init_load_ctx *ctx)
{
@@ -597,6 +604,7 @@ _allocate_bit_arrays(struct spdk_reduce_vol *vol)
				vol->params.backing_io_unit_size;
	for (i = 0; i < num_metadata_io_units; i++) {
		spdk_bit_array_set(vol->allocated_backing_io_units, i);
		vol->info.allocated_io_units++;
	}

	return 0;
@@ -881,6 +889,7 @@ _load_read_super_and_path_cpl(void *cb_arg, int reduce_errno)
		for (j = 0; j < vol->backing_io_units_per_chunk; j++) {
			if (chunk->io_unit_index[j] != REDUCE_EMPTY_MAP_ENTRY) {
				spdk_bit_array_set(vol->allocated_backing_io_units, chunk->io_unit_index[j]);
				vol->info.allocated_io_units++;
			}
		}
	}
@@ -1166,6 +1175,7 @@ _reduce_vol_reset_chunk(struct spdk_reduce_vol *vol, uint64_t chunk_map_index)
		assert(spdk_bit_array_get(vol->allocated_backing_io_units,
					  index) == true);
		spdk_bit_array_clear(vol->allocated_backing_io_units, index);
		vol->info.allocated_io_units--;
		success = queue_enqueue(&vol->free_backing_blocks_queue, index);
		if (!success && index < vol->find_block_offset) {
			vol->find_block_offset = index;
@@ -1431,6 +1441,7 @@ _reduce_vol_write_chunk(struct spdk_reduce_vol_request *req, reduce_request_fn n
		 */
		assert(req->chunk->io_unit_index[i] != UINT32_MAX);
		spdk_bit_array_set(vol->allocated_backing_io_units, req->chunk->io_unit_index[i]);
		vol->info.allocated_io_units++;
	}

	_issue_backing_ops(req, vol, next_fn, true /* write */);
+1 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
	spdk_reduce_vol_get_params;
	spdk_reduce_vol_print_info;
	spdk_reduce_vol_get_pm_path;
	spdk_reduce_vol_get_info;

	local: *;
};