Whamcloud - gitweb
LU-16697 llite: Set BDI_CAP_* flags for lustre 97/50497/8
authorShaun Tancheff <stancheff@cray.com>
Sat, 1 Apr 2023 08:41:16 +0000 (03:41 -0500)
committerOleg Drokin <green@whamcloud.com>
Sat, 8 Jul 2023 22:35:02 +0000 (22:35 +0000)
Lustre should set the BDI_CAP_* flags and the s_iflags
to indicate support for write back and cgroup write back

HPE-bug-id: LUS-11553
Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Signed-off-by: Qian Yingjin <qian@ddn.com>
Change-Id: I49ce07fce8a9d153b9a71d8a0ba28b799354fc7f
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50497
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Alexander Zarochentsev <alexander.zarochentsev@hpe.com>
lustre/autoconf/lustre-core.m4
lustre/include/lustre_compat.h
lustre/llite/llite_lib.c

index f1f8fb7..713d2c3 100644 (file)
@@ -1287,30 +1287,6 @@ AC_DEFUN([LC_BACKING_DEV_INFO_REMOVAL], [
 ]) # LC_BACKING_DEV_INFO_REMOVAL
 
 #
-# LC_HAVE_BDI_CAP_MAP_COPY
-#
-# 3.20  removed mmap handling for backing devices since
-#      it breaks on non-MMU systems. See kernel commit
-#      b4caecd48005fbed3949dde6c1cb233142fd69e9
-#
-AC_DEFUN([LC_SRC_HAVE_BDI_CAP_MAP_COPY], [
-       LB2_LINUX_TEST_SRC([bdi_cap_map_copy], [
-               #include <linux/backing-dev.h>
-       ],[
-               struct backing_dev_info info;
-
-               info.capabilities = BDI_CAP_MAP_COPY;
-       ])
-]) # LC_HAVE_BDI_CAP_MAP_COPY
-AC_DEFUN([LC_HAVE_BDI_CAP_MAP_COPY], [
-       AC_MSG_CHECKING([if have 'BDI_CAP_MAP_COPY'])
-       LB2_LINUX_TEST_RESULT([bdi_cap_map_copy], [
-               AC_DEFINE(HAVE_BDI_CAP_MAP_COPY, 1,
-                       [BDI_CAP_MAP_COPY exist])
-       ])
-]) # LC_HAVE_BDI_CAP_MAP_COPY
-
-#
 # LC_HAVE_PROJECT_QUOTA
 #
 # Kernel version v4.0-rc1-197-g847aac644e92
@@ -3886,7 +3862,6 @@ AC_DEFUN([LC_PROG_LINUX_SRC], [
 
        # 3.20
        LC_SRC_BACKING_DEV_INFO_REMOVAL
-       LC_SRC_HAVE_BDI_CAP_MAP_COPY
 
        # 4.1.0
        LC_SRC_IOV_ITER_RW
@@ -4141,7 +4116,6 @@ AC_DEFUN([LC_PROG_LINUX_RESULTS], [
 
        # 3.20
        LC_BACKING_DEV_INFO_REMOVAL
-       LC_HAVE_BDI_CAP_MAP_COPY
 
        # 4.1.0
        LC_IOV_ITER_RW
index 06e674d..38a3b94 100644 (file)
@@ -41,6 +41,7 @@
 #include <linux/xattr.h>
 #include <linux/workqueue.h>
 #include <linux/blkdev.h>
+#include <linux/backing-dev.h>
 #include <linux/slab.h>
 #include <linux/security.h>
 #include <libcfs/linux/linux-fs.h>
@@ -542,6 +543,29 @@ static inline int ll_vfs_removexattr(struct dentry *dentry, struct inode *inode,
 #endif
 }
 
+/* until v3.19-rc5-3-gb4caecd48005 */
+#ifndef BDI_CAP_MAP_COPY
+#define BDI_CAP_MAP_COPY               0
+#endif
+
+/* from v4.1-rc2-56-g89e9b9e07a39, until v5.9-rc3-161-gf56753ac2a90 */
+#ifndef BDI_CAP_CGROUP_WRITEBACK
+#define BDI_CAP_CGROUP_WRITEBACK       0
+#endif
+
+/* from v5.9-rc3-161-gf56753ac2a90 */
+#ifndef BDI_CAP_WRITEBACK
+#define BDI_CAP_WRITEBACK              0
+#endif
+
+/* from v5.9-rc3-161-gf56753ac2a90 */
+#ifndef BDI_CAP_WRITEBACK_ACCT
+#define BDI_CAP_WRITEBACK_ACCT         0
+#endif
+
+#define LL_BDI_CAP_FLAGS       (BDI_CAP_CGROUP_WRITEBACK | BDI_CAP_MAP_COPY | \
+                                BDI_CAP_WRITEBACK | BDI_CAP_WRITEBACK_ACCT)
+
 #ifndef FALLOC_FL_COLLAPSE_RANGE
 #define FALLOC_FL_COLLAPSE_RANGE 0x08 /* remove a range of a file */
 #endif
index 3313705..185ff2a 100644 (file)
@@ -1279,10 +1279,6 @@ void ll_lli_init(struct ll_inode_info *lli)
 #define MAX_STRING_SIZE 128
 
 #ifndef HAVE_SUPER_SETUP_BDI_NAME
-#ifndef HAVE_BDI_CAP_MAP_COPY
-# define BDI_CAP_MAP_COPY      0
-#endif
-
 static int super_setup_bdi_name(struct super_block *sb, char *fmt, ...)
 {
        struct  lustre_sb_info *lsi = s2lsi(sb);
@@ -1399,7 +1395,10 @@ int ll_fill_super(struct super_block *sb)
 #ifdef HAVE_BDI_IO_PAGES
        sb->s_bdi->io_pages = 0;
 #endif
-
+       sb->s_bdi->capabilities |= LL_BDI_CAP_FLAGS;
+#ifdef SB_I_CGROUPWB
+       sb->s_iflags |= SB_I_CGROUPWB;
+#endif
        /* Call ll_debugfs_register_super() before lustre_process_log()
         * so that "llite.*.*" params can be processed correctly.
         */