From f5a75ea44db32ac27ada327b4752c3bc611cf9df Mon Sep 17 00:00:00 2001 From: Shaun Tancheff Date: Sat, 1 Apr 2023 03:41:16 -0500 Subject: [PATCH] LU-16697 llite: Set BDI_CAP_* flags for lustre 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 Signed-off-by: Qian Yingjin Change-Id: I49ce07fce8a9d153b9a71d8a0ba28b799354fc7f Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50497 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin Reviewed-by: James Simmons Reviewed-by: Alexander Zarochentsev --- lustre/autoconf/lustre-core.m4 | 26 -------------------------- lustre/include/lustre_compat.h | 24 ++++++++++++++++++++++++ lustre/llite/llite_lib.c | 9 ++++----- 3 files changed, 28 insertions(+), 31 deletions(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index f1f8fb7..713d2c3 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -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 - ],[ - 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 diff --git a/lustre/include/lustre_compat.h b/lustre/include/lustre_compat.h index 06e674d..38a3b94 100644 --- a/lustre/include/lustre_compat.h +++ b/lustre/include/lustre_compat.h @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -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 diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 3313705..185ff2a 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -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. */ -- 1.8.3.1