Skip to content

Commit 851e062

Browse files
Ming Leiaxboe
authored andcommitted
ublk: zoned: support REQ_OP_ZONE_RESET_ALL
There isn't any reason to not support REQ_OP_ZONE_RESET_ALL given everything is actually handled in userspace, not mention it is pretty easy to support RESET_ALL. So enable REQ_OP_ZONE_RESET_ALL and let userspace handle it. Verified by 'tools/zbc_reset_zone -all /dev/ublkb0' in libzbc[1] with libublk-rs based ublk-zoned target prototype[2], follows command line for creating ublk-zoned: cargo run --example zoned -- add -1 1024 # add $dev_id $DEV_SIZE [1] https://github.com/westerndigitalcorporation/libzbc [2] https://github.com/ming1/libublk-rs/tree/zoned.v2 Cc: Niklas Cassel <[email protected]> Cc: Damien Le Moal <[email protected]> Cc: Andreas Hindborg <[email protected]> Signed-off-by: Ming Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent eb051b2 commit 851e062

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

drivers/block/ublk_drv.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ static int ublk_dev_param_zoned_apply(struct ublk_device *ub)
251251
const struct ublk_param_zoned *p = &ub->params.zoned;
252252

253253
disk_set_zoned(ub->ub_disk, BLK_ZONED_HM);
254+
blk_queue_flag_set(QUEUE_FLAG_ZONE_RESETALL, ub->ub_disk->queue);
254255
blk_queue_required_elevator_features(ub->ub_disk->queue,
255256
ELEVATOR_F_ZBD_SEQ_WRITE);
256257
disk_set_max_active_zones(ub->ub_disk, p->max_active_zones);
@@ -393,6 +394,9 @@ static blk_status_t ublk_setup_iod_zoned(struct ublk_queue *ubq,
393394
case REQ_OP_ZONE_APPEND:
394395
ublk_op = UBLK_IO_OP_ZONE_APPEND;
395396
break;
397+
case REQ_OP_ZONE_RESET_ALL:
398+
ublk_op = UBLK_IO_OP_ZONE_RESET_ALL;
399+
break;
396400
case REQ_OP_DRV_IN:
397401
ublk_op = pdu->operation;
398402
switch (ublk_op) {
@@ -404,9 +408,8 @@ static blk_status_t ublk_setup_iod_zoned(struct ublk_queue *ubq,
404408
default:
405409
return BLK_STS_IOERR;
406410
}
407-
case REQ_OP_ZONE_RESET_ALL:
408411
case REQ_OP_DRV_OUT:
409-
/* We do not support reset_all and drv_out */
412+
/* We do not support drv_out */
410413
return BLK_STS_NOTSUPP;
411414
default:
412415
return BLK_STS_IOERR;

include/uapi/linux/ublk_cmd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ struct ublksrv_ctrl_dev_info {
245245
#define UBLK_IO_OP_ZONE_CLOSE 11
246246
#define UBLK_IO_OP_ZONE_FINISH 12
247247
#define UBLK_IO_OP_ZONE_APPEND 13
248+
#define UBLK_IO_OP_ZONE_RESET_ALL 14
248249
#define UBLK_IO_OP_ZONE_RESET 15
249250
/*
250251
* Construct a zone report. The report request is carried in `struct

0 commit comments

Comments
 (0)