From 6d24d953e76422094579f226ad1815911543dbad Mon Sep 17 00:00:00 2001 From: Robert Breker Date: Sun, 4 Oct 2015 09:20:12 +0000 Subject: [PATCH] Use off64_t and fallocate64 instead of off_t and fallocate (to be squashed) As there is no reason not to avoid potential 32-bit traps. This also matches the style in the surrounding code. Signed-off-by: Robert Breker --- drivers/block-aio.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/block-aio.c b/drivers/block-aio.c index 865bbb69..426d8e48 100644 --- a/drivers/block-aio.c +++ b/drivers/block-aio.c @@ -221,8 +221,8 @@ void tdaio_queue_write(td_driver_t *driver, td_request_t treq) void tdaio_discard(td_driver_t *driver, td_request_t treq) { int rc; - off_t size; - off_t offset; + off64_t size; + off64_t offset; struct tdaio_state *prv; if (driver->info.discard_supported != true) { @@ -232,15 +232,14 @@ void tdaio_discard(td_driver_t *driver, td_request_t treq) prv = (struct tdaio_state *)driver->data; size = treq.vreq->discard_nr_sectors * driver->info.sector_size; - offset = treq.vreq->sec * (off_t)driver->info.sector_size; + offset = treq.vreq->sec * driver->info.sector_size; - rc = fallocate(prv->fd, (FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE), offset, size); + rc = fallocate64(prv->fd, (FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE), offset, size); // Upper layers will retry on EINTR // ToDo: Remove the following debug statement after feeling confident - DPRINTF("fallocate(%d, %d, %ld, %ld) returned %d", prv->fd, - (FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE), (long int)offset, - (long int)size, rc); + DPRINTF("fallocate64(%d, %d, %" PRIu64 ", %" PRIu64 ") returned %d", prv->fd, + (FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE), offset, size, rc); td_complete_request(treq, rc); return;