t/io_uring: use the get_offset() code to retrieve pass-through offset
authorJens Axboe <axboe@kernel.dk>
Tue, 14 Mar 2023 19:59:32 +0000 (13:59 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 14 Mar 2023 19:59:32 +0000 (13:59 -0600)
No point in duplicating this code, use the helper.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
t/io_uring.c

index d39d7924b4e4149549c6b2f83e4639bc16111f87..17d1d2635677a7c2255d41342fb71af428102e56 100644 (file)
@@ -606,7 +606,6 @@ static void init_io_pt(struct submitter *s, unsigned index)
        struct nvme_uring_cmd *cmd;
        unsigned long long slba;
        unsigned long long nlb;
-       long r;
 
        if (s->nr_files == 1) {
                f = &s->files[0];
@@ -621,15 +620,7 @@ static void init_io_pt(struct submitter *s, unsigned index)
        }
        f->pending_ios++;
 
-       if (random_io) {
-               r = __rand64(&s->rand_state);
-               offset = (r % (f->max_blocks - 1)) * bs;
-       } else {
-               offset = f->cur_off;
-               f->cur_off += bs;
-               if (f->cur_off + bs > f->max_size)
-                       f->cur_off = 0;
-       }
+       offset = get_offset(s, f);
 
        if (register_files) {
                sqe->fd = f->fixed_fd;