engines/io_uring_cmd: friendlier bad bs error msg
authorVincent Fu <vincent.fu@samsung.com>
Mon, 11 Dec 2023 16:25:33 +0000 (16:25 +0000)
committerVincent Fu <vincent.fu@samsung.com>
Mon, 11 Dec 2023 17:07:38 +0000 (17:07 +0000)
It can tricky to specify block sizes for devices formatted in extended
LBA mode because the block sizes are no longer powers of two. Add a
suggested block size in the error message when we abort a job because the
specified block size is not a multiple of the extended LBA size.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
engines/io_uring.c

index 38c36fdca26063fcbb8aacbda7a9b1ec71fb655b..5ae3135bc73821b475ce04d8dde5b68030b95e90 100644 (file)
@@ -1279,14 +1279,21 @@ static int fio_ioring_cmd_open_file(struct thread_data *td, struct fio_file *f)
                lba_size = data->lba_ext ? data->lba_ext : data->lba_size;
 
                for_each_rw_ddir(ddir) {
-                       if (td->o.min_bs[ddir] % lba_size ||
-                               td->o.max_bs[ddir] % lba_size) {
-                               if (data->lba_ext)
-                                       log_err("%s: block size must be a multiple of (LBA data size + Metadata size)\n",
-                                               f->file_name);
-                               else
+                       if (td->o.min_bs[ddir] % lba_size || td->o.max_bs[ddir] % lba_size) {
+                               if (data->lba_ext) {
+                                       log_err("%s: block size must be a multiple of %u "
+                                               "(LBA data size + Metadata size)\n", f->file_name, lba_size);
+                                       if (td->o.min_bs[ddir] == td->o.max_bs[ddir] &&
+                                           !(td->o.min_bs[ddir] % data->lba_size)) {
+                                               /* fixed block size is actually a multiple of LBA data size */
+                                               unsigned long long suggestion = lba_size *
+                                                       (td->o.min_bs[ddir] / data->lba_size);
+                                               log_err("Did you mean to use a block size of %llu?\n", suggestion);
+                                       }
+                               } else {
                                        log_err("%s: block size must be a multiple of LBA data size\n",
                                                f->file_name);
+                               }
                                td_verror(td, EINVAL, "fio_ioring_cmd_open_file");
                                return 1;
                        }