Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Longhorn v24.09 #37

Merged
merged 24 commits into from
Nov 15, 2024
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
bd187fc
raid1: allow creation with a single base bdev
DamiaSan Apr 19, 2023
c4f653e
Update SPDK_LVOL_NAME_MAX and SPDK_LVS_NAME_MAX to 256
derekbit Jun 10, 2023
dbf16ad
Always append one double quote char in the end of string
derekbit Jun 27, 2023
34b5008
module/raid: preliminary work for grow base bdev
DamiaSan Feb 29, 2024
273f089
module/raid: raid grow adding a new base bdev
DamiaSan Mar 11, 2024
83b7420
module/raid: add bdev_raid_grow_base_bdev rpc
DamiaSan Mar 14, 2024
79f0a81
fragmap: implement bdev_lvol_get_fragmap
derekbit Sep 7, 2023
ce46513
fragmap: add test cases
derekbit Sep 7, 2023
9449b31
xattr: add rpc_bdev_lvol_set_xattr
derekbit Aug 28, 2023
945a3f0
xattr: add rpc_bdev_lvol_get_xattr
derekbit Aug 29, 2023
d9f5a46
xattr: set creation_time xattr when creating a lvol
derekbit Aug 30, 2023
4736051
xattr: add xattr test scripts
derekbit Sep 2, 2023
fddd5ec
raid1: implement flush I/O
DamiaSan Oct 20, 2023
7472abd
Create PULL_REQUEST_TEMPLATE.md
innobead Jan 4, 2024
37fc83c
xattr: print errno in callback function
derekbit Jan 12, 2024
85adc59
lvol: add spdk_lvol_create_snapshot_xattrs API
DamiaSan Jan 17, 2024
96a4df8
vbdev_lvol: add xattr to vbdev_lvol_create_snapshot
DamiaSan Jan 17, 2024
515bde9
vbdev_lvol: add xattr to bdev_lvol_snapshot RPC
DamiaSan Jan 17, 2024
d7fa782
setup.sh: add bind, unbind, disk-driver and disk-status commands for …
derekbit Feb 22, 2024
ae932cc
raid1: support UNMAP I/O
derekbit Feb 15, 2024
6db3305
scripts: replace drivers_d with pci_bus_driver
derekbit Jul 1, 2024
7cc13cd
raid: add delta bitmap implementation
DamiaSan May 9, 2024
c86b48a
bdev_aio: only apply RWF_NOWAIT when it is supported
nickyc975 Oct 25, 2024
d54a83d
bdev_aio: disable RWF_NOWAIT
DamiaSan Nov 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
vbdev_lvol: add xattr to vbdev_lvol_create_snapshot
New params have been added to vbdev_lvol_create_snapshot to
set xattrs in the newly created snapshot.

Signed-off-by: Damiano Cipriani <[email protected]>
DamiaSan committed Nov 7, 2024
commit 96a4df8e66df3065a1f07907425f4978c337c2ff
11 changes: 10 additions & 1 deletion module/bdev/lvol/vbdev_lvol.c
Original file line number Diff line number Diff line change
@@ -1228,6 +1228,7 @@ vbdev_lvol_create(struct spdk_lvol_store *lvs, const char *name, uint64_t sz,

void
vbdev_lvol_create_snapshot(struct spdk_lvol *lvol, const char *snapshot_name,
const char *const *xattrs, size_t xattrs_num,
spdk_lvol_op_with_handle_complete cb_fn, void *cb_arg)
{
struct spdk_lvol_with_handle_req *req;
@@ -1241,7 +1242,15 @@ vbdev_lvol_create_snapshot(struct spdk_lvol *lvol, const char *snapshot_name,
req->cb_fn = cb_fn;
req->cb_arg = cb_arg;

spdk_lvol_create_snapshot(lvol, snapshot_name, _vbdev_lvol_create_cb, req);
if (xattrs == NULL && xattrs_num == 0) {
spdk_lvol_create_snapshot(lvol, snapshot_name, _vbdev_lvol_create_cb, req);
} else if (xattrs != NULL && xattrs_num > 0) {
spdk_lvol_create_snapshot_with_xattrs(lvol, snapshot_name, xattrs, xattrs_num,
_vbdev_lvol_create_cb, req);
} else {
cb_fn(cb_arg, NULL, -EINVAL);
return;
}
}

void
1 change: 1 addition & 0 deletions module/bdev/lvol/vbdev_lvol.h
Original file line number Diff line number Diff line change
@@ -40,6 +40,7 @@ int vbdev_lvol_create(struct spdk_lvol_store *lvs, const char *name, uint64_t sz
void *cb_arg);

void vbdev_lvol_create_snapshot(struct spdk_lvol *lvol, const char *snapshot_name,
const char *const *xattrs, size_t xattrs_num,
spdk_lvol_op_with_handle_complete cb_fn, void *cb_arg);

void vbdev_lvol_create_clone(struct spdk_lvol *lvol, const char *clone_name,
2 changes: 1 addition & 1 deletion module/bdev/lvol/vbdev_lvol_rpc.c
Original file line number Diff line number Diff line change
@@ -451,7 +451,7 @@ rpc_bdev_lvol_snapshot(struct spdk_jsonrpc_request *request,
goto cleanup;
}

vbdev_lvol_create_snapshot(lvol, req.snapshot_name, rpc_bdev_lvol_snapshot_cb, request);
vbdev_lvol_create_snapshot(lvol, req.snapshot_name, NULL, 0, rpc_bdev_lvol_snapshot_cb, request);

cleanup:
free_rpc_bdev_lvol_snapshot(&req);
2 changes: 1 addition & 1 deletion test/lvol/esnap/esnap.c
Original file line number Diff line number Diff line change
@@ -512,7 +512,7 @@ esnap_remove_degraded(void)
* State:
* esnap <-- vol2 <-- vol1
*/
vbdev_lvol_create_snapshot(vol1, "vol2", lvol_op_with_handle_cb, clear_owh(&owh_data));
vbdev_lvol_create_snapshot(vol1, "vol2", NULL, 0, lvol_op_with_handle_cb, clear_owh(&owh_data));
poll_error_updated(&owh_data.lvserrno);
SPDK_CU_ASSERT_FATAL(owh_data.lvserrno == 0);
SPDK_CU_ASSERT_FATAL(owh_data.u.lvol != NULL);
29 changes: 27 additions & 2 deletions test/unit/lib/bdev/vbdev_lvol.c/vbdev_lvol_ut.c
Original file line number Diff line number Diff line change
@@ -39,6 +39,7 @@ bool g_bdev_alias_already_exists = false;
bool g_lvs_with_name_already_exists = false;
bool g_ext_api_called;
bool g_bdev_is_missing = false;
bool g_snapshot_xattr_called = false;

DEFINE_STUB_V(spdk_bdev_module_fini_start_done, (void));
DEFINE_STUB_V(spdk_bdev_update_bs_blockcnt, (struct spdk_bs_dev *bs_dev));
@@ -868,6 +869,8 @@ spdk_lvol_create_snapshot_with_xattrs(struct spdk_lvol *lvol, const char *snapsh
const char *const *xattrs, size_t xattrs_num,
spdk_lvol_op_with_handle_complete cb_fn, void *cb_arg)
{
g_snapshot_xattr_called = true;
spdk_lvol_create_snapshot(lvol, snapshot_name, cb_fn, cb_arg);
}

void
@@ -1070,6 +1073,7 @@ ut_lvol_snapshot(void)
int sz = 10;
int rc;
struct spdk_lvol *lvol = NULL;
char *xattrs[] = {"par", "val"};

ut_init_bdev(DEFAULT_BDEV_NAME, DEFAULT_BDEV_UUID);

@@ -1093,10 +1097,31 @@ ut_lvol_snapshot(void)
lvol = g_lvol;

/* Successful snap create */
vbdev_lvol_create_snapshot(lvol, "snap", vbdev_lvol_create_complete, NULL);
vbdev_lvol_create_snapshot(lvol, "snap", NULL, 0, vbdev_lvol_create_complete, NULL);
SPDK_CU_ASSERT_FATAL(rc == 0);
CU_ASSERT(g_lvol != NULL);
CU_ASSERT(g_lvolerrno == 0);
CU_ASSERT(g_snapshot_xattr_called == false);

/* Snap create with NULL xattrs and xattrs number > 0 */
g_lvol = NULL;
vbdev_lvol_create_snapshot(lvol, "snap2", NULL, 2,
vbdev_lvol_create_complete, NULL);
CU_ASSERT(g_lvol == NULL);
CU_ASSERT(g_lvolerrno == -EINVAL);

/* Snap create with valid xattrs and 0 xattrs number */
vbdev_lvol_create_snapshot(lvol, "snap2", (const char *const *)&xattrs, 0,
vbdev_lvol_create_complete, NULL);
CU_ASSERT(g_lvol == NULL);
CU_ASSERT(g_lvolerrno == -EINVAL);

/* Successful snap create with xattr */
vbdev_lvol_create_snapshot(lvol, "snap4", (const char *const *)&xattrs, 2,
vbdev_lvol_create_complete, NULL);
CU_ASSERT(g_lvol != NULL);
CU_ASSERT(g_lvolerrno == 0);
CU_ASSERT(g_snapshot_xattr_called == true);

/* Successful lvol destroy */
vbdev_lvol_destroy(g_lvol, lvol_store_op_complete, NULL);
@@ -1145,7 +1170,7 @@ ut_lvol_clone(void)
lvol = g_lvol;

/* Successful snap create */
vbdev_lvol_create_snapshot(lvol, "snap", vbdev_lvol_create_complete, NULL);
vbdev_lvol_create_snapshot(lvol, "snap", NULL, 0, vbdev_lvol_create_complete, NULL);
SPDK_CU_ASSERT_FATAL(rc == 0);
SPDK_CU_ASSERT_FATAL(g_lvol != NULL);
CU_ASSERT(g_lvolerrno == 0);