Skip to content

Commit

Permalink
rename writeUsingIOUring to canWriteUsingIOUring.
Browse files Browse the repository at this point in the history
Signed-off-by: Lipeng Zhu <[email protected]>
  • Loading branch information
lipzhu committed Jun 12, 2024
1 parent 8e58ad4 commit a08c6eb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ void initIOUring(void) {
}
}

int writeUsingIOUring(client *c) {
int canWriteUsingIOUring(client *c) {
if (server.io_uring_enabled && server.io_uring) {
/* Currently, we only use io_uring to handle the static buffer write requests. */
return getClientType(c) != CLIENT_TYPE_SLAVE && listLength(c->reply) == 0 && c->bufpos > 0;
return getClientType(c) != CLIENT_TYPE_REPLICA && listLength(c->reply) == 0 && c->bufpos > 0;
}
return 0;
}
Expand Down Expand Up @@ -98,7 +98,7 @@ int checkPendingIOUringWriteState(client *c) {
* as an interaction, since we always send REPLCONF ACK commands
* that take some time to just fill the socket output buffer.
* We just rely on data / pings received for timeout detection. */
if (!(c->flags & CLIENT_MASTER)) c->lastinteraction = server.unixtime;
if (!(c->flags & CLIENT_TYPE_PRIMARY)) c->last_interaction = server.unixtime;

return C_OK;
}
Expand Down Expand Up @@ -143,7 +143,7 @@ void freeIOUring(void) {
void initIOUring(void) {
}

int writeUsingIOUring(client *c) {
int canWriteUsingIOUring(client *c) {
UNUSED(c);
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions src/io_uring.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
void initIOUring(void);

/* If the client is suitable to use io_uring handle the write request. */
int writeUsingIOUring(client *c);
int canWriteUsingIOUring(client *c);

/* Use io_uring to handle the client request, it is always used together with writeUsingIOUring(). */
/* Use io_uring to handle the client request, it is always used together with canWriteUsingIOUring(). */
int writeToClientUsingIOUring(client *c);

/* Submit requests to the submission queue and wait for completion. */
Expand Down
2 changes: 1 addition & 1 deletion src/networking.c
Original file line number Diff line number Diff line change
Expand Up @@ -2054,7 +2054,7 @@ int handleClientsWithPendingWrites(void) {

/* If user turn on io_uring and system support it, give io_uring a chance.
* We can use io_uring to batch submit to reduce the count of syscall. */
if (writeUsingIOUring(c)) {
if (canWriteUsingIOUring(c)) {
if (writeToClientUsingIOUring(c) == C_ERR) {
listUnlinkNode(server.clients_pending_write, ln);
continue;
Expand Down

0 comments on commit a08c6eb

Please sign in to comment.