Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ fn __lo_make_io_sqe_zc(
let bytes = iod.nr_sectors << 9;

match op {
libublk::sys::UBLK_IO_OP_FLUSH => opcode::SyncFileRange::new(types::Fixed(1), bytes)
.offset(off)
libublk::sys::UBLK_IO_OP_FLUSH => opcode::Fsync::new(types::Fixed(1))
.build()
.flags(squeue::Flags::FIXED_FILE),
libublk::sys::UBLK_IO_OP_READ => {
Expand Down
25 changes: 19 additions & 6 deletions tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ mod integration {
__test_ublk_add_del_zoned(4096, 1, None, false, tf);
}

fn __test_ublk_add_del_loop<F>(bs: u32, aa: bool, recover: bool, f: F)
fn __test_ublk_add_del_loop<F>(bs: u32, aa: bool, recover: bool, zc: bool, f: F)
where
F: Fn(&UblkCtrl, u32, usize, &str),
{
Expand All @@ -398,6 +398,9 @@ mod integration {
if recover {
cmd_line.push("-r");
}
if zc {
cmd_line.push("--zero-copy");
}

let ctrl = run_rublk_add_dev(cmd_line);
f(&ctrl, bs, file_size.try_into().unwrap(), pstr);
Expand All @@ -414,8 +417,8 @@ mod integration {
check_block_size(ctrl, bs);
};

__test_ublk_add_del_loop(4096, false, false, tf);
__test_ublk_add_del_loop(4096, true, false, tf);
__test_ublk_add_del_loop(4096, false, false, false, tf);
__test_ublk_add_del_loop(4096, true, false, false, tf);
}

fn __test_ublk_null_read_only(cmds: &[&str], exp_ro: bool) {
Expand Down Expand Up @@ -481,7 +484,17 @@ mod integration {
if !support_ublk() {
return;
}
__test_ublk_add_del_loop(4096, true, false, |ctrl, _bs, _file_size, _path| {
__test_ublk_add_del_loop(4096, true, false, false, |ctrl, _bs, _file_size, _path| {
ext4_format_and_mount(ctrl);
});
}

#[test]
fn test_ublk_format_mount_loop_zero_copy() {
if !support_ublk() {
return;
}
__test_ublk_add_del_loop(4096, true, false, true, |ctrl, _bs, _file_size, _path| {
ext4_format_and_mount(ctrl);
});
}
Expand Down Expand Up @@ -552,7 +565,7 @@ mod integration {
if !support_ublk() {
return;
}
__test_ublk_add_del_loop(4096, true, true, |ctrl, _bs, _file_size, _path| {
__test_ublk_add_del_loop(4096, true, true, false, |ctrl, _bs, _file_size, _path| {
run_ublk_recover(ctrl);
});
}
Expand Down Expand Up @@ -685,7 +698,7 @@ mod integration {
return;
}

__test_ublk_add_del_loop(4096, false, false, |ctrl, _, _, file_path| {
__test_ublk_add_del_loop(4096, false, false, false, |ctrl, _, _, file_path| {
let dev_path = ctrl.get_bdev_path();

// 1. write dev with random data
Expand Down