Skip to content

Commit

Permalink
libublk: loglevel: adjust log level
Browse files Browse the repository at this point in the history
All logging in uring_async.rs should be log::trace!().

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
  • Loading branch information
ming1 committed Mar 5, 2024
1 parent dcaa57b commit ebcde0c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
3 changes: 1 addition & 2 deletions examples/loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use libublk::helpers::IoBuf;
use libublk::io::{UblkDev, UblkIOCtx, UblkQueue};
use libublk::uring_async::ublk_wait_and_handle_ios;
use libublk::{ctrl::UblkCtrl, sys, UblkError, UblkFlags, UblkIORes};
use log::trace;
use serde::Serialize;
use std::os::unix::fs::FileTypeExt;
use std::os::unix::io::AsRawFd;
Expand Down Expand Up @@ -82,7 +81,7 @@ fn lo_file_size(f: &std::fs::File) -> Result<(u64, u8, u8)> {

// setup loop target
fn lo_init_tgt(dev: &mut UblkDev, lo: &LoopTgt) -> Result<(), UblkError> {
trace!("loop: init_tgt {}", dev.dev_info.dev_id);
log::info!("loop: init_tgt {}", dev.dev_info.dev_id);
if lo.direct_io != 0 {
unsafe {
libc::fcntl(lo.back_file.as_raw_fd(), libc::F_SETFL, libc::O_DIRECT);
Expand Down
2 changes: 1 addition & 1 deletion src/ctrl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ impl UblkCtrlInner {
dev.read_dev_info()?;
}

trace!(
log::info!(
"ctrl: device {} flags {:x} created",
dev.dev_info.dev_id,
dev.dev_flags
Expand Down
4 changes: 2 additions & 2 deletions src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ impl UblkQueue<'_> {
let empty = self.q_ring.borrow_mut().submission().is_empty();

if empty && state.get_nr_cmd_inflight() == self.q_depth && !state.is_idle() {
log::trace!(
log::debug!(
"dev {} queue {} becomes idle",
self.dev.dev_info.dev_id,
self.q_id
Expand All @@ -1021,7 +1021,7 @@ impl UblkQueue<'_> {
let idle = { self.state.borrow().is_idle() };

if idle {
log::trace!(
log::debug!(
"dev {} queue {} becomes busy",
self.dev.dev_info.dev_id,
self.q_id
Expand Down
10 changes: 5 additions & 5 deletions src/uring_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl UblkUringOpFuture {
result: None,
});
let user_data = ((key as u32) << 16) as u64 | tgt_io;
log::debug!("uring: new future {:x}", user_data);
log::trace!("uring: new future {:x}", user_data);
UblkUringOpFuture { user_data }
})
}
Expand All @@ -49,18 +49,18 @@ impl Future for UblkUringOpFuture {
let key = ((self.user_data & !(1_u64 << 63)) >> 16) as usize;
match map.get_mut(key) {
None => {
log::debug!("uring: null slab {:x}", self.user_data);
log::trace!("uring: null slab {:x}", self.user_data);
Poll::Pending
}
Some(fd) => match fd.result {
Some(result) => {
map.remove(key);
log::debug!("uring: uring io ready userdata {:x} ready", self.user_data);
log::trace!("uring: uring io ready userdata {:x} ready", self.user_data);
Poll::Ready(result)
}
None => {
fd.waker = Some(cx.waker().clone());
log::debug!("uring: uring io pending userdata {:x}", self.user_data);
log::trace!("uring: uring io pending userdata {:x}", self.user_data);
Poll::Pending
}
},
Expand All @@ -77,7 +77,7 @@ pub fn ublk_wake_task(data: u64, cqe: &cqueue::Entry) {
MY_SLAB.with(|refcell| {
let mut map = refcell.borrow_mut();

log::debug!(
log::trace!(
"ublk_wake_task: data {:x} user_data {:x} result {:x}",
data,
cqe.user_data(),
Expand Down

0 comments on commit ebcde0c

Please sign in to comment.