Whamcloud - gitweb
LU-17042 target: allow fsmap ioctl 47/52147/2
authorLi Dongyang <dongyangli@ddn.com>
Tue, 29 Aug 2023 05:18:34 +0000 (15:18 +1000)
committerOleg Drokin <green@whamcloud.com>
Fri, 23 Feb 2024 07:10:46 +0000 (07:10 +0000)
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 <dongyangli@ddn.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52147
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/autoconf/lustre-core.m4
lustre/target/tgt_mount.c

index af32b5f..dbc7b32 100644 (file)
@@ -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
index eeab3c1..76d48ec 100644 (file)
@@ -46,6 +46,9 @@
 #include <linux/version.h>
 #include <linux/delay.h>
 #include <linux/file.h>
+#ifdef HAVE_FSMAP_H
+#include <linux/fsmap.h>
+#endif
 
 #include <llog_swab.h>
 #include <lustre_disk.h>
@@ -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;
        }