History

ublk: add feature UBLK_F_QUIESCE

Add feature UBLK_F_QUIESCE, which adds control command `UBLK_U_CMD_QUIESCE_DEV` for quiescing device, then device state can become `UBLK_S_DEV_QUIESCED` or `UBLK_S_DEV_FAIL_IO` finally from ublk_ch_release() with ublk server cooperation. This feature can help to support to upgrade ublk server application by shutting down ublk server gracefully, meantime keep ublk block device persistent during the upgrading period. The feature is only available for UBLK_F_USER_RECOVERY.

Ming Lei committed 1 year ago

Commit b465ae71 parent f40b1f22 files · +142 −1Browse files

Showing the changes to include/uapi/linux (1 of 2 files). Show all

Unified · Split

include/uapi/linux/ublk_cmd.h+19−0
@@ -53,6 +53,8 @@ · 52 unmodified lines
53 _IOR('u', 0x14, struct ublksrv_ctrl_cmd)53 _IOR('u', 0x14, struct ublksrv_ctrl_cmd)
54#define UBLK_U_CMD_UPDATE_SIZE \54#define UBLK_U_CMD_UPDATE_SIZE \
55 _IOWR('u', 0x15, struct ublksrv_ctrl_cmd)55 _IOWR('u', 0x15, struct ublksrv_ctrl_cmd)
56#define UBLK_U_CMD_QUIESCE_DEV \
57 _IOWR('u', 0x16, struct ublksrv_ctrl_cmd)
56 58
57/*59/*
58 * 64bits are enough now, and it should be easy to extend in case of60 * 64bits are enough now, and it should be easy to extend in case of
@@ -253,6 +255,23 @@ · 194 unmodified lines
253 */255 */
254#define UBLK_F_AUTO_BUF_REG (1ULL << 11)256#define UBLK_F_AUTO_BUF_REG (1ULL << 11)
255 257
258/*
259 * Control command `UBLK_U_CMD_QUIESCE_DEV` is added for quiescing device,
260 * which state can be transitioned to `UBLK_S_DEV_QUIESCED` or
261 * `UBLK_S_DEV_FAIL_IO` finally, and it needs ublk server cooperation for
262 * handling `UBLK_IO_RES_ABORT` correctly.
263 *
264 * Typical use case is for supporting to upgrade ublk server application,
265 * meantime keep ublk block device persistent during the period.
266 *
267 * This feature is only available when UBLK_F_USER_RECOVERY is enabled.
268 *
269 * Note, this command returns -EBUSY in case that all IO commands are being
270 * handled by ublk server and not completed in specified time period which
271 * is passed from the control command parameter.
272 */
273#define UBLK_F_QUIESCE (1ULL << 12)
274
256/* device state */275/* device state */
257#define UBLK_S_DEV_DEAD 0276#define UBLK_S_DEV_DEAD 0
258#define UBLK_S_DEV_LIVE 1277#define UBLK_S_DEV_LIVE 1

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t