Pull block updates from Jens Axboe: "Pretty quiet round for this release. This contains: - Add support for zoned storage to ublk (Andreas, Ming) - Series improving performance for drivers that mark themselves as needing a blocking context for issue (Bart) - Cleanup the flush logic (Chengming) - sed opal keyring support (Greg) - Fixes and improvements to the integrity support (Jinyoung) - Add some exports for bcachefs that we can hopefully delete again in the future (Kent) - deadline throttling fix (Zhiguo) - Series allowing building the kernel without buffer_head support (Christoph) - Sanitize the bio page adding flow (Christoph) - Write back cache fixes (Christoph) - MD updates via Song: - Fix perf regression for raid0 large sequential writes (Jan) - Fix split bio iostat for raid0 (David) - Various raid1 fixes (Heinz, Xueshi) - raid6test build fixes (WANG) - Deprecate bitmap file support (Christoph) - Fix deadlock with md sync thread (Yu) - Refactor md io accounting (Yu) - Various non-urgent fixes (Li, Yu, Jack) - Various fixes and cleanups (Arnd, Azeem, Chengming, Damien, Li, Ming, Nitesh, Ruan, Tejun, Thomas, Xu)" * tag 'for-6.6/block-2023-08-28' of git://git.kernel.dk/linux: (113 commits) block: use strscpy() to instead of strncpy() block: sed-opal: keyring support for SED keys block: sed-opal: Implement IOC_OPAL_REVERT_LSP block: sed-opal: Implement IOC_OPAL_DISCOVERY blk-mq: prealloc tags when increase tagset nr_hw_queues blk-mq: delete redundant tagset map update when fallback blk-mq: fix tags leak when shrink nr_hw_queues ublk: zoned: support REQ_OP_ZONE_RESET_ALL md: raid0: account for split bio in iostat accounting md/raid0: Fix performance regression for large sequential writes md/raid0: Factor out helper for mapping and submitting a bio md raid1: allow writebehind to work on any leg device set WriteMostly md/raid1: hold the barrier until handle_read_error() finishes md/raid1: free the r1bio before waiting for blocked rdev md/raid1: call free_r1bio() before allow_barrier() in raid_end_bio_io() blk-cgroup: Fix NULL deref caused by blkg_policy_data being installed before init drivers/rnbd: restore sysfs interface to rnbd-client md/raid5-cache: fix null-ptr-deref for r5l_flush_stripe_to_raid() raid6: test: only check for Altivec if building on powerpc hosts raid6: test: make sure all intermediate and artifact files are .gitignored ...
Showing the changes to include/uapi/linux (3 of 101 files). Show all
Unified · Split
| @@ -107,20 +107,21 @@ enum { · 106 unmodified lines | ||
| 107 | 107 | /* |
| 108 | 108 | * Return an I/O priority value based on a class, a level and a hint. |
| 109 | 109 | */ |
| 110 | −static __always_inline __u16 ioprio_value(int class, int level, int hint) | |
| 110 | +static __always_inline __u16 ioprio_value(int prioclass, int priolevel, | |
| 111 | + int priohint) | |
| 111 | 112 | { |
| 112 | − if (IOPRIO_BAD_VALUE(class, IOPRIO_NR_CLASSES) || | |
| 113 | − IOPRIO_BAD_VALUE(level, IOPRIO_NR_LEVELS) || | |
| 114 | − IOPRIO_BAD_VALUE(hint, IOPRIO_NR_HINTS)) | |
| 113 | + if (IOPRIO_BAD_VALUE(prioclass, IOPRIO_NR_CLASSES) || | |
| 114 | + IOPRIO_BAD_VALUE(priolevel, IOPRIO_NR_LEVELS) || | |
| 115 | + IOPRIO_BAD_VALUE(priohint, IOPRIO_NR_HINTS)) | |
| 115 | 116 | return IOPRIO_CLASS_INVALID << IOPRIO_CLASS_SHIFT; |
| 116 | 117 | |
| 117 | − return (class << IOPRIO_CLASS_SHIFT) | | |
| 118 | − (hint << IOPRIO_HINT_SHIFT) | level; | |
| 118 | + return (prioclass << IOPRIO_CLASS_SHIFT) | | |
| 119 | + (priohint << IOPRIO_HINT_SHIFT) | priolevel; | |
| 119 | 120 | } |
| 120 | 121 | |
| 121 | −#define IOPRIO_PRIO_VALUE(class, level) \ | |
| 122 | − ioprio_value(class, level, IOPRIO_HINT_NONE) | |
| 123 | −#define IOPRIO_PRIO_VALUE_HINT(class, level, hint) \ | |
| 124 | − ioprio_value(class, level, hint) | |
| 122 | +#define IOPRIO_PRIO_VALUE(prioclass, priolevel) \ | |
| 123 | + ioprio_value(prioclass, priolevel, IOPRIO_HINT_NONE) | |
| 124 | +#define IOPRIO_PRIO_VALUE_HINT(prioclass, priolevel, priohint) \ | |
| 125 | + ioprio_value(prioclass, priolevel, priohint) | |
| 125 | 126 | |
| 126 | 127 | #endif /* _UAPI_LINUX_IOPRIO_H */ |
| @@ -49,13 +49,23 @@ enum opal_lock_flags { · 48 unmodified lines | ||
| 49 | 49 | OPAL_SAVE_FOR_LOCK = 0x01, |
| 50 | 50 | }; |
| 51 | 51 | |
| 52 | +enum opal_key_type { | |
| 53 | + OPAL_INCLUDED = 0, /* key[] is the key */ | |
| 54 | + OPAL_KEYRING, /* key is in keyring */ | |
| 55 | +}; | |
| 56 | + | |
| 52 | 57 | struct opal_key { |
| 53 | 58 | __u8 lr; |
| 54 | 59 | __u8 key_len; |
| 55 | − __u8 __align[6]; | |
| 60 | + __u8 key_type; | |
| 61 | + __u8 __align[5]; | |
| 56 | 62 | __u8 key[OPAL_KEY_MAX]; |
| 57 | 63 | }; |
| 58 | 64 | |
| 65 | +enum opal_revert_lsp_opts { | |
| 66 | + OPAL_PRESERVE = 0x01, | |
| 67 | +}; | |
| 68 | + | |
| 59 | 69 | struct opal_lr_act { |
| 60 | 70 | struct opal_key key; |
| 61 | 71 | __u32 sum; |
| @@ -173,6 +183,17 @@ struct opal_geometry { · 111 unmodified lines | ||
| 173 | 183 | __u8 __align[3]; |
| 174 | 184 | }; |
| 175 | 185 | |
| 186 | +struct opal_discovery { | |
| 187 | + __u64 data; | |
| 188 | + __u64 size; | |
| 189 | +}; | |
| 190 | + | |
| 191 | +struct opal_revert_lsp { | |
| 192 | + struct opal_key key; | |
| 193 | + __u32 options; | |
| 194 | + __u32 __pad; | |
| 195 | +}; | |
| 196 | + | |
| 176 | 197 | #define IOC_OPAL_SAVE _IOW('p', 220, struct opal_lock_unlock) |
| 177 | 198 | #define IOC_OPAL_LOCK_UNLOCK _IOW('p', 221, struct opal_lock_unlock) |
| 178 | 199 | #define IOC_OPAL_TAKE_OWNERSHIP _IOW('p', 222, struct opal_key) |
| @@ -192,5 +213,7 @@ struct opal_geometry { · 13 unmodified lines | ||
| 192 | 213 | #define IOC_OPAL_GET_STATUS _IOR('p', 236, struct opal_status) |
| 193 | 214 | #define IOC_OPAL_GET_LR_STATUS _IOW('p', 237, struct opal_lr_status) |
| 194 | 215 | #define IOC_OPAL_GET_GEOMETRY _IOR('p', 238, struct opal_geometry) |
| 216 | +#define IOC_OPAL_DISCOVERY _IOW('p', 239, struct opal_discovery) | |
| 217 | +#define IOC_OPAL_REVERT_LSP _IOW('p', 240, struct opal_revert_lsp) | |
| 195 | 218 | |
| 196 | 219 | #endif /* _UAPI_SED_OPAL_H */ |
| @@ -176,6 +176,12 @@ · 175 unmodified lines | ||
| 176 | 176 | /* Copy between request and user buffer by pread()/pwrite() */ |
| 177 | 177 | #define UBLK_F_USER_COPY (1UL << 7) |
| 178 | 178 | |
| 179 | +/* | |
| 180 | + * User space sets this flag when setting up the device to request zoned storage support. Kernel may | |
| 181 | + * deny the request by returning an error. | |
| 182 | + */ | |
| 183 | +#define UBLK_F_ZONED (1ULL << 8) | |
| 184 | + | |
| 179 | 185 | /* device state */ |
| 180 | 186 | #define UBLK_S_DEV_DEAD 0 |
| 181 | 187 | #define UBLK_S_DEV_LIVE 1 |
| @@ -232,9 +238,27 @@ struct ublksrv_ctrl_dev_info { · 50 unmodified lines | ||
| 232 | 238 | #define UBLK_IO_OP_READ 0 |
| 233 | 239 | #define UBLK_IO_OP_WRITE 1 |
| 234 | 240 | #define UBLK_IO_OP_FLUSH 2 |
| 235 | −#define UBLK_IO_OP_DISCARD 3 | |
| 236 | −#define UBLK_IO_OP_WRITE_SAME 4 | |
| 237 | −#define UBLK_IO_OP_WRITE_ZEROES 5 | |
| 241 | +#define UBLK_IO_OP_DISCARD 3 | |
| 242 | +#define UBLK_IO_OP_WRITE_SAME 4 | |
| 243 | +#define UBLK_IO_OP_WRITE_ZEROES 5 | |
| 244 | +#define UBLK_IO_OP_ZONE_OPEN 10 | |
| 245 | +#define UBLK_IO_OP_ZONE_CLOSE 11 | |
| 246 | +#define UBLK_IO_OP_ZONE_FINISH 12 | |
| 247 | +#define UBLK_IO_OP_ZONE_APPEND 13 | |
| 248 | +#define UBLK_IO_OP_ZONE_RESET_ALL 14 | |
| 249 | +#define UBLK_IO_OP_ZONE_RESET 15 | |
| 250 | +/* | |
| 251 | + * Construct a zone report. The report request is carried in `struct | |
| 252 | + * ublksrv_io_desc`. The `start_sector` field must be the first sector of a zone | |
| 253 | + * and shall indicate the first zone of the report. The `nr_zones` shall | |
| 254 | + * indicate how many zones should be reported at most. The report shall be | |
| 255 | + * delivered as a `struct blk_zone` array. To report fewer zones than requested, | |
| 256 | + * zero the last entry of the returned array. | |
| 257 | + * | |
| 258 | + * Related definitions(blk_zone, blk_zone_cond, blk_zone_type, ...) in | |
| 259 | + * include/uapi/linux/blkzoned.h are part of ublk UAPI. | |
| 260 | + */ | |
| 261 | +#define UBLK_IO_OP_REPORT_ZONES 18 | |
| 238 | 262 | |
| 239 | 263 | #define UBLK_IO_F_FAILFAST_DEV (1U << 8) |
| 240 | 264 | #define UBLK_IO_F_FAILFAST_TRANSPORT (1U << 9) |
| @@ -255,7 +279,10 @@ struct ublksrv_io_desc { · 14 unmodified lines | ||
| 255 | 279 | /* op: bit 0-7, flags: bit 8-31 */ |
| 256 | 280 | __u32 op_flags; |
| 257 | 281 | |
| 258 | − __u32 nr_sectors; | |
| 282 | + union { | |
| 283 | + __u32 nr_sectors; | |
| 284 | + __u32 nr_zones; /* for UBLK_IO_OP_REPORT_ZONES */ | |
| 285 | + }; | |
| 259 | 286 | |
| 260 | 287 | /* start sector for this io */ |
| 261 | 288 | __u64 start_sector; |
| @@ -284,11 +311,21 @@ struct ublksrv_io_cmd { · 22 unmodified lines | ||
| 284 | 311 | /* io result, it is valid for COMMIT* command only */ |
| 285 | 312 | __s32 result; |
| 286 | 313 | |
| 287 | − /* | |
| 288 | − * userspace buffer address in ublksrv daemon process, valid for | |
| 289 | − * FETCH* command only | |
| 290 | − */ | |
| 291 | − __u64 addr; | |
| 314 | + union { | |
| 315 | + /* | |
| 316 | + * userspace buffer address in ublksrv daemon process, valid for | |
| 317 | + * FETCH* command only | |
| 318 | + * | |
| 319 | + * `addr` should not be used when UBLK_F_USER_COPY is enabled, | |
| 320 | + * because userspace handles data copy by pread()/pwrite() over | |
| 321 | + * /dev/ublkcN. But in case of UBLK_F_ZONED, this union is | |
| 322 | + * re-used to pass back the allocated LBA for | |
| 323 | + * UBLK_IO_OP_ZONE_APPEND which actually depends on | |
| 324 | + * UBLK_F_USER_COPY | |
| 325 | + */ | |
| 326 | + __u64 addr; | |
| 327 | + __u64 zone_append_lba; | |
| 328 | + }; | |
| 292 | 329 | }; |
| 293 | 330 | |
| 294 | 331 | struct ublk_param_basic { |
| @@ -331,6 +368,13 @@ struct ublk_param_devt { · 36 unmodified lines | ||
| 331 | 368 | __u32 disk_minor; |
| 332 | 369 | }; |
| 333 | 370 | |
| 371 | +struct ublk_param_zoned { | |
| 372 | + __u32 max_open_zones; | |
| 373 | + __u32 max_active_zones; | |
| 374 | + __u32 max_zone_append_sectors; | |
| 375 | + __u8 reserved[20]; | |
| 376 | +}; | |
| 377 | + | |
| 334 | 378 | struct ublk_params { |
| 335 | 379 | /* |
| 336 | 380 | * Total length of parameters, userspace has to set 'len' for both |
| @@ -342,11 +386,13 @@ struct ublk_params { · 5 unmodified lines | ||
| 342 | 386 | #define UBLK_PARAM_TYPE_BASIC (1 << 0) |
| 343 | 387 | #define UBLK_PARAM_TYPE_DISCARD (1 << 1) |
| 344 | 388 | #define UBLK_PARAM_TYPE_DEVT (1 << 2) |
| 389 | +#define UBLK_PARAM_TYPE_ZONED (1 << 3) | |
| 345 | 390 | __u32 types; /* types of parameter included */ |
| 346 | 391 | |
| 347 | 392 | struct ublk_param_basic basic; |
| 348 | 393 | struct ublk_param_discard discard; |
| 349 | 394 | struct ublk_param_devt devt; |
| 395 | + struct ublk_param_zoned zoned; | |
| 350 | 396 | }; |
| 351 | 397 | |
| 352 | 398 | #endif |