diff --git a/doc/jsonrpc.md b/doc/jsonrpc.md index 5f67f7e61..668d10f66 100644 --- a/doc/jsonrpc.md +++ b/doc/jsonrpc.md @@ -496,6 +496,8 @@ Example response: "bdev_lvol_rename_lvstore", "bdev_lvol_create_lvstore", "bdev_lvol_shallow_copy", + "bdev_lvol_set_xattr", + "bdev_lvol_get_xattr", "bdev_lvol_get_fragmap", "bdev_daos_delete", "bdev_daos_create", @@ -10016,6 +10018,29 @@ Name | Optional | Type | Description src_lvol_name | Required | string | UUID or alias of lvol to create a copy from dst_bdev_name | Required | string | Name of the bdev that acts as destination for the copy +### bdev_lvol_set_xattr {#rpc_bdev_lvol_set_xattr} + +Set xattr for lvol bdev +#### Parameters + +Name | Optional | Type | Description +----------------------- | -------- | ----------- | ----------- +name | Required | string | UUID or alias of lvol +xattr_name | Required | string | Name of the xattr +xattr_value | Required | string | Value of the xattr + +### bdev_lvol_get_xattr {#rpc_bdev_lvol_get_xattr} + +Get xattr for lvol bdev +#### Parameters + +Name | Optional | Type | Description +----------------------- | -------- | ----------- | ----------- +name | Required | string | UUID or alias of lvol +xattr_name | Required | string | Name of the xattr + + + #### Example Example request: diff --git a/doc/lvol.md b/doc/lvol.md index fed70cb0f..bfcbf730a 100644 --- a/doc/lvol.md +++ b/doc/lvol.md @@ -197,4 +197,12 @@ bdev_lvol_decouple_parent [-h] name Decouple parent of a logical volume optional arguments: -h, --help show help +bdev_lvol_set_xattr [-h] name xattr_name xattr_value + Set xattr for lvol bdev + optional arguments: + -h, --help show help +bdev_lvol_get_xattr [-h] name xattr_name + Get xattr for lvol bdev + optional arguments: + -h, --help show help ``` diff --git a/include/spdk/bdev_module.h b/include/spdk/bdev_module.h index e37b1e228..ec84279d1 100644 --- a/include/spdk/bdev_module.h +++ b/include/spdk/bdev_module.h @@ -515,7 +515,7 @@ struct spdk_bdev { /** * Creation time for this bdev. - * + * * If not provided, it will be NULL. */ const char *creation_time; diff --git a/include/spdk/lvol.h b/include/spdk/lvol.h index 22cf07511..a4659b647 100644 --- a/include/spdk/lvol.h +++ b/include/spdk/lvol.h @@ -119,7 +119,7 @@ typedef void (*spdk_lvol_op_complete)(void *cb_arg, int lvolerrno); /** * Callback definition for lvol operations with handle to fragmap - * + * * @param cb_arg Custom arguments * @param fragmap Handle to fragmap or NULL when lvolerrno is set * @param lvolerrno Error diff --git a/include/spdk/util.h b/include/spdk/util.h index cf6965897..d971cb4a3 100644 --- a/include/spdk/util.h +++ b/include/spdk/util.h @@ -324,14 +324,15 @@ spdk_is_divisible_by(uint64_t dividend, uint64_t divisor) /* * Get the UTC time string in RFC3339 format. - * + * * \param buf Buffer to store the UTC time string. * \param buf_size Size of the buffer. - * + * * \return void */ static inline void -spdk_current_utc_time_rfc3339(char *buf, size_t buf_size) { +spdk_current_utc_time_rfc3339(char *buf, size_t buf_size) +{ struct tm *utc; time_t rawtime; diff --git a/include/spdk_internal/lvolstore.h b/include/spdk_internal/lvolstore.h index ec0e0871d..9ddfa5e8c 100644 --- a/include/spdk_internal/lvolstore.h +++ b/include/spdk_internal/lvolstore.h @@ -109,7 +109,7 @@ struct spdk_lvol { char name[SPDK_LVOL_NAME_MAX]; struct spdk_uuid uuid; char uuid_str[SPDK_UUID_STRING_LEN]; - char creation_time[SPDK_CREATION_TIME_MAX]; + char creation_time[SPDK_CREATION_TIME_MAX]; struct spdk_bdev *bdev; int ref_count; bool action_in_progress; diff --git a/lib/util/bit_array.c b/lib/util/bit_array.c index 25de4f0b7..fee5d27f5 100644 --- a/lib/util/bit_array.c +++ b/lib/util/bit_array.c @@ -516,7 +516,9 @@ spdk_bit_array_to_base64_string(const struct spdk_bit_array *array) for (uint32_t i = 0; i < bit_count; i++) { if (spdk_bit_array_get(array, i)) { - // Set the bit in bytes's correct position + /* + * Set the bit in bytes's correct position + */ ((uint8_t *)bytes)[i / 8] |= 1 << (i % 8); } } @@ -537,4 +539,4 @@ spdk_bit_array_to_base64_string(const struct spdk_bit_array *array) free(bytes); return encoded; -} \ No newline at end of file +} diff --git a/module/bdev/lvol/vbdev_lvol.c b/module/bdev/lvol/vbdev_lvol.c index 2273f82d4..c38a46f5b 100644 --- a/module/bdev/lvol/vbdev_lvol.c +++ b/module/bdev/lvol/vbdev_lvol.c @@ -2218,7 +2218,9 @@ vbdev_lvol_get_fragmap(struct spdk_lvol *lvol, uint64_t offset, uint64_t size, uint64_t cluster_size, num_clusters, block_size, num_blocks, lvol_size, segment_size; int rc; - // Create a bitmap recording the allocated clusters + /* + * Create a bitmap recording the allocated clusters + */ cluster_size = spdk_bs_get_cluster_size(lvol->lvol_store->blobstore); block_size = spdk_bdev_get_block_size(lvol->bdev); num_blocks = spdk_bdev_get_num_blocks(lvol->bdev); @@ -2252,7 +2254,9 @@ vbdev_lvol_get_fragmap(struct spdk_lvol *lvol, uint64_t offset, uint64_t size, return; } - // Construct a fragmap of the lvol + /* + * Construct a fragmap of the lvol + */ rc = spdk_bdev_open_ext(lvol->bdev->name, false, dummy_bdev_event_cb, NULL, &desc); if (rc != 0) { diff --git a/module/bdev/lvol/vbdev_lvol.h b/module/bdev/lvol/vbdev_lvol.h index f8b61dc52..c55660806 100644 --- a/module/bdev/lvol/vbdev_lvol.h +++ b/module/bdev/lvol/vbdev_lvol.h @@ -88,7 +88,7 @@ void vbdev_lvol_set_xattr(struct spdk_lvol *lvol, const char *name, * \param value_len Xattr value length */ int vbdev_lvol_get_xattr(struct spdk_lvol *lvol, const char *name, - const void **value, size_t *value_len); + const void **value, size_t *value_len); /** * Destroy a logical volume @@ -166,8 +166,7 @@ void vbdev_lvol_shallow_copy(struct spdk_lvol *lvol, const char *bdev_name, * @param cb_fn Completion callback * @param cb_arg Completion callback custom arguments */ -void -vbdev_lvol_get_fragmap(struct spdk_lvol *lvol, uint64_t offset, uint64_t size, - spdk_lvol_op_with_fragmap_handle_complete cb_fn, void *cb_arg); +void vbdev_lvol_get_fragmap(struct spdk_lvol *lvol, uint64_t offset, uint64_t size, + spdk_lvol_op_with_fragmap_handle_complete cb_fn, void *cb_arg); #endif /* SPDK_VBDEV_LVOL_H */ diff --git a/module/bdev/lvol/vbdev_lvol_rpc.c b/module/bdev/lvol/vbdev_lvol_rpc.c index f26342704..cd7ae7d3d 100644 --- a/module/bdev/lvol/vbdev_lvol_rpc.c +++ b/module/bdev/lvol/vbdev_lvol_rpc.c @@ -740,7 +740,7 @@ invalid: static void rpc_bdev_lvol_set_xattr(struct spdk_jsonrpc_request *request, - const struct spdk_json_val *params) + const struct spdk_json_val *params) { struct rpc_bdev_lvol_set_xattr req = {}; struct spdk_bdev *bdev; diff --git a/test/lvol/fragmap.sh b/test/lvol/fragmap.sh index a51e93a10..b68c0a2f2 100755 --- a/test/lvol/fragmap.sh +++ b/test/lvol/fragmap.sh @@ -212,4 +212,4 @@ run_test "test_fragmap_hole_data_hole" test_fragmap_hole_data_hole run_test "test_fragmap_data_hole_data" test_fragmap_data_hole_data trap - SIGINT SIGTERM EXIT -killprocess $spdk_pid \ No newline at end of file +killprocess $spdk_pid