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
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test-latest-kernel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- "**.md"

env:
KERNEL_ARCHIVE_URL: "https://cdn.kernel.org/pub/linux/kernel/v7.x/linux-7.0.3.tar.xz"
KERNEL_ARCHIVE_URL: "https://cdn.kernel.org/pub/linux/kernel/v7.x/linux-7.1.2.tar.xz"

jobs:
build-and-test:
Expand Down
23 changes: 1 addition & 22 deletions include/condy/provided_buffers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,6 @@ class BundledProvidedBufferQueue {
.num_buffers = 0,
};

#if !IO_URING_CHECK_VERSION(2, 8) // >= 2.8
if (flags & IORING_CQE_F_BUF_MORE) {
assert(buf_lens_[result.bid] > static_cast<uint32_t>(res));
buf_lens_[result.bid] -= res;
return result;
}
#endif

bool is_incr = false;
#if !IO_URING_CHECK_VERSION(2, 8) // >= 2.8
is_incr = br_flags_ & IOU_PBUF_RING_INC;
Expand Down Expand Up @@ -335,19 +327,6 @@ class BundledProvidedBufferPool {

assert(res > 0);

uint16_t bid = flags >> IORING_CQE_BUFFER_SHIFT;

#if !IO_URING_CHECK_VERSION(2, 8) // >= 2.8
if (flags & IORING_CQE_F_BUF_MORE) {
char *data = get_buffer_(bid) + (buffer_size_ - curr_buf_len_);
buffers.emplace_back(data, res, nullptr);
assert(static_cast<uint32_t>(res) < curr_buf_len_);
curr_buf_len_ -= res;
return buffers;
}
#endif
assert(bid == curr_io_uring_buf_()->bid);

bool is_incr = false;
#if !IO_URING_CHECK_VERSION(2, 8) // >= 2.8
is_incr = br_flags_ & IOU_PBUF_RING_INC;
Expand All @@ -356,7 +335,7 @@ class BundledProvidedBufferPool {
int64_t bytes = res;
while (bytes > 0) {
auto *buf_ptr = curr_io_uring_buf_();
bid = buf_ptr->bid;
uint16_t bid = buf_ptr->bid;

char *data = get_buffer_(bid) + (buffer_size_ - curr_buf_len_);
uint32_t buf_len;
Expand Down
91 changes: 47 additions & 44 deletions tests/test_async_operations.4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -824,50 +824,53 @@ TEST_CASE("test async_operations - test ftruncate - fixed fd") {
}
#endif

#if !IO_URING_CHECK_VERSION(2, 8) // >= 2.8
TEST_CASE("test async_operations - test cmd_discard - basic") {
BlkDevice blkdev;
if (blkdev.path().empty()) {
MESSAGE("Can't create loop device, skipping");
return;
}

int fd = open(blkdev.path().c_str(), O_RDWR);
REQUIRE(fd >= 0);

auto func = [&]() -> condy::Coro<void> {
int r = co_await condy::async_cmd_discard(fd, 0, 4096);
REQUIRE(r == 0);
};
condy::sync_wait(func());
close(fd);
}
#endif

#if !IO_URING_CHECK_VERSION(2, 8) // >= 2.8
TEST_CASE("test async_operations - test cmd_discard - fixed fd") {
BlkDevice blkdev;
if (blkdev.path().empty()) {
MESSAGE("Can't create loop device, skipping");
return;
}

int fd = open(blkdev.path().c_str(), O_RDWR);
REQUIRE(fd >= 0);

auto func = [&]() -> condy::Coro<void> {
auto &fd_table = condy::current_runtime().fd_table();
fd_table.init(1);
int r = co_await condy::async_files_update(&fd, 1, 0);
REQUIRE(r == 1);

r = co_await condy::async_cmd_discard(condy::fixed(0), 0, 4096);
REQUIRE(r == 0);
};
condy::sync_wait(func());
close(fd);
}
#endif
// TODO: Kernel 7.1 regression, uncomment after fixed
// https://lore.kernel.org/linux-block/20260616155129.406057-1-yi1tang.yang@gmail.com/
//
// #if !IO_URING_CHECK_VERSION(2, 8) // >= 2.8
// TEST_CASE("test async_operations - test cmd_discard - basic") {
// BlkDevice blkdev;
// if (blkdev.path().empty()) {
// MESSAGE("Can't create loop device, skipping");
// return;
// }

// int fd = open(blkdev.path().c_str(), O_RDWR);
// REQUIRE(fd >= 0);

// auto func = [&]() -> condy::Coro<void> {
// int r = co_await condy::async_cmd_discard(fd, 0, 4096);
// REQUIRE(r == 0);
// };
// condy::sync_wait(func());
// close(fd);
// }
// #endif

// #if !IO_URING_CHECK_VERSION(2, 8) // >= 2.8
// TEST_CASE("test async_operations - test cmd_discard - fixed fd") {
// BlkDevice blkdev;
// if (blkdev.path().empty()) {
// MESSAGE("Can't create loop device, skipping");
// return;
// }

// int fd = open(blkdev.path().c_str(), O_RDWR);
// REQUIRE(fd >= 0);

// auto func = [&]() -> condy::Coro<void> {
// auto &fd_table = condy::current_runtime().fd_table();
// fd_table.init(1);
// int r = co_await condy::async_files_update(&fd, 1, 0);
// REQUIRE(r == 1);

// r = co_await condy::async_cmd_discard(condy::fixed(0), 0, 4096);
// REQUIRE(r == 0);
// };
// condy::sync_wait(func());
// close(fd);
// }
// #endif

#if !IO_URING_CHECK_VERSION(2, 7) // >= 2.7
TEST_CASE("test async_operations - test bind - basic") {
Expand Down
Loading