Skip to content

Commit c978385

Browse files
author
Artyom Ivanov
committed
refactor(pio): Add distinct variables for offset and length
1 parent 153331d commit c978385

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/jrd/os/posix/unix.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,13 +320,16 @@ void PIO_extend(thread_db* tdbb, jrd_file* file, const ULONG extPages, const USH
320320
if (file->fil_flags & FIL_no_fast_extend)
321321
return;
322322

323-
const off_t filePages = PIO_get_number_of_pages(file, pageSize);
324-
const off_t extendBy = MIN(MAX_ULONG - filePages, extPages);
323+
const ULONG filePages = PIO_get_number_of_pages(file, pageSize);
324+
const ULONG extendBy = MIN(MAX_ULONG - filePages, extPages);
325+
326+
const off_t offset = static_cast<off_t>(filePages) * pageSize;
327+
const off_t length = static_cast<off_t>(extendBy) * pageSize;
325328

326329
int r;
327330
for (r = 0; r < IO_RETRY; r++)
328331
{
329-
int err = fallocate(file->fil_desc, 0, filePages * pageSize, extendBy * pageSize);
332+
int err = fallocate(file->fil_desc, 0, offset, length);
330333
if (err == 0)
331334
break;
332335

0 commit comments

Comments
 (0)