[PATCH v2 20/29] xfsprogs: Stop using platform_zero_range()

Pavel Reichl
2021-08-06T21:23:53Z

---
include/linux.h | 14 ++++++++++++--
libxfs/rdwr.c | 2 +-
2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/include/linux.h b/include/linux.h
index 97882161..4ee4288f 100644
--- a/include/linux.h
+++ b/include/linux.h
@@ -208,7 +208,7 @@ static inline void platform_mntent_close(struct mntent_cursor * cursor)

#if defined(FALLOC_FL_ZERO_RANGE)
static inline int
-platform_zero_range(
+zero_range(
int fd,
xfs_off_t start,
size_t len)
@@ -220,8 +220,18 @@ platform_zero_range(
return 0;
return -errno;
}
+
+static inline int
+platform_zero_range(
+ int fd,
+ xfs_off_t start,
+ size_t len)
+{
+ return zero_range(fd, start, len);
+}
#else
-#define platform_zero_range(fd, s, l) (-EOPNOTSUPP)
+#define zero_range(fd, s, l) (-EOPNOTSUPP)
+#define platform_zero_range(fs, s, l) zero_range(fd, s, l)
#endif

/*
diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c
index 022da518..a92c909e 100644
--- a/libxfs/rdwr.c
+++ b/libxfs/rdwr.c
@@ -73,7 +73,7 @@ libxfs_device_zero(struct xfs_buftarg *btp, xfs_daddr_t start, uint len)

/* try to use special zeroing methods, fall back to writes if needed */
len_bytes = LIBXFS_BBTOOFF64(len);
- error = platform_zero_range(fd, start_offset, len_bytes);
+ error = zero_range(fd, start_offset, len_bytes);
if (!error) {
xfs_buftarg_trip_write(btp);
return 0;
--
2.31.1