Skip to content

Commit

Permalink
libublk: fix max cmd buffer size calculation on 64K page size
Browse files Browse the repository at this point in the history
Signed-off-by: Ming Lei <[email protected]>
  • Loading branch information
ming1 committed Nov 13, 2024
1 parent 6217cde commit 6e12284
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,15 +506,13 @@ impl UblkQueue<'_> {
let depth = dev.dev_info.queue_depth as u32;
let cdev_fd = dev.cdev_file.as_raw_fd();
let cmd_buf_sz = UblkQueue::cmd_buf_sz(depth) as usize;
let max_cmd_buf_sz = UblkQueue::cmd_buf_sz(sys::UBLK_MAX_QUEUE_DEPTH) as libc::off_t;

ring.submitter()
.register_files(&tgt.fds[0..tgt.nr_fds as usize])?;

let off = sys::UBLKSRV_CMD_BUF_OFFSET as libc::off_t
+ q_id as libc::off_t
* ((sys::UBLK_MAX_QUEUE_DEPTH as usize
* core::mem::size_of::<sys::ublksrv_io_desc>())
as libc::off_t);
let off =
sys::UBLKSRV_CMD_BUF_OFFSET as libc::off_t + (q_id as libc::off_t) * max_cmd_buf_sz;
let io_cmd_buf = unsafe {
libc::mmap(
std::ptr::null_mut::<libc::c_void>(),
Expand Down

0 comments on commit 6e12284

Please sign in to comment.