Skip to content

Commit 6d24d95

Browse files
author
Robert Breker
committed
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 <[email protected]>
1 parent 7757875 commit 6d24d95

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

drivers/block-aio.c

+6-7
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ void tdaio_queue_write(td_driver_t *driver, td_request_t treq)
221221
void tdaio_discard(td_driver_t *driver, td_request_t treq)
222222
{
223223
int rc;
224-
off_t size;
225-
off_t offset;
224+
off64_t size;
225+
off64_t offset;
226226
struct tdaio_state *prv;
227227

228228
if (driver->info.discard_supported != true) {
@@ -232,15 +232,14 @@ void tdaio_discard(td_driver_t *driver, td_request_t treq)
232232

233233
prv = (struct tdaio_state *)driver->data;
234234
size = treq.vreq->discard_nr_sectors * driver->info.sector_size;
235-
offset = treq.vreq->sec * (off_t)driver->info.sector_size;
235+
offset = treq.vreq->sec * driver->info.sector_size;
236236

237-
rc = fallocate(prv->fd, (FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE), offset, size);
237+
rc = fallocate64(prv->fd, (FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE), offset, size);
238238
// Upper layers will retry on EINTR
239239

240240
// ToDo: Remove the following debug statement after feeling confident
241-
DPRINTF("fallocate(%d, %d, %ld, %ld) returned %d", prv->fd,
242-
(FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE), (long int)offset,
243-
(long int)size, rc);
241+
DPRINTF("fallocate64(%d, %d, %" PRIu64 ", %" PRIu64 ") returned %d", prv->fd,
242+
(FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE), offset, size, rc);
244243

245244
td_complete_request(treq, rc);
246245
return;

0 commit comments

Comments
 (0)