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

lib/blob: allow growing in size in increments less than cluster size



By omission the blobstore could only be grown in increments
of cluster size. For smaller values the grow would fail,
yet that value would still be updated on bs reload.
No change in cluster count would still happen.

It was unnecessary to wait, so now it goes through whole
grow path. In practice only the super block value for device
size changes.

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


Community-CI: Mellanox Build Bot
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
parent fb42211e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -8850,6 +8850,7 @@ bs_grow_live_load_super_cpl(spdk_bs_sequence_t *seq, void *cb_arg, int bserrno)
				spdk_divide_round_up(total_clusters, 8),
				SPDK_BS_PAGE_SIZE);
	max_used_cluster_mask = ctx->super->used_blobid_mask_start - ctx->super->used_cluster_mask_start;
	/* Only checking dev_size. Since it can change, but total_clusters remain the same. */
	if (ctx->super->size == dev_size) {
		SPDK_DEBUGLOG(blob, "No need to grow blobstore\n");
		bs_grow_live_done(ctx, 0);
@@ -8862,7 +8863,7 @@ bs_grow_live_load_super_cpl(spdk_bs_sequence_t *seq, void *cb_arg, int bserrno)
	 * - there is enough space for used_cluster_mask to be written out
	 */
	if (ctx->super->size > dev_size ||
	    total_clusters <= spdk_bit_pool_capacity(ctx->bs->used_clusters) ||
	    total_clusters < spdk_bit_pool_capacity(ctx->bs->used_clusters) ||
	    used_cluster_mask_len > max_used_cluster_mask) {
		SPDK_DEBUGLOG(blob, "No space to grow blobstore\n");
		bs_grow_live_done(ctx, -ENOSPC);
+3 −0
Original line number Diff line number Diff line
@@ -3007,6 +3007,9 @@ bs_grow_live(void)
	/* No change expected */
	bs_grow_live_size(DEV_BUFFER_BLOCKCNT);

	/* Size slightly increased, but not enough to increase cluster count */
	bs_grow_live_size(DEV_BUFFER_BLOCKCNT + 1);

	/* Size doubled, increasing the cluster count */
	bs_grow_live_size(DEV_BUFFER_BLOCKCNT * 2);
}