for (uint64 i = 0; i < pgaio_ctl->io_handle_count; i++)
{
PgAioHandle *live_ioh = &pgaio_ctl->io_handles[i];
- uint32 ioh_id = pgaio_io_get_id(live_ioh);
+ int ioh_id = pgaio_io_get_id(live_ioh);
Datum values[PG_GET_AIOS_COLS] = {0};
bool nulls[PG_GET_AIOS_COLS] = {0};
ProcNumber owner;
nulls[0] = false;
/* column: IO's id */
- values[1] = UInt32GetDatum(ioh_id);
+ values[1] = Int32GetDatum(ioh_id);
/* column: IO's generation */
values[2] = Int64GetDatum(start_generation);
uint32 mask;
uint32 head;
uint32 tail;
- uint32 sqes[FLEXIBLE_ARRAY_MEMBER];
+ int sqes[FLEXIBLE_ARRAY_MEMBER];
} PgAioWorkerSubmissionQueue;
typedef struct PgAioWorkerSlot
*queue_size = pg_nextpower2_32(io_worker_queue_size);
return offsetof(PgAioWorkerSubmissionQueue, sqes) +
- sizeof(uint32) * *queue_size;
+ sizeof(int) * *queue_size;
}
static size_t
return true;
}
-static uint32
+static int
pgaio_worker_submission_queue_consume(void)
{
PgAioWorkerSubmissionQueue *queue;
- uint32 result;
+ int result;
queue = io_worker_submission_queue;
if (queue->tail == queue->head)
- return UINT32_MAX; /* empty */
+ return -1; /* empty */
result = queue->sqes[queue->tail];
queue->tail = (queue->tail + 1) & (queue->size - 1);
* to ensure that we don't see an outdated data in the handle.
*/
LWLockAcquire(AioWorkerSubmissionQueueLock, LW_EXCLUSIVE);
- if ((io_index = pgaio_worker_submission_queue_consume()) == UINT32_MAX)
+ if ((io_index = pgaio_worker_submission_queue_consume()) == -1)
{
/*
* Nothing to do. Mark self idle.
for (int i = 0; i < nlatches; ++i)
SetLatch(latches[i]);
- if (io_index != UINT32_MAX)
+ if (io_index != -1)
{
PgAioHandle *ioh = NULL;