mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 12:21:22 -05:00
selftests: ublk: fix write cache implementation
For loop target, write cache isn't enabled, and each write isn't be marked as DSYNC too. Fix it by enabling write cache, meantime fix FLUSH implementation by not taking LBA range into account, and there isn't such info for FLUSH command. Signed-off-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20250321004758.152572-1-ming.lei@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
@@ -123,10 +123,7 @@ static int loop_queue_tgt_io(struct ublk_queue *q, int tag)
|
||||
sqe = ublk_queue_alloc_sqe(q);
|
||||
if (!sqe)
|
||||
return -ENOMEM;
|
||||
io_uring_prep_sync_file_range(sqe, 1 /*fds[1]*/,
|
||||
iod->nr_sectors << 9,
|
||||
iod->start_sector << 9,
|
||||
IORING_FSYNC_DATASYNC);
|
||||
io_uring_prep_fsync(sqe, 1 /*fds[1]*/, IORING_FSYNC_DATASYNC);
|
||||
io_uring_sqe_set_flags(sqe, IOSQE_FIXED_FILE);
|
||||
q->io_inflight++;
|
||||
sqe->user_data = build_user_data(tag, ublk_op, UBLK_IO_TGT_NORMAL, 1);
|
||||
@@ -187,6 +184,7 @@ static int ublk_loop_tgt_init(struct ublk_dev *dev)
|
||||
struct ublk_params p = {
|
||||
.types = UBLK_PARAM_TYPE_BASIC | UBLK_PARAM_TYPE_DMA_ALIGN,
|
||||
.basic = {
|
||||
.attrs = UBLK_ATTR_VOLATILE_CACHE,
|
||||
.logical_bs_shift = 9,
|
||||
.physical_bs_shift = 12,
|
||||
.io_opt_shift = 12,
|
||||
|
||||
Reference in New Issue
Block a user