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: Xiaodong Liu <xiaodong.liu@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471869 Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
e93449910a
commit
2f249ace0c
@ -12,6 +12,10 @@ optimization for aarch64.
|
|||||||
`spdk_thread_send_msg` now returns int indicating if the message was successfully
|
`spdk_thread_send_msg` now returns int indicating if the message was successfully
|
||||||
sent.
|
sent.
|
||||||
|
|
||||||
|
### blobfs
|
||||||
|
|
||||||
|
Added boolean return value for function spdk_fs_set_cache_size to indicate its operation result.
|
||||||
|
|
||||||
## v19.10:
|
## v19.10:
|
||||||
|
|
||||||
### rpc
|
### rpc
|
||||||
|
@ -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.
|
* Set cache size for the blobstore filesystem.
|
||||||
*
|
*
|
||||||
* \param size_in_mb Cache size in megabytes.
|
* \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.
|
* Obtain the cache size.
|
||||||
|
@ -1971,10 +1971,19 @@ spdk_fs_free_thread_ctx(struct spdk_fs_thread_ctx *ctx)
|
|||||||
free(ctx);
|
free(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
int
|
||||||
spdk_fs_set_cache_size(uint64_t size_in_mb)
|
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;
|
g_fs_cache_size = size_in_mb * 1024 * 1024;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
|
Loading…
Reference in New Issue
Block a user