Porting IO Ring to linux by implementing io_uring

This commit is contained in:
2026-04-15 21:03:54 +01:00
parent 0294498538
commit f9f2303173
10 changed files with 1231 additions and 295 deletions

View File

@@ -87,7 +87,7 @@ int main(int argc, char **argv) {
printf(" Selected instruction set: %s\n", get_xxhash_instruction_set());
// Align IO Ring block size to the system page size
g_ioring_buffer_size = ALIGN_UP_POW2(IORING_BUFFER_SIZE, g_pagesize);
g_ioring_buffer_size = ALIGN_UP_POW2(g_ioring_buffer_size, g_pagesize);
// -------------------------------
// Scanning and hashing
// -------------------------------
@@ -253,7 +253,7 @@ int main(int argc, char **argv) {
FILE *f = fopen(FILE_HASHES_TXT, "wb");
for (int i = 0; i < num_threads; i++) {
for (int i = 0; i < num_hash_threads; i++) {
mem_arena *arena = workers[i].arena;
u8 *arena_base =
(u8 *)arena + ALIGN_UP_POW2(sizeof(mem_arena), arena->align);
@@ -265,14 +265,13 @@ int main(int argc, char **argv) {
// -------------------------------
// Print summary
// -------------------------------
// DEBUG
uint64_t incomplete = atomic_load(&g_io_ring_fallbacks);
if (incomplete > 0) {
printf(
"\nI/O Ring incomplete files: %llu (fallback to buffered I/O used)\n",
(unsigned long long)incomplete);
printf("\nWARNING: I/O Ring incomplete files: %llu (fallback to buffered "
"I/O used)\n",
(unsigned long long)incomplete);
}
//
double total_seconds = timer_elapsed(&total_timer);
printf("Completed hashing %zu files\n", total_found);