From 8e83c0cf68119920355307cbead6f017d1e937ea Mon Sep 17 00:00:00 2001 From: Li Dongyang Date: Tue, 29 Aug 2023 15:18:34 +1000 Subject: [PATCH] LU-17042 target: allow fsmap ioctl Pass through the FS_IOC_GETFSMAP ioctl to the underlying ldiskfs so e2freefrag can make use of online query. Change-Id: Ia4f1fd3c0b02429b247fa71e73b4a95b98b47026 Test-Parameters: trivial Signed-off-by: Li Dongyang Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52147 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin --- lustre/autoconf/lustre-core.m4 | 18 ++++++++++++++++++ lustre/target/tgt_mount.c | 7 +++++++ 2 files changed, 25 insertions(+) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index af32b5f..dbc7b32 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -2304,6 +2304,22 @@ AC_DEFUN([LC_HAVE_CRYPTO_MAX_ALG_NAME_128], [ ]) # LC_HAVE_CRYPTO_MAX_ALG_NAME_128 # +# LC_HAVE_FSMAP_HEADER +# +# Kernel version 4.11-rc4 commit 80c9f490f344be7999f57fc31a8ed956f8c65f3b +# vfs: add common GETFSMAP ioctl definitions +# +AC_DEFUN([LC_SRC_HAVE_FSMAP_HEADER], [ + LB2_CHECK_LINUX_HEADER_SRC([linux/fsmap.h], [-Werror]) +]) +AC_DEFUN([LC_HAVE_FSMAP_HEADER], [ + LB2_CHECK_LINUX_HEADER_RESULT([linux/fsmap.h], [ + AC_DEFINE(HAVE_FSMAP_H, 1, + [fsmap.h is present]) + ]) +]) # LC_HAVE_FSMAP_HEADER + +# # Kernel version 4.12 commit 47f38c539e9a42344ff5a664942075bd4df93876 # CURRENT_TIME is not 64 bit time safe so it was replaced with # current_time() @@ -4192,6 +4208,7 @@ AC_DEFUN([LC_PROG_LINUX_SRC], [ LC_SRC_VM_OPERATIONS_REMOVE_VMF_ARG LC_SRC_HAVE_KEY_USAGE_REFCOUNT LC_SRC_HAVE_CRYPTO_MAX_ALG_NAME_128 + LC_SRC_HAVE_FSMAP_HEADER # 4.12 LC_SRC_CURRENT_TIME @@ -4465,6 +4482,7 @@ AC_DEFUN([LC_PROG_LINUX_RESULTS], [ LC_VM_OPERATIONS_REMOVE_VMF_ARG LC_HAVE_KEY_USAGE_REFCOUNT LC_HAVE_CRYPTO_MAX_ALG_NAME_128 + LC_HAVE_FSMAP_HEADER # 4.12 LC_CURRENT_TIME diff --git a/lustre/target/tgt_mount.c b/lustre/target/tgt_mount.c index eeab3c1..76d48ec 100644 --- a/lustre/target/tgt_mount.c +++ b/lustre/target/tgt_mount.c @@ -46,6 +46,9 @@ #include #include #include +#ifdef HAVE_FSMAP_H +#include +#endif #include #include @@ -2003,6 +2006,10 @@ static bool is_cmd_supported(unsigned int cmd) return true; case LL_IOC_RESIZE_FS: return true; +#ifdef HAVE_FSMAP_H + case FS_IOC_GETFSMAP: + return true; +#endif default: return false; } -- 1.8.3.1