From 2de203163d6def1a3bc53fa8c6791c73e6e3fd6f Mon Sep 17 00:00:00 2001 From: Rob Norris Date: Sat, 24 Aug 2024 21:05:51 +1000 Subject: [PATCH] config: remove HAVE_SUPER_SETUP_BDI_NAME Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf Reviewed-by: Tony Hutter Reviewed-by: Tino Reichardt Signed-off-by: Rob Norris Closes #16479 --- config/kernel-bdi.m4 | 56 ---------------------- config/kernel.m4 | 2 - include/os/linux/kernel/linux/vfs_compat.h | 48 ------------------- module/os/linux/zfs/zfs_vfsops.c | 8 ++-- 4 files changed, 3 insertions(+), 111 deletions(-) delete mode 100644 config/kernel-bdi.m4 diff --git a/config/kernel-bdi.m4 b/config/kernel-bdi.m4 deleted file mode 100644 index 95f1291dd..000000000 --- a/config/kernel-bdi.m4 +++ /dev/null @@ -1,56 +0,0 @@ -dnl # -dnl # Check available BDI interfaces. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_BDI], [ - ZFS_LINUX_TEST_SRC([super_setup_bdi_name], [ - #include - struct super_block sb; - ], [ - char *name = "bdi"; - atomic_long_t zfs_bdi_seq; - int error __attribute__((unused)); - atomic_long_set(&zfs_bdi_seq, 0); - error = - super_setup_bdi_name(&sb, "%.28s-%ld", name, - atomic_long_inc_return(&zfs_bdi_seq)); - ]) - - ZFS_LINUX_TEST_SRC([bdi_setup_and_register], [ - #include - struct backing_dev_info bdi; - ], [ - char *name = "bdi"; - int error __attribute__((unused)) = - bdi_setup_and_register(&bdi, name); - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_BDI], [ - dnl # - dnl # 4.12, super_setup_bdi_name() introduced. - dnl # - AC_MSG_CHECKING([whether super_setup_bdi_name() exists]) - ZFS_LINUX_TEST_RESULT_SYMBOL([super_setup_bdi_name], - [super_setup_bdi_name], [fs/super.c], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_SUPER_SETUP_BDI_NAME, 1, - [super_setup_bdi_name() exits]) - ], [ - AC_MSG_RESULT(no) - - dnl # - dnl # 4.0 - 4.11, bdi_setup_and_register() takes 2 arguments. - dnl # - AC_MSG_CHECKING( - [whether bdi_setup_and_register() wants 2 args]) - ZFS_LINUX_TEST_RESULT_SYMBOL([bdi_setup_and_register], - [bdi_setup_and_register], [mm/backing-dev.c], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_2ARGS_BDI_SETUP_AND_REGISTER, 1, - [bdi_setup_and_register() wants 2 args]) - ], [ - AC_MSG_RESULT(no) - ZFS_LINUX_TEST_ERROR([bdi_setup]) - ]) - ]) -]) diff --git a/config/kernel.m4 b/config/kernel.m4 index eb13e6684..1c34daea5 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -77,7 +77,6 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ ZFS_AC_KERNEL_SRC_TRUNCATE_SETSIZE ZFS_AC_KERNEL_SRC_SECURITY_INODE ZFS_AC_KERNEL_SRC_FST_MOUNT - ZFS_AC_KERNEL_SRC_BDI ZFS_AC_KERNEL_SRC_SET_NLINK ZFS_AC_KERNEL_SRC_SGET ZFS_AC_KERNEL_SRC_VFS_FILEMAP_DIRTY_FOLIO @@ -191,7 +190,6 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ ZFS_AC_KERNEL_TRUNCATE_SETSIZE ZFS_AC_KERNEL_SECURITY_INODE ZFS_AC_KERNEL_FST_MOUNT - ZFS_AC_KERNEL_BDI ZFS_AC_KERNEL_SET_NLINK ZFS_AC_KERNEL_SGET ZFS_AC_KERNEL_VFS_FILEMAP_DIRTY_FOLIO diff --git a/include/os/linux/kernel/linux/vfs_compat.h b/include/os/linux/kernel/linux/vfs_compat.h index 369829a8f..3caa61ec5 100644 --- a/include/os/linux/kernel/linux/vfs_compat.h +++ b/include/os/linux/kernel/linux/vfs_compat.h @@ -32,54 +32,6 @@ #include #include -/* - * 4.0 - 4.11, bdi_setup_and_register() takes 2 arguments. - * 4.12 - x.y, super_setup_bdi_name() new interface. - */ -#if defined(HAVE_SUPER_SETUP_BDI_NAME) -extern atomic_long_t zfs_bdi_seq; - -static inline int -zpl_bdi_setup(struct super_block *sb, char *name) -{ - return super_setup_bdi_name(sb, "%.28s-%ld", name, - atomic_long_inc_return(&zfs_bdi_seq)); -} -static inline void -zpl_bdi_destroy(struct super_block *sb) -{ -} -#elif defined(HAVE_2ARGS_BDI_SETUP_AND_REGISTER) -static inline int -zpl_bdi_setup(struct super_block *sb, char *name) -{ - struct backing_dev_info *bdi; - int error; - - bdi = kmem_zalloc(sizeof (struct backing_dev_info), KM_SLEEP); - error = bdi_setup_and_register(bdi, name); - if (error) { - kmem_free(bdi, sizeof (struct backing_dev_info)); - return (error); - } - - sb->s_bdi = bdi; - - return (0); -} -static inline void -zpl_bdi_destroy(struct super_block *sb) -{ - struct backing_dev_info *bdi = sb->s_bdi; - - bdi_destroy(bdi); - kmem_free(bdi, sizeof (struct backing_dev_info)); - sb->s_bdi = NULL; -} -#else -#error "Unsupported kernel" -#endif - /* * 4.14 adds SB_* flag definitions, define them to MS_* equivalents * if not set. diff --git a/module/os/linux/zfs/zfs_vfsops.c b/module/os/linux/zfs/zfs_vfsops.c index 9d695a50c..b28efd3c5 100644 --- a/module/os/linux/zfs/zfs_vfsops.c +++ b/module/os/linux/zfs/zfs_vfsops.c @@ -1385,9 +1385,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting) return (0); } -#if defined(HAVE_SUPER_SETUP_BDI_NAME) -atomic_long_t zfs_bdi_seq = ATOMIC_LONG_INIT(0); -#endif +static atomic_long_t zfs_bdi_seq = ATOMIC_LONG_INIT(0); int zfs_domount(struct super_block *sb, zfs_mnt_t *zm, int silent) @@ -1448,7 +1446,8 @@ zfs_domount(struct super_block *sb, zfs_mnt_t *zm, int silent) sb->s_blocksize = recordsize; sb->s_blocksize_bits = ilog2(recordsize); - error = -zpl_bdi_setup(sb, "zfs"); + error = -super_setup_bdi_name(sb, "%.28s-%ld", "zfs", + atomic_long_inc_return(&zfs_bdi_seq)); if (error) goto out; @@ -1576,7 +1575,6 @@ zfs_umount(struct super_block *sb) arc_remove_prune_callback(zfsvfs->z_arc_prune); VERIFY(zfsvfs_teardown(zfsvfs, B_TRUE) == 0); os = zfsvfs->z_os; - zpl_bdi_destroy(sb); /* * z_os will be NULL if there was an error in