lvol: use uint64_t to represent lvol sizes
Replace the few existing uses of size_t as lvol size with uint64_t for consistency. size_t is meant to represent the size of an object in memory, and it may be smaller than uint64_t (e.g. on 32-bit platforms). Change-Id: Ifed8959625e18be67e98070f7fea1f2a09e4e791 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-on: https://review.gerrithub.io/407008 Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Maciej Szwed <maciej.szwed@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
e548df4ed1
commit
3b62b84f41
@ -852,7 +852,7 @@ end:
|
||||
}
|
||||
|
||||
int
|
||||
vbdev_lvol_create(struct spdk_lvol_store *lvs, const char *name, size_t sz,
|
||||
vbdev_lvol_create(struct spdk_lvol_store *lvs, const char *name, uint64_t sz,
|
||||
bool thin_provision, spdk_lvol_op_with_handle_complete cb_fn, void *cb_arg)
|
||||
{
|
||||
struct spdk_lvol_with_handle_req *req;
|
||||
@ -976,7 +976,7 @@ finish:
|
||||
}
|
||||
|
||||
void
|
||||
vbdev_lvol_resize(struct spdk_lvol *lvol, size_t sz, spdk_lvol_op_complete cb_fn, void *cb_arg)
|
||||
vbdev_lvol_resize(struct spdk_lvol *lvol, uint64_t sz, spdk_lvol_op_complete cb_fn, void *cb_arg)
|
||||
{
|
||||
struct spdk_lvol_req *req;
|
||||
|
||||
|
@ -52,7 +52,7 @@ int vbdev_lvs_create(struct spdk_bdev *base_bdev, const char *name, uint32_t clu
|
||||
void vbdev_lvs_destruct(struct spdk_lvol_store *lvs, spdk_lvs_op_complete cb_fn, void *cb_arg);
|
||||
void vbdev_lvs_unload(struct spdk_lvol_store *lvs, spdk_lvs_op_complete cb_fn, void *cb_arg);
|
||||
|
||||
int vbdev_lvol_create(struct spdk_lvol_store *lvs, const char *name, size_t sz,
|
||||
int vbdev_lvol_create(struct spdk_lvol_store *lvs, const char *name, uint64_t sz,
|
||||
bool thin_provisioned, spdk_lvol_op_with_handle_complete cb_fn, void *cb_arg);
|
||||
|
||||
void vbdev_lvol_create_snapshot(struct spdk_lvol *lvol, const char *snapshot_name,
|
||||
@ -69,7 +69,7 @@ void vbdev_lvol_create_clone(struct spdk_lvol *lvol, const char *clone_name,
|
||||
* \param cb_arg Completion callback custom arguments
|
||||
* \return error
|
||||
*/
|
||||
void vbdev_lvol_resize(struct spdk_lvol *lvol, size_t sz, spdk_lvol_op_complete cb_fn,
|
||||
void vbdev_lvol_resize(struct spdk_lvol *lvol, uint64_t sz, spdk_lvol_op_complete cb_fn,
|
||||
void *cb_arg);
|
||||
|
||||
void vbdev_lvol_rename(struct spdk_lvol *lvol, const char *new_lvol_name,
|
||||
|
@ -374,7 +374,6 @@ spdk_rpc_construct_lvol_bdev(struct spdk_jsonrpc_request *request,
|
||||
const struct spdk_json_val *params)
|
||||
{
|
||||
struct rpc_construct_lvol_bdev req = {};
|
||||
size_t sz;
|
||||
int rc;
|
||||
struct spdk_lvol_store *lvs = NULL;
|
||||
|
||||
@ -399,9 +398,7 @@ spdk_rpc_construct_lvol_bdev(struct spdk_jsonrpc_request *request,
|
||||
goto invalid;
|
||||
}
|
||||
|
||||
sz = (size_t)req.size;
|
||||
|
||||
rc = vbdev_lvol_create(lvs, req.lvol_name, sz, req.thin_provision,
|
||||
rc = vbdev_lvol_create(lvs, req.lvol_name, req.size, req.thin_provision,
|
||||
_spdk_rpc_construct_lvol_bdev_cb, request);
|
||||
if (rc < 0) {
|
||||
goto invalid;
|
||||
|
@ -48,8 +48,8 @@ SPDK_LOG_REGISTER_COMPONENT("lvol", SPDK_LOG_LVOL)
|
||||
static TAILQ_HEAD(, spdk_lvol_store) g_lvol_stores = TAILQ_HEAD_INITIALIZER(g_lvol_stores);
|
||||
static pthread_mutex_t g_lvol_stores_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
static inline size_t
|
||||
divide_round_up(size_t num, size_t divisor)
|
||||
static inline uint64_t
|
||||
divide_round_up(uint64_t num, uint64_t divisor)
|
||||
{
|
||||
return (num + divisor - 1) / divisor;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user