fallocate mode flags are typically ifdef'd when introduced to provide some backwards compatibility and minimize disruption for users who might not have picked up the latest supporting bits in their dev and test environments. As it is, most of these flags have been used outside of ifdef protection for runtime functionality detection for quite some time, so this apparently hasn't been providing much practical benefit. fallocate runtime functionality detection goes back 8-10 years now in some cases, without any known complaints upstream. Therefore, clean out some of the older ifdef cruft as a housekeeping exercise. This can be undone if it turns out to be problematic for any current fstests users. Signed-off-by: Brian Foster <bfoster@xxxxxxxxxx> --- ltp/fsx.c | 77 +++++-------------------------------------------------- 1 file changed, 7 insertions(+), 70 deletions(-) diff --git a/ltp/fsx.c b/ltp/fsx.c index 677f8c9f..db8ee914 100644 --- a/ltp/fsx.c +++ b/ltp/fsx.c @@ -1231,7 +1231,6 @@ dotruncate(unsigned size) } } -#ifdef FALLOC_FL_PUNCH_HOLE void do_punch_hole(unsigned offset, unsigned length) { @@ -1280,15 +1279,6 @@ do_punch_hole(unsigned offset, unsigned length) memset(good_buf + max_offset, '\0', max_len); } -#else -void -do_punch_hole(unsigned offset, unsigned length) -{ - return; -} -#endif - -#ifdef FALLOC_FL_ZERO_RANGE void do_zero_range(unsigned offset, unsigned length, int keep_size) { @@ -1344,15 +1334,6 @@ do_zero_range(unsigned offset, unsigned length, int keep_size) memset(good_buf + offset, '\0', length); } -#else -void -do_zero_range(unsigned offset, unsigned length, int keep_size) -{ - return; -} -#endif - -#ifdef FALLOC_FL_COLLAPSE_RANGE void do_collapse_range(unsigned offset, unsigned length) { @@ -1399,15 +1380,6 @@ do_collapse_range(unsigned offset, unsigned length) file_size -= length; } -#else -void -do_collapse_range(unsigned offset, unsigned length) -{ - return; -} -#endif - -#ifdef FALLOC_FL_INSERT_RANGE void do_insert_range(unsigned offset, unsigned length) { @@ -1455,15 +1427,6 @@ do_insert_range(unsigned offset, unsigned length) file_size += length; } -#else -void -do_insert_range(unsigned offset, unsigned length) -{ - return; -} -#endif - -#ifdef XFS_IOC_EXCHANGE_RANGE int test_exchange_range(void) { @@ -1546,20 +1509,6 @@ out_free: free(p); } -#else -int -test_exchange_range(void) -{ - return 0; -} - -void -do_exchange_range(unsigned offset, unsigned length, unsigned dest) -{ - return; -} -#endif - #ifdef FICLONERANGE int test_clone_range(void) @@ -1897,12 +1846,10 @@ do_preallocate(unsigned offset, unsigned length, int keep_size, int unshare) opflags |= FL_KEEP_SIZE; mode |= FALLOC_FL_KEEP_SIZE; } -#ifdef FALLOC_FL_UNSHARE_RANGE if (unshare) { opflags |= FL_UNSHARE; mode |= FALLOC_FL_UNSHARE_RANGE; } -#endif if (length == 0) { if (!quiet && testcalls > simulatedopcount) @@ -2495,11 +2442,9 @@ usage(void) -q: quieter operation\n\ -r readbdy: 4096 would make reads page aligned (default 1)\n\ -s style: 1 gives smaller truncates (default 0)\n\ - -t truncbdy: 4096 would make truncates page aligned (default 1)\n" -#ifdef FALLOC_FL_UNSHARE_RANGE -" -u Do not use unshare range\n" -#endif -" -w writebdy: 4096 would make writes page aligned (default 1)\n\ + -t truncbdy: 4096 would make truncates page aligned (default 1)\n\ + -u Do not use unshare range\n\ + -w writebdy: 4096 would make writes page aligned (default 1)\n\ -x: preallocate file space before starting, XFS only\n\ -y: synchronize changes to a file\n" @@ -2513,18 +2458,10 @@ usage(void) #ifdef HAVE_LINUX_FALLOC_H " -F: Do not use fallocate (preallocation) calls\n" #endif -#ifdef FALLOC_FL_PUNCH_HOLE -" -H: Do not use punch hole calls\n" -#endif -#ifdef FALLOC_FL_ZERO_RANGE -" -z: Do not use zero range calls\n" -#endif -#ifdef FALLOC_FL_COLLAPSE_RANGE -" -C: Do not use collapse range calls\n" -#endif -#ifdef FALLOC_FL_INSERT_RANGE -" -I: Do not use insert range calls\n" -#endif +" -H: Do not use punch hole calls\n\ + -z: Do not use zero range calls\n\ + -C: Do not use collapse range calls\n\ + -I: Do not use insert range calls\n" #ifdef FICLONERANGE " -J: Do not use clone range calls\n" #endif -- 2.46.1 --gJRmY3uG4ezAzu8j--