This is an automated email from the git hooks/post-receive script.
teigland pushed a commit to branch caw-1
in repository sanlock.
commit e4d9bd9481edb3e2a70c9c55f19857176ab87a69
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Jan 14 16:14:48 2026 -0600
diskio: pass use_aio arg to io functions
should be no functional change, the callers all pass task->use_aio
which is what the diskio functions used
---
src/delta_lease.c | 30 +++++++++++++++---------------
src/direct.c | 6 +++---
src/diskio.c | 36 ++++++++++++++++++++----------------
src/diskio.h | 12 ++++++------
src/paxos_lease.c | 30 +++++++++++++++---------------
src/resource.c | 8 ++++----
src/rindex.c | 10 +++++-----
src/sanlock_internal.h | 3 +++
src/sanlock_rv.h | 1 +
9 files changed, 72 insertions(+), 64 deletions(-)
diff --git a/src/delta_lease.c b/src/delta_lease.c
index ba841be..c017855 100644
--- a/src/delta_lease.c
+++ b/src/delta_lease.c
@@ -137,7 +137,7 @@ static int verify_leader(struct sync_disk *disk,
rv = read_sector(disk, lr->sector_size, host_id - 1, (char *)&leader_end,
sizeof(struct leader_record),
- NULL, "delta_verify");
+ NULL, NO_AIO, "delta_verify");
leader_record_in(&leader_end, &leader_rr);
@@ -167,7 +167,7 @@ int delta_read_lockspace(struct task *task,
memset(&leader_end, 0, sizeof(struct leader_record));
rv = read_sector(disk, sector_size, host_id - 1, (char *)&leader_end, sizeof(struct leader_record),
- task, io_timeout, "read_lockspace");
+ task, task->use_aio, io_timeout, "read_lockspace");
if (rv < 0)
return rv;
@@ -232,7 +232,7 @@ int delta_read_lockspace_sizes(struct task *task,
host_id = 1;
rv = read_sector(disk, 512, host_id - 1, (char *)&leader_end, sizeof(struct leader_record),
- task, io_timeout, "read_lockspace_sector_size");
+ task, task->use_aio, io_timeout, "read_lockspace_sector_size");
if (rv < 0)
goto next;
@@ -260,7 +260,7 @@ int delta_read_lockspace_sizes(struct task *task,
next:
rv = read_sector(disk, 4096, host_id - 1, (char *)&leader_end, sizeof(struct leader_record),
- task, io_timeout, "read_lockspace_sector_size");
+ task, task->use_aio, io_timeout, "read_lockspace_sector_size");
if (rv < 0)
return rv;
@@ -310,7 +310,7 @@ int delta_lease_leader_read(struct task *task, int sector_size, int io_timeout,
memset(leader_ret, 0, sizeof(struct leader_record));
rv = read_sector(disk, sector_size, host_id - 1, (char *)&leader_end, sizeof(struct leader_record),
- task, io_timeout, "delta_leader");
+ task, task->use_aio, io_timeout, "delta_leader");
if (rv < 0)
return rv;
@@ -348,7 +348,7 @@ int delta_lease_leader_clobber(struct task *task, int io_timeout,
leader_end.checksum = cpu_to_le32(checksum);
rv = write_sector(disk, leader->sector_size, host_id - 1, (char *)&leader_end, sizeof(struct leader_record),
- task, io_timeout, caller);
+ task, task->use_aio, io_timeout, caller);
if (rv < 0)
return rv;
return SANLK_OK;
@@ -675,7 +675,7 @@ int delta_lease_acquire(struct task *task,
leader_end.checksum = cpu_to_le32(checksum);
rv = write_sector(disk, sp->sector_size, host_id - 1, (char *)&leader_end, sizeof(struct leader_record),
- task, sp->io_timeout, "delta_leader");
+ task, task->use_aio, sp->io_timeout, "delta_leader");
if (rv < 0) {
log_space(sp, "delta_acquire write error %d", rv);
return rv;
@@ -895,7 +895,7 @@ int delta_lease_renew(struct task *task,
if (log_renewal_level != -1)
log_level(sp->space_id, 0, NULL, log_renewal_level, "delta_renew begin read");
- rv = read_iobuf(disk->fd, disk->offset, task->iobuf, read_len, task, sp->io_timeout, rd_ms);
+ rv = read_iobuf(disk->fd, disk->offset, task->iobuf, read_len, task, task->use_aio, sp->io_timeout, rd_ms);
if (rv) {
/* the next time delta_lease_renew() is called, prev_result
will be this rv. If this rv is SANLK_AIO_TIMEOUT, we'll
@@ -1031,7 +1031,7 @@ write_renew:
out. there's nothing we would do but retry it, and timing out and
retrying unnecessarily would probably be counter productive. */
- rv = write_iobuf(disk->fd, disk->offset+id_offset, wbuf, sector_size, task,
+ rv = write_iobuf(disk->fd, disk->offset+id_offset, wbuf, sector_size, task, task->use_aio,
calc_host_dead_seconds(sp->io_timeout), wr_ms);
if (rv != SANLK_AIO_TIMEOUT)
@@ -1091,7 +1091,7 @@ int delta_lease_release(struct task *task,
leader_end.checksum = cpu_to_le32(checksum);
rv = write_sector(disk, sp->sector_size, host_id - 1, (char *)&leader_end, sizeof(struct leader_record),
- task, sp->io_timeout, "delta_leader");
+ task, task->use_aio, sp->io_timeout, "delta_leader");
if (rv < 0) {
log_space(sp, "delta_release write error %d", rv);
return rv;
@@ -1203,7 +1203,7 @@ int delta_lease_init_host(struct task *task,
offset = disk->offset + (sector_size * (ls->host_id - 1));
- rv = write_iobuf(disk->fd, offset, iobuf, iobuf_len, task, write_io_timeout, NULL);
+ rv = write_iobuf(disk->fd, offset, iobuf, iobuf_len, task, task->use_aio, write_io_timeout, NULL);
if (rv < 0)
goto out;
out:
@@ -1307,7 +1307,7 @@ int delta_lease_init(struct task *task,
else
write_io_timeout = io_timeout;
- rv = write_iobuf(disk->fd, disk->offset, iobuf, iobuf_len, task, write_io_timeout, NULL);
+ rv = write_iobuf(disk->fd, disk->offset, iobuf, iobuf_len, task, task->use_aio, write_io_timeout, NULL);
if (rv < 0)
goto out;
@@ -1327,7 +1327,7 @@ int delta_lease_init(struct task *task,
memcpy(iobuf, &leader_end, sizeof(struct leader_record));
- rv = write_iobuf(disk->fd, disk->offset, iobuf, sector_size, task, write_io_timeout, NULL);
+ rv = write_iobuf(disk->fd, disk->offset, iobuf, sector_size, task, task->use_aio, write_io_timeout, NULL);
out:
if (rv != SANLK_AIO_TIMEOUT)
free(iobuf);
@@ -1382,7 +1382,7 @@ int delta_lease_update_lockspace(struct task *task,
memset(iobuf, 0, iobuf_len);
- rv = read_iobuf(disk->fd, disk->offset, iobuf, iobuf_len, task, io_timeout, NULL);
+ rv = read_iobuf(disk->fd, disk->offset, iobuf, iobuf_len, task, task->use_aio, io_timeout, NULL);
if (rv < 0)
goto out;
@@ -1420,7 +1420,7 @@ int delta_lease_update_lockspace(struct task *task,
else
write_io_timeout = io_timeout;
- rv = write_iobuf(disk->fd, disk->offset, iobuf, iobuf_len, task, write_io_timeout, NULL);
+ rv = write_iobuf(disk->fd, disk->offset, iobuf, iobuf_len, task, task->use_aio, write_io_timeout, NULL);
if (rv < 0)
goto out;
diff --git a/src/direct.c b/src/direct.c
index fe44097..f9f5b4a 100644
--- a/src/direct.c
+++ b/src/direct.c
@@ -55,7 +55,7 @@ static int direct_read_leader_sizes(struct task *task, struct sync_disk *sd,
memset(data, 0, datalen);
- rv = read_sector(sd, 4096, 0, data, datalen, task, com.io_timeout, "read_sector_size");
+ rv = read_sector(sd, 4096, 0, data, datalen, task, task->use_aio, com.io_timeout, "read_sector_size");
if (rv < 0) {
free(data);
return rv;
@@ -767,7 +767,7 @@ int direct_dump(struct task *task, char *dump_path, int force_mode)
memset(data, 0, sector_size);
rv = read_sectors(&sd, sector_size, sector_nr, sector_count, data, datalen,
- task, com.io_timeout, "dump");
+ task, task->use_aio, com.io_timeout, "dump");
magic_in(data, &magic);
@@ -968,7 +968,7 @@ int direct_next_free(struct task *task, char *path)
memset(data, 0, sector_size);
rv = read_sector(&sd, sector_size, sector_nr, data, datalen,
- task, com.io_timeout, "next_free");
+ task, task->use_aio, com.io_timeout, "next_free");
lr_end = (struct leader_record *)data;
diff --git a/src/diskio.c b/src/diskio.c
index a67f4c2..5e51322 100644
--- a/src/diskio.c
+++ b/src/diskio.c
@@ -816,18 +816,20 @@ static int do_read_aio_linux(int fd, uint64_t offset, char *buf, int len,
/* write aligned io buffer */
int write_iobuf(int fd, uint64_t offset, char *iobuf, int iobuf_len,
- struct task *task, int ioto, int *wr_ms)
+ struct task *task, int use_aio, int ioto, int *wr_ms)
{
- if (task && task->use_aio)
+ if (use_aio == USE_AIO)
return do_write_aio_linux(fd, offset, iobuf, iobuf_len, task, ioto, wr_ms);
- else
+ else if (use_aio == NO_AIO)
return do_write(fd, offset, iobuf, iobuf_len, task, wr_ms);
+ else
+ return -SANLK_IOTYPE;
}
static int _write_sectors(const struct sync_disk *disk, int sector_size, uint64_t sector_nr,
uint32_t sector_count GNUC_UNUSED,
const char *data, int data_len, int iobuf_len,
- struct task *task, int ioto,
+ struct task *task, int use_aio, int ioto,
const char *blktype)
{
char *iobuf, **p_iobuf;
@@ -849,7 +851,7 @@ static int _write_sectors(const struct sync_disk *disk, int sector_size, uint64_
memset(iobuf, 0, iobuf_len);
memcpy(iobuf, data, data_len);
- rv = write_iobuf(disk->fd, offset, iobuf, iobuf_len, task, ioto, NULL);
+ rv = write_iobuf(disk->fd, offset, iobuf, iobuf_len, task, use_aio, ioto, NULL);
if (rv < 0) {
log_error("write_sectors %s offset %llu rv %d %s",
blktype, (unsigned long long)offset, rv, disk->path);
@@ -868,7 +870,7 @@ static int _write_sectors(const struct sync_disk *disk, int sector_size, uint64_
int write_sector(const struct sync_disk *disk, int sector_size, uint64_t sector_nr,
const char *data, int data_len,
- struct task *task, int ioto,
+ struct task *task, int use_aio, int ioto,
const char *blktype)
{
int iobuf_len = sector_size;
@@ -885,14 +887,14 @@ int write_sector(const struct sync_disk *disk, int sector_size, uint64_t sector_
}
return _write_sectors(disk, sector_size, sector_nr, 1, data, data_len,
- iobuf_len, task, ioto, blktype);
+ iobuf_len, task, use_aio, ioto, blktype);
}
/* write multiple complete sectors, data_len must be multiple of sector size */
int write_sectors(const struct sync_disk *disk, int sector_size, uint64_t sector_nr,
uint32_t sector_count, const char *data, int data_len,
- struct task *task, int ioto,
+ struct task *task, int use_aio, int ioto,
const char *blktype)
{
int iobuf_len = data_len;
@@ -909,18 +911,20 @@ int write_sectors(const struct sync_disk *disk, int sector_size, uint64_t sector
}
return _write_sectors(disk, sector_size, sector_nr, sector_count, data, data_len,
- iobuf_len, task, ioto, blktype);
+ iobuf_len, task, use_aio, ioto, blktype);
}
/* read aligned io buffer */
int read_iobuf(int fd, uint64_t offset, char *iobuf, int len,
- struct task *task, int ioto, int *rd_ms)
+ struct task *task, int use_aio, int ioto, int *rd_ms)
{
- if (task && task->use_aio)
+ if (use_aio == USE_AIO)
return do_read_aio_linux(fd, offset, iobuf, len, task, ioto, rd_ms);
- else
+ else if (use_aio == NO_AIO)
return do_read(fd, offset, iobuf, len, task, rd_ms);
+ else
+ return -SANLK_IOTYPE;
}
/* read sector_count sectors starting with sector_nr, where sector_nr
@@ -931,7 +935,7 @@ int read_iobuf(int fd, uint64_t offset, char *iobuf, int len,
int read_sectors(const struct sync_disk *disk, int sector_size, uint64_t sector_nr,
uint32_t sector_count, char *data, int data_len,
- struct task *task, int ioto,
+ struct task *task, int use_aio, int ioto,
const char *blktype)
{
char *iobuf, **p_iobuf;
@@ -959,7 +963,7 @@ int read_sectors(const struct sync_disk *disk, int sector_size, uint64_t sector_
memset(iobuf, 0, iobuf_len);
- rv = read_iobuf(disk->fd, offset, iobuf, iobuf_len, task, ioto, NULL);
+ rv = read_iobuf(disk->fd, offset, iobuf, iobuf_len, task, use_aio, ioto, NULL);
if (!rv) {
memcpy(data, iobuf, data_len);
} else {
@@ -975,11 +979,11 @@ int read_sectors(const struct sync_disk *disk, int sector_size, uint64_t sector_
int read_sector(const struct sync_disk *disk, int sector_size, uint64_t sector_nr,
char *data, int data_len,
- struct task *task, int ioto,
+ struct task *task, int use_aio, int ioto,
const char *blktype)
{
return read_sectors(disk, sector_size, sector_nr, 1,
- data, data_len, task, ioto, blktype);
+ data, data_len, task, use_aio, ioto, blktype);
}
/* Try to reap the event of a previously timed out read_iobuf.
diff --git a/src/diskio.h b/src/diskio.h
index 23c1143..d05ceec 100644
--- a/src/diskio.h
+++ b/src/diskio.h
@@ -29,10 +29,10 @@ int write_sysfs_uint(char *path, unsigned int val);
*/
int write_iobuf(int fd, uint64_t offset, char *iobuf, int iobuf_len,
- struct task *task, int ioto, int *wr_ms);
+ struct task *task, int use_aio, int ioto, int *wr_ms);
int read_iobuf(int fd, uint64_t offset, char *iobuf, int iobuf_len,
- struct task *task, int ioto, int *rd_ms);
+ struct task *task, int use_aio, int ioto, int *rd_ms);
int read_iobuf_reap(int fd, uint64_t offset, char *iobuf, int iobuf_len,
struct task *task, uint32_t ioto_msec);
@@ -44,22 +44,22 @@ int read_iobuf_reap(int fd, uint64_t offset, char *iobuf, int iobuf_len,
int write_sector(const struct sync_disk *disk, int sector_size, uint64_t sector_nr,
const char *data, int data_len,
- struct task *task, int ioto,
+ struct task *task, int use_aio, int ioto,
const char *blktype);
int write_sectors(const struct sync_disk *disk, int sector_size, uint64_t sector_nr,
uint32_t sector_count, const char *data, int data_len,
- struct task *task, int ioto,
+ struct task *task, int use_aio, int ioto,
const char *blktype);
int read_sectors(const struct sync_disk *disk, int sector_size, uint64_t sector_nr,
uint32_t sector_count, char *data, int data_len,
- struct task *task, int ioto,
+ struct task *task, int use_aio, int ioto,
const char *blktype);
int read_sector(const struct sync_disk *disk, int sector_size, uint64_t sector_nr,
char *data, int data_len,
- struct task *task, int ioto,
+ struct task *task, int use_aio, int ioto,
const char *blktype);
#endif
diff --git a/src/paxos_lease.c b/src/paxos_lease.c
index 3349af9..0c4f9cc 100644
--- a/src/paxos_lease.c
+++ b/src/paxos_lease.c
@@ -115,7 +115,7 @@ int paxos_lease_request_read(struct task *task, struct token *token,
rv = read_sector(&token->disks[0], token->sector_size, 1, (char *)&rr_end,
sizeof(struct request_record),
- task, token->io_timeout, "request");
+ task, task->use_aio, token->io_timeout, "request");
if (rv < 0)
return rv;
@@ -134,7 +134,7 @@ int paxos_lease_request_write(struct task *task, struct token *token,
rv = write_sector(&token->disks[0], token->sector_size, 1, (char *)&rr_end,
sizeof(struct request_record),
- task, token->io_timeout, "request");
+ task, task->use_aio, token->io_timeout, "request");
if (rv < 0)
return rv;
@@ -231,7 +231,7 @@ static int write_dblock_mblock_sh(struct task *task,
memcpy(iobuf, (char *)&pd_end, sizeof(struct paxos_dblock));
memcpy(iobuf + MBLOCK_OFFSET, (char *)&mb_end, sizeof(struct mode_block));
- rv = write_iobuf(disk->fd, offset, iobuf, iobuf_len, task, token->io_timeout, NULL);
+ rv = write_iobuf(disk->fd, offset, iobuf, iobuf_len, task, task->use_aio, token->io_timeout, NULL);
if (rv < 0) {
log_errot(token, "write_dblock_mblock_sh host_id %llu gen %llu rv %d",
@@ -273,7 +273,7 @@ static int write_dblock(struct task *task,
pd_end.checksum = cpu_to_le32(checksum);
rv = write_sector(disk, token->sector_size, 2 + host_id - 1, (char *)&pd_end, sizeof(struct paxos_dblock),
- task, token->io_timeout, "dblock");
+ task, task->use_aio, token->io_timeout, "dblock");
return rv;
}
@@ -296,7 +296,7 @@ static int write_leader(struct task *task,
lr_end.checksum = cpu_to_le32(checksum);
rv = write_sector(disk, token->sector_size, 0, (char *)&lr_end, sizeof(struct leader_record),
- task, token->io_timeout, "leader");
+ task, task->use_aio, token->io_timeout, "leader");
return rv;
}
@@ -325,7 +325,7 @@ int paxos_lease_leader_clobber(struct task *task,
lr_end.checksum = cpu_to_le32(checksum);
rv = write_sector(&token->disks[0], token->sector_size, 0, (char *)&lr_end, sizeof(struct leader_record),
- task, token->io_timeout, caller);
+ task, task->use_aio, token->io_timeout, caller);
return rv;
}
@@ -341,7 +341,7 @@ static int read_dblock(struct task *task,
/* 1 leader block + 1 request block; host_id N is block offset N-1 */
rv = read_sector(disk, token->sector_size, 2 + host_id - 1, (char *)&pd_end, sizeof(struct paxos_dblock),
- task, token->io_timeout, "dblock");
+ task, task->use_aio, token->io_timeout, "dblock");
paxos_dblock_in(&pd_end, pd);
@@ -370,7 +370,7 @@ static int read_dblocks(struct task *task,
/* 2 = 1 leader block + 1 request block */
rv = read_sectors(disk, token->sector_size, 2, pds_count, data, data_len,
- task, "dblocks");
+ task, task->use_aio, token->io_timeout, "dblocks");
if (rv < 0)
goto out_free;
@@ -411,7 +411,7 @@ static int read_leader(struct task *task,
/* 0 = leader record is first sector */
rv = read_sector(disk, token->sector_size, 0, (char *)&lr_end, sizeof(struct leader_record),
- task, token->io_timeout, "leader");
+ task, task->use_aio, token->io_timeout, "leader");
/* N.B. checksum is computed while the data is in ondisk format. */
*checksum = leader_checksum(&lr_end);
@@ -626,7 +626,7 @@ static int run_ballot(struct task *task, struct token *token, uint32_t flags,
memset(iobuf, 0, read_len);
/* acquire io: read 2 (lease area) */
- rv = read_iobuf(disk->fd, disk->offset, iobuf, read_len, task, token->io_timeout, NULL);
+ rv = read_iobuf(disk->fd, disk->offset, iobuf, read_len, task, task->use_aio, token->io_timeout, NULL);
if (rv == SANLK_AIO_TIMEOUT) {
iobuf_array[d] = NULL;
if (use_task_hugebuf) {
@@ -851,7 +851,7 @@ static int run_ballot(struct task *task, struct token *token, uint32_t flags,
memset(iobuf, 0, read_len);
/* acquire io: read 3 (lease area) */
- rv = read_iobuf(disk->fd, disk->offset, iobuf, read_len, task, token->io_timeout, NULL);
+ rv = read_iobuf(disk->fd, disk->offset, iobuf, read_len, task, task->use_aio, token->io_timeout, NULL);
if (rv == SANLK_AIO_TIMEOUT) {
iobuf_array[d] = NULL;
if (use_task_hugebuf) {
@@ -1136,7 +1136,7 @@ static int _verify_leader(struct token *token,
rv = read_sector(disk, token->sector_size, 0, (char *)&leader_end,
sizeof(struct leader_record),
- NULL, 1, "paxos_verify");
+ NULL, NO_AIO, 1, "paxos_verify");
leader_record_in(&leader_end, &leader_rr);
@@ -1273,7 +1273,7 @@ int paxos_read_buf(struct task *task,
memset(iobuf, 0, iobuf_len);
- rv = read_iobuf(disk->fd, disk->offset, iobuf, iobuf_len, task, token->io_timeout, NULL);
+ rv = read_iobuf(disk->fd, disk->offset, iobuf, iobuf_len, task, task->use_aio, token->io_timeout, NULL);
*buf_out = iobuf;
@@ -1404,7 +1404,7 @@ static int _lease_read_one(struct task *task,
mem_done:
- rv = read_iobuf(disk->fd, disk->offset, iobuf, read_len, task, token->io_timeout, NULL);
+ rv = read_iobuf(disk->fd, disk->offset, iobuf, read_len, task, task->use_aio, token->io_timeout, NULL);
if (rv < 0)
goto out;
@@ -2639,7 +2639,7 @@ int paxos_lease_init(struct task *task,
write_io_timeout = token->io_timeout;
rv = write_iobuf(token->disks[d].fd, token->disks[d].offset,
- iobuf, iobuf_len, task, write_io_timeout, NULL);
+ iobuf, iobuf_len, task, task->use_aio, write_io_timeout, NULL);
if (rv == SANLK_AIO_TIMEOUT)
aio_timeout = 1;
diff --git a/src/resource.c b/src/resource.c
index de71962..321fec9 100644
--- a/src/resource.c
+++ b/src/resource.c
@@ -647,7 +647,7 @@ static int write_host_block(struct task *task, struct token *token,
offset = disk->offset + ((2 + host_id - 1) * token->sector_size);
- rv = write_iobuf(disk->fd, offset, iobuf, iobuf_len, task, token->io_timeout, NULL);
+ rv = write_iobuf(disk->fd, offset, iobuf, iobuf_len, task, task->use_aio, token->io_timeout, NULL);
if (rv < 0)
break;
}
@@ -729,7 +729,7 @@ static int read_mode_block(struct task *task, struct token *token,
offset = disk->offset + ((2 + host_id - 1) * token->sector_size);
- rv = read_iobuf(disk->fd, offset, iobuf, iobuf_len, task, token->io_timeout, NULL);
+ rv = read_iobuf(disk->fd, offset, iobuf, iobuf_len, task, task->use_aio, token->io_timeout, NULL);
if (rv < 0)
break;
@@ -846,7 +846,7 @@ static int read_lvb_block(struct task *task, struct token *token)
if (!r->lvb)
return 0;
- rv = read_iobuf(disk->fd, offset, iobuf, iobuf_len, task, token->io_timeout, NULL);
+ rv = read_iobuf(disk->fd, offset, iobuf, iobuf_len, task, task->use_aio, token->io_timeout, NULL);
/* for io timeout, lvb iobuf is freed when the aio completes, not by free_resource */
if (rv == SANLK_AIO_TIMEOUT)
@@ -870,7 +870,7 @@ static int write_lvb_block(struct task *task, struct resource *r, struct token *
if (!r->lvb)
return 0;
- rv = write_iobuf(disk->fd, offset, iobuf, iobuf_len, task, token->io_timeout, NULL);
+ rv = write_iobuf(disk->fd, offset, iobuf, iobuf_len, task, task->use_aio, token->io_timeout, NULL);
/* for io timeout, lvb iobuf is freed when the aio completes, not by free_resource */
if (rv == SANLK_AIO_TIMEOUT)
diff --git a/src/rindex.c b/src/rindex.c
index a4196d2..240f795 100644
--- a/src/rindex.c
+++ b/src/rindex.c
@@ -236,7 +236,7 @@ static int update_rindex(struct task *task,
/* replace the specific entry */
memcpy(sector_iobuf + entry_offset_in_sector, &re_end, sizeof(struct rindex_entry));
- rv = write_iobuf(rx->disk->fd, rx->disk->offset + sector_offset, sector_iobuf, iobuf_len, task, spi->io_timeout, NULL);
+ rv = write_iobuf(rx->disk->fd, rx->disk->offset + sector_offset, sector_iobuf, iobuf_len, task, task->use_aio, spi->io_timeout, NULL);
if (rv != SANLK_AIO_TIMEOUT)
free(sector_iobuf);
@@ -266,7 +266,7 @@ static int read_rindex(struct task *task,
memset(iobuf, 0, iobuf_len);
- rv = read_iobuf(rx->disk->fd, rx->disk->offset, iobuf, iobuf_len, task, spi->io_timeout, NULL);
+ rv = read_iobuf(rx->disk->fd, rx->disk->offset, iobuf, iobuf_len, task, task->use_aio, spi->io_timeout, NULL);
if (rv < 0) {
if (rv != SANLK_AIO_TIMEOUT) {
free(iobuf);
@@ -312,7 +312,7 @@ static int read_rindex_header(struct task *task,
if (rv)
return -ENOMEM;
- rv = read_iobuf(rx->disk->fd, rx->disk->offset, iobuf, iobuf_len, task, io_timeout, NULL);
+ rv = read_iobuf(rx->disk->fd, rx->disk->offset, iobuf, iobuf_len, task, task->use_aio, io_timeout, NULL);
if (rv < 0)
goto out;
@@ -452,7 +452,7 @@ int rindex_format(struct task *task, struct sanlk_rindex *ri)
else
write_io_timeout = com.io_timeout;
- rv = write_iobuf(rx.disk->fd, rx.disk->offset, iobuf, iobuf_len, task, write_io_timeout, NULL);
+ rv = write_iobuf(rx.disk->fd, rx.disk->offset, iobuf, iobuf_len, task, task->use_aio, write_io_timeout, NULL);
if (rv < 0) {
log_error("rindex_format write failed %d %s", rv, rx.disk->path);
goto out_iobuf;
@@ -1123,7 +1123,7 @@ int rindex_rebuild(struct task *task, struct sanlk_rindex *ri, uint32_t cmd_flag
res_offset += align_size;
}
- rv = write_iobuf(rx.disk->fd, rx.disk->offset, rindex_iobuf, align_size, task, spi.io_timeout, NULL);
+ rv = write_iobuf(rx.disk->fd, rx.disk->offset, rindex_iobuf, align_size, task, task->use_aio, spi.io_timeout, NULL);
if (rv < 0) {
if (rv != SANLK_AIO_TIMEOUT)
free(rindex_iobuf);
diff --git a/src/sanlock_internal.h b/src/sanlock_internal.h
index b58144b..466ac4c 100644
--- a/src/sanlock_internal.h
+++ b/src/sanlock_internal.h
@@ -267,6 +267,9 @@ struct space_info {
#define RX_OP_UPDATE 5
#define RX_OP_REBUILD 6
+#define USE_AIO 1
+#define NO_AIO 0
+
#define HOSTID_AIO_CB_SIZE 4
#define WORKER_AIO_CB_SIZE 2
#define DIRECT_AIO_CB_SIZE 1
diff --git a/src/sanlock_rv.h b/src/sanlock_rv.h
index a768ee7..f97d543 100644
--- a/src/sanlock_rv.h
+++ b/src/sanlock_rv.h
@@ -80,5 +80,6 @@
#define SANLK_RINDEX_DIFF -278
#define SANLK_WRONG_GENERATION -280
+#define SANLK_IOTYPE -285
#endif
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.