Pull block driver updates from Jens Axboe: - NVMe pull requests via Christoph: - add support for In-Band authentication (Hannes Reinecke) - handle the persistent internal error AER (Michael Kelley) - use in-capsule data for TCP I/O queue connect (Caleb Sander) - remove timeout for getting RDMA-CM established event (Israel Rukshin) - misc cleanups (Joel Granados, Sagi Grimberg, Chaitanya Kulkarni, Guixin Liu, Xiang wangx) - use command_id instead of req->tag in trace_nvme_complete_rq() (Bean Huo) - various fixes for the new authentication code (Lukas Bulwahn, Dan Carpenter, Colin Ian King, Chaitanya Kulkarni, Hannes Reinecke) - small cleanups (Liu Song, Christoph Hellwig) - restore compat_ioctl support (Nick Bowler) - make a nvmet-tcp workqueue lockdep-safe (Sagi Grimberg) - enable generic interface (/dev/ngXnY) for unknown command sets (Joel Granados, Christoph Hellwig) - don't always build constants.o (Christoph Hellwig) - print the command name of aborted commands (Christoph Hellwig) - MD pull requests via Song: - Improve raid5 lock contention, by Logan Gunthorpe. - Misc fixes to raid5, by Logan Gunthorpe. - Fix race condition with md_reap_sync_thread(), by Guoqing Jiang. - Fix potential deadlock with raid5_quiesce and raid5_get_active_stripe, by Logan Gunthorpe. - Refactoring md_alloc(), by Christoph" - Fix md disk_name lifetime problems, by Christoph Hellwig - Convert prepare_to_wait() to wait_woken() api, by Logan Gunthorpe; - Fix sectors_to_do bitmap issue, by Logan Gunthorpe. - Work on unifying the null_blk module parameters and configfs API (Vincent) - drbd bitmap IO error fix (Lars) - Set of rnbd fixes (Guoqing, Md Haris) - Remove experimental marker on bcache async device registration (Coly) - Series from cleaning up the bio splitting (Christoph) - Removal of the sx8 block driver. This hardware never really widespread, and it didn't receive a lot of attention after the initial merge of it back in 2005 (Christoph) - A few fixes for s390 dasd (Eric, Jiang) - Followup set of fixes for ublk (Ming) - Support for UBLK_IO_NEED_GET_DATA for ublk (ZiyangZhang) - Fixes for the dio dma alignment (Keith) - Misc fixes and cleanups (Ming, Yu, Dan, Christophe * tag 'for-5.20/block-2022-08-04' of git://git.kernel.dk/linux-block: (136 commits) s390/dasd: Establish DMA alignment s390/dasd: drop unexpected word 'for' in comments ublk_drv: add support for UBLK_IO_NEED_GET_DATA ublk_cmd.h: add one new ublk command: UBLK_IO_NEED_GET_DATA ublk_drv: cleanup ublksrv_ctrl_dev_info ublk_drv: add SET_PARAMS/GET_PARAMS control command ublk_drv: fix ublk device leak in case that add_disk fails ublk_drv: cancel device even though disk isn't up block: fix leaking page ref on truncated direct io block: ensure bio_iov_add_page can't fail block: ensure iov_iter advances for added pages drivers:md:fix a potential use-after-free bug md/raid5: Ensure batch_last is released before sleeping for quiesce md/raid5: Move stripe_request_ctx up md/raid5: Drop unnecessary call to r5c_check_stripe_cache_usage() md/raid5: Make is_inactive_blocked() helper md/raid5: Refactor raid5_get_active_stripe() block: pass struct queue_limits to the bio splitting helpers block: move bio_allowed_max_sectors to blk-merge.c block: move the call to get_max_io_size out of blk_bio_segment_split ...
Showing the changes to include/uapi (1 of 86 files). Show all
Unified · Split
| @@ -15,6 +15,8 @@ · 14 unmodified lines | ||
| 15 | 15 | #define UBLK_CMD_DEL_DEV 0x05 |
| 16 | 16 | #define UBLK_CMD_START_DEV 0x06 |
| 17 | 17 | #define UBLK_CMD_STOP_DEV 0x07 |
| 18 | +#define UBLK_CMD_SET_PARAMS 0x08 | |
| 19 | +#define UBLK_CMD_GET_PARAMS 0x09 | |
| 18 | 20 | |
| 19 | 21 | /* |
| 20 | 22 | * IO commands, issued by ublk server, and handled by ublk driver. |
| @@ -28,12 +30,21 @@ · 7 unmodified lines | ||
| 28 | 30 | * this IO request, request's handling result is committed to ublk |
| 29 | 31 | * driver, meantime FETCH_REQ is piggyback, and FETCH_REQ has to be |
| 30 | 32 | * handled before completing io request. |
| 33 | + * | |
| 34 | + * NEED_GET_DATA: only used for write requests to set io addr and copy data | |
| 35 | + * When NEED_GET_DATA is set, ublksrv has to issue UBLK_IO_NEED_GET_DATA | |
| 36 | + * command after ublk driver returns UBLK_IO_RES_NEED_GET_DATA. | |
| 37 | + * | |
| 38 | + * It is only used if ublksrv set UBLK_F_NEED_GET_DATA flag | |
| 39 | + * while starting a ublk device. | |
| 31 | 40 | */ |
| 32 | 41 | #define UBLK_IO_FETCH_REQ 0x20 |
| 33 | 42 | #define UBLK_IO_COMMIT_AND_FETCH_REQ 0x21 |
| 43 | +#define UBLK_IO_NEED_GET_DATA 0x22 | |
| 34 | 44 | |
| 35 | 45 | /* only ABORT means that no re-fetch */ |
| 36 | 46 | #define UBLK_IO_RES_OK 0 |
| 47 | +#define UBLK_IO_RES_NEED_GET_DATA 1 | |
| 37 | 48 | #define UBLK_IO_RES_ABORT (-ENODEV) |
| 38 | 49 | |
| 39 | 50 | #define UBLKSRV_CMD_BUF_OFFSET 0 |
| @@ -54,6 +65,15 @@ · 14 unmodified lines | ||
| 54 | 65 | */ |
| 55 | 66 | #define UBLK_F_URING_CMD_COMP_IN_TASK (1ULL << 1) |
| 56 | 67 | |
| 68 | +/* | |
| 69 | + * User should issue io cmd again for write requests to | |
| 70 | + * set io buffer address and copy data from bio vectors | |
| 71 | + * to the userspace io buffer. | |
| 72 | + * | |
| 73 | + * In this mode, task_work is not used. | |
| 74 | + */ | |
| 75 | +#define UBLK_F_NEED_GET_DATA (1UL << 2) | |
| 76 | + | |
| 57 | 77 | /* device state */ |
| 58 | 78 | #define UBLK_S_DEV_DEAD 0 |
| 59 | 79 | #define UBLK_S_DEV_LIVE 1 |
| @@ -78,22 +98,23 @@ struct ublksrv_ctrl_cmd { · 18 unmodified lines | ||
| 78 | 98 | struct ublksrv_ctrl_dev_info { |
| 79 | 99 | __u16 nr_hw_queues; |
| 80 | 100 | __u16 queue_depth; |
| 81 | − __u16 block_size; | |
| 82 | 101 | __u16 state; |
| 102 | + __u16 pad0; | |
| 83 | 103 | |
| 84 | − __u32 rq_max_blocks; | |
| 104 | + __u32 max_io_buf_bytes; | |
| 85 | 105 | __u32 dev_id; |
| 86 | 106 | |
| 87 | − __u64 dev_blocks; | |
| 88 | − | |
| 89 | 107 | __s32 ublksrv_pid; |
| 90 | − __s32 reserved0; | |
| 108 | + __u32 pad1; | |
| 109 | + | |
| 91 | 110 | __u64 flags; |
| 92 | − __u64 flags_reserved; | |
| 93 | 111 | |
| 94 | 112 | /* For ublksrv internal use, invisible to ublk driver */ |
| 95 | 113 | __u64 ublksrv_flags; |
| 96 | − __u64 reserved1[9]; | |
| 114 | + | |
| 115 | + __u64 reserved0; | |
| 116 | + __u64 reserved1; | |
| 117 | + __u64 reserved2; | |
| 97 | 118 | }; |
| 98 | 119 | |
| 99 | 120 | #define UBLK_IO_OP_READ 0 |
| @@ -158,4 +179,49 @@ struct ublksrv_io_cmd { · 58 unmodified lines | ||
| 158 | 179 | __u64 addr; |
| 159 | 180 | }; |
| 160 | 181 | |
| 182 | +struct ublk_param_basic { | |
| 183 | +#define UBLK_ATTR_READ_ONLY (1 << 0) | |
| 184 | +#define UBLK_ATTR_ROTATIONAL (1 << 1) | |
| 185 | +#define UBLK_ATTR_VOLATILE_CACHE (1 << 2) | |
| 186 | +#define UBLK_ATTR_FUA (1 << 3) | |
| 187 | + __u32 attrs; | |
| 188 | + __u8 logical_bs_shift; | |
| 189 | + __u8 physical_bs_shift; | |
| 190 | + __u8 io_opt_shift; | |
| 191 | + __u8 io_min_shift; | |
| 192 | + | |
| 193 | + __u32 max_sectors; | |
| 194 | + __u32 chunk_sectors; | |
| 195 | + | |
| 196 | + __u64 dev_sectors; | |
| 197 | + __u64 virt_boundary_mask; | |
| 198 | +}; | |
| 199 | + | |
| 200 | +struct ublk_param_discard { | |
| 201 | + __u32 discard_alignment; | |
| 202 | + | |
| 203 | + __u32 discard_granularity; | |
| 204 | + __u32 max_discard_sectors; | |
| 205 | + | |
| 206 | + __u32 max_write_zeroes_sectors; | |
| 207 | + __u16 max_discard_segments; | |
| 208 | + __u16 reserved0; | |
| 209 | +}; | |
| 210 | + | |
| 211 | +struct ublk_params { | |
| 212 | + /* | |
| 213 | + * Total length of parameters, userspace has to set 'len' for both | |
| 214 | + * SET_PARAMS and GET_PARAMS command, and driver may update len | |
| 215 | + * if two sides use different version of 'ublk_params', same with | |
| 216 | + * 'types' fields. | |
| 217 | + */ | |
| 218 | + __u32 len; | |
| 219 | +#define UBLK_PARAM_TYPE_BASIC (1 << 0) | |
| 220 | +#define UBLK_PARAM_TYPE_DISCARD (1 << 1) | |
| 221 | + __u32 types; /* types of parameter included */ | |
| 222 | + | |
| 223 | + struct ublk_param_basic basic; | |
| 224 | + struct ublk_param_discard discard; | |
| 225 | +}; | |
| 226 | + | |
| 161 | 227 | #endif |