lvol: show total accessible clusters in lvol store

Show total accessible clusters when listing lvol stores
instead of total blocks. This is more readable for user.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I22a14f626816769cf2f494ae30cfd8ee63897771
Reviewed-on: https://review.gerrithub.io/385634
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Maciej Szwed 2017-11-03 14:09:40 +01:00 committed by Jim Harris
parent 5eb52b951c
commit 0c06e1ea89
3 changed files with 5 additions and 9 deletions

View File

@ -83,7 +83,6 @@ struct spdk_lvol_store {
spdk_blob_id super_blob_id;
uuid_t uuid;
struct spdk_lvs_req *destruct_req;
uint64_t total_blocks;
int lvol_count;
int lvols_opened;
bool destruct;

View File

@ -441,7 +441,7 @@ spdk_rpc_get_lvol_stores(struct spdk_jsonrpc_request *request,
struct spdk_json_write_ctx *w;
struct lvol_store_bdev *lvs_bdev;
struct spdk_blob_store *bs;
uint64_t free_blocks, cluster_size, block_size;
uint64_t cluster_size, block_size;
char uuid[UUID_STRING_LEN];
if (params != NULL) {
@ -464,7 +464,6 @@ spdk_rpc_get_lvol_stores(struct spdk_jsonrpc_request *request,
cluster_size = spdk_bs_get_cluster_size(bs);
/* Block size of lvols is always size of blob store page */
block_size = spdk_bs_get_page_size(bs);
free_blocks = (cluster_size * spdk_bs_free_cluster_count(bs)) / block_size;
spdk_json_write_object_begin(w);
@ -478,11 +477,11 @@ spdk_rpc_get_lvol_stores(struct spdk_jsonrpc_request *request,
spdk_json_write_name(w, "base_bdev");
spdk_json_write_string(w, spdk_bdev_get_name(lvs_bdev->bdev));
spdk_json_write_name(w, "total_blocks");
spdk_json_write_uint64(w, lvs_bdev->lvs->total_blocks);
spdk_json_write_name(w, "total_data_clusters");
spdk_json_write_uint64(w, spdk_bs_total_data_cluster_count(bs));
spdk_json_write_name(w, "free_blocks");
spdk_json_write_uint64(w, free_blocks);
spdk_json_write_name(w, "free_clusters");
spdk_json_write_uint64(w, spdk_bs_free_cluster_count(bs));
spdk_json_write_name(w, "block_size");
spdk_json_write_uint64(w, block_size);

View File

@ -511,8 +511,6 @@ _spdk_lvs_init_cb(void *cb_arg, struct spdk_blob_store *bs, int lvserrno)
assert(bs != NULL);
lvs->blobstore = bs;
TAILQ_INIT(&lvs->lvols);
lvs->total_blocks = (spdk_bs_get_cluster_size(bs) * spdk_bs_free_cluster_count(
bs)) / spdk_bs_get_page_size(bs);
SPDK_INFOLOG(SPDK_TRACE_LVOL, "Lvol store initialized\n");