This commit is contained in:
2025-11-07 22:45:40 +01:00
parent 8ab426770f
commit be2479b2be
+19 -9
View File
@@ -1007,7 +1007,7 @@ static int start_upload(TinyDFS *tdfs, int opidx)
{
int found = -1;
// Find a PENDING operation that can be started
// Find a WAITING operation that can be started
for (int i = 0; i < tdfs->operations[opidx].num_uploads; i++) {
if (tdfs->operations[opidx].uploads[i].status != UPLOAD_WAITING)
@@ -1021,6 +1021,9 @@ static int start_upload(TinyDFS *tdfs, int opidx)
if (j == i)
continue;
if (tdfs->operations[opidx].uploads[j].status != UPLOAD_PENDING)
continue;
if (tdfs->operations[opidx].uploads[i].server_lid == tdfs->operations[opidx].uploads[j].server_lid ||
addr_eql(tdfs->operations[opidx].uploads[i].address, tdfs->operations[opidx].uploads[j].address)) {
invalid = true;
@@ -1047,7 +1050,7 @@ static int start_upload(TinyDFS *tdfs, int opidx)
return -1;
RequestQueue *reqs = &tdfs->chunk_servers[chunk_server_idx].reqs;
if (!request_queue_push(reqs, (Request) { tag, opidx })) {
if (request_queue_push(reqs, (Request) { tag, opidx }) < 0) {
close_chunk_server(tdfs, chunk_server_idx);
return -1;
}
@@ -1268,7 +1271,8 @@ static void process_event_for_write(TinyDFS *tdfs,
upload.off = off;
upload.len = len;
if (schedule_upload(tdfs, opidx, upload) < 0) {
// TODO
tdfs->operations[opidx].result = (TinyDFS_Result) { .type=TINYDFS_RESULT_WRITE_ERROR };
return;
}
}
@@ -1303,8 +1307,10 @@ static void process_event_for_write(TinyDFS *tdfs,
upload.off = off;
upload.len = len;
if (schedule_upload(tdfs, opidx, upload) < 0) {
// TODO
} }
tdfs->operations[opidx].result = (TinyDFS_Result) { .type=TINYDFS_RESULT_WRITE_ERROR };
return;
}
}
}
}
@@ -1366,8 +1372,10 @@ static void process_event_for_write(TinyDFS *tdfs,
upload.off = off;
upload.len = len;
if (schedule_upload(tdfs, opidx, upload) < 0) {
// TODO
} }
tdfs->operations[opidx].result = (TinyDFS_Result) { .type=TINYDFS_RESULT_WRITE_ERROR };
return;
}
}
relative_off = old_relative_off;
}
@@ -1419,8 +1427,10 @@ static void process_event_for_write(TinyDFS *tdfs,
upload.off = off;
upload.len = len;
if (schedule_upload(tdfs, opidx, upload) < 0) {
// TODO
} }
tdfs->operations[opidx].result = (TinyDFS_Result) { .type=TINYDFS_RESULT_WRITE_ERROR };
return;
}
}
relative_off = old_relative_off;
}