Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1 | From 6fab3346d448298a24cee1faeb5fc8507a3b9712 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Thu, 10 Nov 2022 20:34:54 -0800 |
| 4 | Subject: [PATCH] Add option to enable/disable largefile support |
| 5 | |
| 6 | fallocate can be used to have 64bit off_t provided its compiled with |
| 7 | _FILE_OFFSET_BITS=64 which will be added automatically when |
| 8 | --enable-largefile is used. |
| 9 | |
| 10 | Upstream-Status: Submitted [https://github.com/tytso/e2fsprogs/pull/129] |
| 11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 12 | --- |
| 13 | configure.ac | 3 +++ |
| 14 | misc/e4defrag.c | 6 +----- |
| 15 | 2 files changed, 4 insertions(+), 5 deletions(-) |
| 16 | |
| 17 | diff --git a/configure.ac b/configure.ac |
| 18 | index dff3d1ca..ec1c5b64 100644 |
| 19 | --- a/configure.ac |
| 20 | +++ b/configure.ac |
| 21 | @@ -1800,6 +1800,9 @@ OS_IO_FILE="" |
| 22 | ;; |
| 23 | esac] |
| 24 | AC_SUBST(OS_IO_FILE) |
| 25 | + |
| 26 | +AC_SYS_LARGEFILE |
| 27 | + |
| 28 | dnl |
| 29 | dnl Make our output files, being sure that we create the some miscellaneous |
| 30 | dnl directories |
| 31 | diff --git a/misc/e4defrag.c b/misc/e4defrag.c |
| 32 | index 86e97ee3..e7175c37 100644 |
| 33 | --- a/misc/e4defrag.c |
| 34 | +++ b/misc/e4defrag.c |
| 35 | @@ -195,10 +195,6 @@ static struct frag_statistic_ino frag_rank[SHOW_FRAG_FILES]; |
| 36 | #error posix_fadvise not available! |
| 37 | #endif |
| 38 | |
| 39 | -#ifndef HAVE_FALLOCATE64 |
| 40 | -#error fallocate64 not available! |
| 41 | -#endif /* ! HAVE_FALLOCATE64 */ |
| 42 | - |
| 43 | /* |
| 44 | * get_mount_point() - Get device's mount point. |
| 45 | * |
| 46 | @@ -1568,7 +1564,7 @@ static int file_defrag(const char *file, const struct stat64 *buf, |
| 47 | /* Allocate space for donor inode */ |
| 48 | orig_group_tmp = orig_group_head; |
| 49 | do { |
| 50 | - ret = fallocate64(donor_fd, 0, |
| 51 | + ret = fallocate(donor_fd, 0, |
| 52 | (ext2_loff_t)orig_group_tmp->start->data.logical * block_size, |
| 53 | (ext2_loff_t)orig_group_tmp->len * block_size); |
| 54 | if (ret < 0) { |
| 55 | -- |
| 56 | 2.38.1 |
| 57 | |