Commit 2f249ace authored by Xiaodong Liu's avatar Xiaodong Liu Committed by Jim Harris
Browse files

blobfs: add result for set_cache_size



Since g_fs_cache_size only takes effect when creating
g_cache_pool, so spdk_fs_set_cache_size is only
permitted when cache pool is already freed or hasn't
been initialized.
Add a return value to indicate the result
of spdk_fs_set_cache_size.

Change-Id: I3828b136976d6f03f0751b2f20f68cd47c36ec04
Signed-off-by: default avatarXiaodong Liu <xiaodong.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471869


Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent e9344991
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -12,6 +12,10 @@ optimization for aarch64.
`spdk_thread_send_msg` now returns int indicating if the message was successfully
sent.

### blobfs

Added boolean return value for function spdk_fs_set_cache_size to indicate its operation result.

## v19.10:

### rpc
+3 −1
Original line number Diff line number Diff line
@@ -364,8 +364,10 @@ int64_t spdk_file_read(struct spdk_file *file, struct spdk_fs_thread_ctx *ctx,
 * Set cache size for the blobstore filesystem.
 *
 * \param size_in_mb Cache size in megabytes.
 *
 * \return 0 on success, negative errno on failure.
 */
void spdk_fs_set_cache_size(uint64_t size_in_mb);
int spdk_fs_set_cache_size(uint64_t size_in_mb);

/**
 * Obtain the cache size.
+10 −1
Original line number Diff line number Diff line
@@ -1971,10 +1971,19 @@ spdk_fs_free_thread_ctx(struct spdk_fs_thread_ctx *ctx)
	free(ctx);
}

void
int
spdk_fs_set_cache_size(uint64_t size_in_mb)
{
	/* setting g_fs_cache_size is only permitted if cache pool
	 * is already freed or hasn't been initialized
	 */
	if (g_cache_pool != NULL) {
		return -EPERM;
	}

	g_fs_cache_size = size_in_mb * 1024 * 1024;

	return 0;
}

uint64_t