Skip to content

Commit

Permalink
engines/io_uring_cmd: friendlier bad bs error msg
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
vincentkfu committed Dec 11, 2023
1 parent bdf99b6 commit 3cb5053
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions engines/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 3cb5053

Please sign in to comment.