* [PATCH] selftests: ublk: fix write cache implementation
@ 2025-03-21 0:47 Ming Lei
2025-03-21 2:02 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Ming Lei @ 2025-03-21 0:47 UTC (permalink / raw)
To: Jens Axboe, linux-block; +Cc: Ming Lei
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>
---
tools/testing/selftests/ublk/file_backed.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/ublk/file_backed.c b/tools/testing/selftests/ublk/file_backed.c
index 38e68b414962..8a07356eccaf 100644
--- a/tools/testing/selftests/ublk/file_backed.c
+++ b/tools/testing/selftests/ublk/file_backed.c
@@ -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,
--
2.47.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] selftests: ublk: fix write cache implementation
2025-03-21 0:47 [PATCH] selftests: ublk: fix write cache implementation Ming Lei
@ 2025-03-21 2:02 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2025-03-21 2:02 UTC (permalink / raw)
To: linux-block, Ming Lei
On Fri, 21 Mar 2025 08:47:58 +0800, Ming Lei wrote:
> 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.
>
> [...]
Applied, thanks!
[1/1] selftests: ublk: fix write cache implementation
commit: 96af5af47b5407972689929543c73a39b477c8ba
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-21 2:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-21 0:47 [PATCH] selftests: ublk: fix write cache implementation Ming Lei
2025-03-21 2:02 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox