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
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 11 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#### Which issue(s) this PR fixes:
<!--
Use `Issue #<issue number>` or `Issue longhorn/longhorn#<issue number>` or `Issue (paste link of issue)`. DON'T use `Fixes #<issue number>` or `Fixes (paste link of issue)`, as it will automatically close the linked issue when the PR is merged.
-->
Issue #

#### What this PR does / why we need it:

#### Special notes for your reviewer:

#### Additional documentation or context
235 changes: 234 additions & 1 deletion doc/jsonrpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ Example response:
"bdev_lvol_check_shallow_copy",
"bdev_lvol_set_parent",
"bdev_lvol_set_parent_bdev",
"bdev_lvol_get_fragmap",
"bdev_daos_delete",
"bdev_daos_create",
"bdev_daos_resize"
Expand Down Expand Up @@ -10607,6 +10608,7 @@ Name | Optional | Type | Description
----------------------- | -------- | ----------- | -----------
lvol_name | Required | string | UUID or alias of the logical volume to create a snapshot from
snapshot_name | Required | string | Name for the newly created snapshot
xattrs | Optional | string map | Xattrs for the newly created snapshot

#### Response

Expand All @@ -10623,7 +10625,11 @@ Example request:
"id": 1,
"params": {
"lvol_name": "1b38702c-7f0c-411e-a962-92c6a5a8a602",
"snapshot_name": "SNAP1"
"snapshot_name": "SNAP1",
"xattrs": {
"snapshot_timestamp": "2024-01-16T16:06:46Z",
"user_created": "true",
}
}
}
~~~
Expand Down Expand Up @@ -10997,6 +11003,29 @@ Example response:
]
~~~

### 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

### bdev_lvol_set_parent {#rpc_bdev_lvol_set_parent}

Set a snapshot as the parent of a lvol, making the lvol a clone of this snapshot.
Expand Down Expand Up @@ -11176,6 +11205,52 @@ Example response:
}
~~~

### bdev_lvol_get_fragmap {#bdev_lvol_get_fragmap}

Get a fragmap for a specific segment of a logical volume using the provided offset and size.
A fragmap is a bitmap that records the allocation status of clusters. A value of "1" indicates
that a cluster is allocated, whereas "0" signifies that a cluster is unallocated.

#### Parameters

Name | Optional | Type | Description
----------------------- | -------- | ----------- | -----------
name | Required | string | UUID or alias of the logical volume
offset | Optional | number | Offset in bytes of the specific segment of the logical volume (Default: 0)
size | Optional | number | Size in bytes of the specific segment of the logical volume (Default: 0 for representing the entire file)

#### Example

Example request:

~~~json
{
"jsonrpc": "2.0",
"method": "bdev_lvol_get_fragmap",
"id": 1,
"params": {
"name": "8a47421a-20cf-444f-845c-d97ad0b0bd8e",
"offset": 0,
"size": 41943040
}
}
~~~

Example response:

~~~json
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"cluster_size": 4194304,
"num_clusters": 10,
"num_allocated_clusters": 0,
"fragmap": "AAA="
}
}
~~~

## RAID

### bdev_raid_set_options {#rpc_bdev_raid_set_options}
Expand Down Expand Up @@ -11333,6 +11408,7 @@ raid_level | Required | string | RAID level
base_bdevs | Required | string | Base bdevs name, whitespace separated list in quotes
uuid | Optional | string | UUID for this RAID bdev
superblock | Optional | boolean | If set, information about raid bdev will be stored in superblock on each base bdev (default: `false`)
delta_bitmap | Optional | boolean | If set, a delta bitmap for faulty base bdevs will be recorded. @ref bdev_raid_get_base_bdev_delta_bitmap

#### Example

Expand Down Expand Up @@ -11474,6 +11550,163 @@ Example response:
}
~~~

### bdev_raid_grow_base_bdev {#rpc_bdev_raid_grow_base_bdev}

Add base bdev to existing raid bdev, growing the raid's size if there isn't an empty base bdev slot.
The bdev must be large enough and have the same block size and metadata format as the other base bdevs.

#### Parameters

Name | Optional | Type | Description
----------------------- | -------- | ----------- | -----------
raid_name | Required | string | Raid bdev name
base_name | Required | string | Base bdev name

#### Example

Example request:

~~~json
{
"jsonrpc": "2.0",
"method": "bdev_raid_grow_base_bdev",
"id": 1,
"params": {
"raid_name": "Raid1",
"base_name": "Nvme1n1",
}
}
~~~

Example response:

~~~json
{
"jsonrpc": "2.0",
"id": 1,
"result": true
}
~~~

### bdev_raid_get_base_bdev_delta_bitmap {#rpc_bdev_raid_get_base_bdev_delta_bitmap}

Get the delta bitmap of a faulty base bdev. A base bdev enter in faulty state when it is removed
from the raid due to a write I/O error or to the deletion of the corresponding bdev.
When in faulty state, a delta bitmap is created and updated by every I/O write operations performed over
the raid. Expired a defined timeout, the delta bitmap is deleted and the base bdev is removed from the
faulty state so that no sign of this base bdev will remain in the raid.
In the delta bitmap, every region modified has the corrisponding bit set to 1.
The delta bitmap is returned as a base64 encoded string, region size is in bytes.
Before to retrieve the delta bitmap with this rpc, it must be stopped with the rpc @ref bdev_raid_stop_base_bdev_delta_bitmap

#### Parameters

Name | Optional | Type | Description
----------------------- | -------- | ----------- | -----------
base_bdev_name | Required | string | Base bdev name in RAID

#### Example

Example request:

~~~json
{
"jsonrpc": "2.0",
"method": "bdev_raid_get_base_bdev_delta_bitmap",
"id": 1,
"params": {
"name": "base0"
}
}
~~~

Example response:

~~~json
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"region_size": 4194304,
"delta_bitmap": "AA=="
}
]
}
~~~

### bdev_raid_stop_base_bdev_delta_bitmap {#rpc_bdev_raid_stop_base_bdev_delta_bitmap}

Stop the updating of the delta bitmap of a faulty base bdev

#### Parameters

Name | Optional | Type | Description
----------------------- | -------- | ----------- | -----------
base_bdev_name | Required | string | Base bdev name in RAID

#### Example

Example request:

~~~json
{
"jsonrpc": "2.0",
"method": "bdev_raid_stop_base_bdev_delta_bitmap",
"id": 1,
"params": {
"name": "base0"
}
}
~~~

Example response:

~~~json
{
"jsonrpc": "2.0",
"id": 1,
"result": true
}
~~~

### bdev_raid_clear_base_bdev_faulty_state {#rpc_bdev_raid_clear_base_bdev_faulty_state}

Clear the faulty state of a base bdev, in the same way it would have been done internally when the
timeout expire. It can be used to free the slot occupied by the faulty base bdev into the raid to
add again the same base bdev to the raid.

#### Parameters

Name | Optional | Type | Description
----------------------- | -------- | ----------- | -----------
base_bdev_name | Required | string | Base bdev name in RAID

#### Example

Example request:

~~~json
{
"jsonrpc": "2.0",
"method": "bdev_raid_clear_base_bdev_faulty_state",
"id": 1,
"params": {
"name": "base0"
}
}
~~~

Example response:

~~~json
{
"jsonrpc": "2.0",
"id": 1,
"result": true
}
~~~

## SPLIT

### bdev_split_create {#rpc_bdev_split_create}
Expand Down
9 changes: 9 additions & 0 deletions doc/lvol.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ bdev_lvol_snapshot [-h] lvol_name snapshot_name
Create a snapshot with snapshot_name of a given lvol bdev.
optional arguments:
-h, --help show help
--xattr adds a key=value xattr to the snapshot.
bdev_lvol_clone [-h] snapshot_name clone_name
Create a clone with clone_name of a given lvol snapshot.
optional arguments:
Expand Down Expand Up @@ -215,4 +216,12 @@ bdev_lvol_set_parent_bdev lvol_name esnap_name
Set the parent external snapshot of a lvol
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
```
8 changes: 8 additions & 0 deletions include/spdk/bdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,14 @@ const char *spdk_bdev_get_name(const struct spdk_bdev *bdev);
*/
const char *spdk_bdev_get_product_name(const struct spdk_bdev *bdev);

/**
* Get block device creation time.
*
* \param bdev Block device to query.
* \return Creation time of bdev as a null-terminated string, or NULL if not present.
*/
const char *spdk_bdev_get_creation_time(const struct spdk_bdev *bdev);

/**
* Get block device logical block size.
*
Expand Down
7 changes: 7 additions & 0 deletions include/spdk/bdev_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,13 @@ struct spdk_bdev {
*/
struct spdk_uuid uuid;

/**
* Creation time for this bdev.
*
* If not provided, it will be NULL.
*/
const char *creation_time;

/** Size in bytes of a metadata for the backend */
uint32_t md_len;

Expand Down
8 changes: 8 additions & 0 deletions include/spdk/bit_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,14 @@ void spdk_bit_array_load_mask(struct spdk_bit_array *ba, const void *mask);
*/
void spdk_bit_array_clear_mask(struct spdk_bit_array *ba);

/**
* Encode a bit array into a base64 string.
*
* @param array Bit array to encode.
* @return base64 string.
*/
char *spdk_bit_array_to_base64_string(const struct spdk_bit_array *array);

#ifdef __cplusplus
}
#endif
Expand Down
Loading