diff options
author | Brian Behlendorf <[email protected]> | 2011-11-07 16:39:03 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2011-11-08 10:19:03 -0800 |
commit | 5547c2f1bf49802835fd6c52f15115ba344a2a8b (patch) | |
tree | 7e2314465d7a0ad5b6922c1d385b6c8ffa4e7979 | |
parent | 591fb62f19ee2431983a4cbeb0d200b1b8e7daf5 (diff) |
Simplify BDI integration
Update the code to use the bdi_setup_and_register() helper to
simplify the bdi integration code. The updated code now just
registers the bdi during mount and destroys it during unmount.
The only complication is that for 2.6.32 - 2.6.33 kernels the
helper wasn't available so in these cases the zfs code must
provide it. Luckily the bdi_setup_and_register() function
is trivial.
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #367
60 files changed, 231 insertions, 41 deletions
diff --git a/Makefile.in b/Makefile.in index 3dbb5178d..17bf07839 100644 --- a/Makefile.in +++ b/Makefile.in @@ -56,6 +56,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/cmd/Makefile.in b/cmd/Makefile.in index f4038c462..fd5cce5f7 100644 --- a/cmd/Makefile.in +++ b/cmd/Makefile.in @@ -41,6 +41,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/cmd/mount_zfs/Makefile.in b/cmd/mount_zfs/Makefile.in index b6dffc391..bb77b152f 100644 --- a/cmd/mount_zfs/Makefile.in +++ b/cmd/mount_zfs/Makefile.in @@ -44,6 +44,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/cmd/sas_switch_id/Makefile.in b/cmd/sas_switch_id/Makefile.in index 27a448bb9..3664f6f38 100644 --- a/cmd/sas_switch_id/Makefile.in +++ b/cmd/sas_switch_id/Makefile.in @@ -43,6 +43,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/cmd/zdb/Makefile.in b/cmd/zdb/Makefile.in index 3acec3a71..984b69082 100644 --- a/cmd/zdb/Makefile.in +++ b/cmd/zdb/Makefile.in @@ -44,6 +44,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/cmd/zfs/Makefile.in b/cmd/zfs/Makefile.in index 78b8cd5a7..bba0748de 100644 --- a/cmd/zfs/Makefile.in +++ b/cmd/zfs/Makefile.in @@ -44,6 +44,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/cmd/zinject/Makefile.in b/cmd/zinject/Makefile.in index 01c3bafeb..8de6f7516 100644 --- a/cmd/zinject/Makefile.in +++ b/cmd/zinject/Makefile.in @@ -44,6 +44,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/cmd/zpios/Makefile.in b/cmd/zpios/Makefile.in index 7fe48cca5..49f0ce45f 100644 --- a/cmd/zpios/Makefile.in +++ b/cmd/zpios/Makefile.in @@ -44,6 +44,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/cmd/zpool/Makefile.in b/cmd/zpool/Makefile.in index 80df09813..4d1b60ebc 100644 --- a/cmd/zpool/Makefile.in +++ b/cmd/zpool/Makefile.in @@ -44,6 +44,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/cmd/zpool_id/Makefile.in b/cmd/zpool_id/Makefile.in index 6ff126114..21d9e91ee 100644 --- a/cmd/zpool_id/Makefile.in +++ b/cmd/zpool_id/Makefile.in @@ -43,6 +43,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/cmd/zpool_layout/Makefile.in b/cmd/zpool_layout/Makefile.in index 0c1069b4e..76dbf3746 100644 --- a/cmd/zpool_layout/Makefile.in +++ b/cmd/zpool_layout/Makefile.in @@ -43,6 +43,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/cmd/ztest/Makefile.in b/cmd/ztest/Makefile.in index f11fac605..30461106a 100644 --- a/cmd/ztest/Makefile.in +++ b/cmd/ztest/Makefile.in @@ -44,6 +44,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/cmd/zvol_id/Makefile.in b/cmd/zvol_id/Makefile.in index e0b70ff4f..9c401fd75 100644 --- a/cmd/zvol_id/Makefile.in +++ b/cmd/zvol_id/Makefile.in @@ -44,6 +44,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/config/kernel-bdi-setup-and-register.m4 b/config/kernel-bdi-setup-and-register.m4 new file mode 100644 index 000000000..56fab8757 --- /dev/null +++ b/config/kernel-bdi-setup-and-register.m4 @@ -0,0 +1,15 @@ +dnl # +dnl # 2.6.34 API change +dnl # The bdi_setup_and_register() helper function is avilable and +dnl # exported by the kernel. This is a trivial helper function but +dnl # using it significantly simplifies the code surrounding setting +dnl # up and tearing down the bdi structure. +dnl # +AC_DEFUN([ZFS_AC_KERNEL_BDI_SETUP_AND_REGISTER], [ + ZFS_CHECK_SYMBOL_EXPORT( + [bdi_setup_and_register], + [mm/backing-dev.c], + [AC_DEFINE(HAVE_BDI_SETUP_AND_REGISTER, 1, + [bdi_setup_and_register() is available])], + []) +]) diff --git a/config/kernel.m4 b/config/kernel.m4 index 5490c8733..fec157a0c 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -41,6 +41,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [ ZFS_AC_KERNEL_6ARGS_SECURITY_INODE_INIT_SECURITY ZFS_AC_KERNEL_MOUNT_NODEV ZFS_AC_KERNEL_BDI + ZFS_AC_KERNEL_BDI_SETUP_AND_REGISTER AS_IF([test "$LINUX_OBJ" != "$LINUX"], [ KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ" @@ -14953,6 +14953,59 @@ fi + { $as_echo "$as_me:$LINENO: checking whether symbol bdi_setup_and_register is exported" >&5 +$as_echo_n "checking whether symbol bdi_setup_and_register is exported... " >&6; } + grep -q -E '[[:space:]]bdi_setup_and_register[[:space:]]' \ + $LINUX_OBJ/$LINUX_SYMBOLS 2>/dev/null + rc=$? + if test $rc -ne 0; then + + export=0 + for file in mm/backing-dev.c; do + grep -q -E "EXPORT_SYMBOL.*(bdi_setup_and_register)" "$LINUX/$file" 2>/dev/null + rc=$? + if test $rc -eq 0; then + + export=1 + break; + +fi + + done + if test $export -eq 0; then + + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + + +else + + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_BDI_SETUP_AND_REGISTER 1 +_ACEOF + + +fi + + +else + + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_BDI_SETUP_AND_REGISTER 1 +_ACEOF + + +fi + + + + if test "$LINUX_OBJ" != "$LINUX"; then KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ" @@ -19509,6 +19562,59 @@ fi + { $as_echo "$as_me:$LINENO: checking whether symbol bdi_setup_and_register is exported" >&5 +$as_echo_n "checking whether symbol bdi_setup_and_register is exported... " >&6; } + grep -q -E '[[:space:]]bdi_setup_and_register[[:space:]]' \ + $LINUX_OBJ/$LINUX_SYMBOLS 2>/dev/null + rc=$? + if test $rc -ne 0; then + + export=0 + for file in mm/backing-dev.c; do + grep -q -E "EXPORT_SYMBOL.*(bdi_setup_and_register)" "$LINUX/$file" 2>/dev/null + rc=$? + if test $rc -eq 0; then + + export=1 + break; + +fi + + done + if test $export -eq 0; then + + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + + +else + + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_BDI_SETUP_AND_REGISTER 1 +_ACEOF + + +fi + + +else + + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define HAVE_BDI_SETUP_AND_REGISTER 1 +_ACEOF + + +fi + + + + if test "$LINUX_OBJ" != "$LINUX"; then KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ" diff --git a/dracut/90zfs/Makefile.in b/dracut/90zfs/Makefile.in index 905ab5051..89e995095 100644 --- a/dracut/90zfs/Makefile.in +++ b/dracut/90zfs/Makefile.in @@ -42,6 +42,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/dracut/Makefile.in b/dracut/Makefile.in index 22d3eb3f7..7a1f45f6e 100644 --- a/dracut/Makefile.in +++ b/dracut/Makefile.in @@ -41,6 +41,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/etc/Makefile.in b/etc/Makefile.in index 6989c2377..999f67af3 100644 --- a/etc/Makefile.in +++ b/etc/Makefile.in @@ -41,6 +41,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/etc/init.d/Makefile.in b/etc/init.d/Makefile.in index a639233a1..697284ff8 100644 --- a/etc/init.d/Makefile.in +++ b/etc/init.d/Makefile.in @@ -42,6 +42,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/etc/zfs/Makefile.in b/etc/zfs/Makefile.in index 3f8672dbc..8975187f8 100644 --- a/etc/zfs/Makefile.in +++ b/etc/zfs/Makefile.in @@ -42,6 +42,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/include/Makefile.in b/include/Makefile.in index de3af33ec..5614daa0e 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -43,6 +43,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/include/linux/Makefile.in b/include/linux/Makefile.in index 7e65511a6..2666d4f91 100644 --- a/include/linux/Makefile.in +++ b/include/linux/Makefile.in @@ -43,6 +43,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/include/linux/vfs_compat.h b/include/linux/vfs_compat.h index cbbf21e61..825a7fd3b 100644 --- a/include/linux/vfs_compat.h +++ b/include/linux/vfs_compat.h @@ -62,23 +62,36 @@ truncate_setsize(struct inode *ip, loff_t new) } #endif /* HAVE_TRUNCATE_SETSIZE */ +#if defined(HAVE_BDI) && !defined(HAVE_BDI_SETUP_AND_REGISTER) /* - * 2.6.32 API change, - * Added backing_device_info (bdi) per super block interfaces. When - * available a bdi must be configured when using a non-device backed - * filesystem for proper writeback. It's safe to leave this code - * dormant for kernels which only support pdflush and not bdi. + * 2.6.34 API change, + * Add bdi_setup_and_register() function if not yet provided by kernel. + * It is used to quickly initialize and register a BDI for the filesystem. */ -#ifdef HAVE_BDI -#define bdi_get_sb(sb) (sb->s_bdi) -#define bdi_put_sb(sb, bdi) (sb->s_bdi = bdi) -#else -#define bdi_init(bdi) (0) -#define bdi_destroy(bdi) (0) -#define bdi_register(bdi, parent, fmt, args) (0) -#define bdi_unregister(bdi) (0) -#define bdi_get_sb(sb) (0) -#define bdi_put_sb(sb, bdi) (0) -#endif /* HAVE_BDI */ +extern atomic_long_t zfs_bdi_seq; + +static inline int +bdi_setup_and_register(struct backing_dev_info *bdi,char *name,unsigned int cap) +{ + char tmp[32]; + int error; + + bdi->name = name; + bdi->capabilities = cap; + error = bdi_init(bdi); + if (error) + return (error); + + sprintf(tmp, "%.28s%s", name, "-%d"); + error = bdi_register(bdi, NULL, tmp, + atomic_long_inc_return(&zfs_bdi_seq)); + if (error) { + bdi_destroy(bdi); + return (error); + } + + return (error); +} +#endif /* HAVE_BDI && !HAVE_BDI_SETUP_AND_REGISTER */ #endif /* _ZFS_VFS_H */ diff --git a/include/sys/Makefile.in b/include/sys/Makefile.in index 6adc1ee5a..0a5ecc39f 100644 --- a/include/sys/Makefile.in +++ b/include/sys/Makefile.in @@ -43,6 +43,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/include/sys/fm/Makefile.in b/include/sys/fm/Makefile.in index 036fd47a3..7791750fa 100644 --- a/include/sys/fm/Makefile.in +++ b/include/sys/fm/Makefile.in @@ -43,6 +43,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/include/sys/fm/fs/Makefile.in b/include/sys/fm/fs/Makefile.in index 2cff6d665..ee4a8fda5 100644 --- a/include/sys/fm/fs/Makefile.in +++ b/include/sys/fm/fs/Makefile.in @@ -43,6 +43,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/include/sys/fs/Makefile.in b/include/sys/fs/Makefile.in index fd9c14662..9d3f79a1d 100644 --- a/include/sys/fs/Makefile.in +++ b/include/sys/fs/Makefile.in @@ -43,6 +43,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/lib/Makefile.in b/lib/Makefile.in index 86b0aef75..0c919dd99 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -41,6 +41,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/lib/libavl/Makefile.in b/lib/libavl/Makefile.in index 5135c8790..43e7ac5ad 100644 --- a/lib/libavl/Makefile.in +++ b/lib/libavl/Makefile.in @@ -43,6 +43,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/lib/libefi/Makefile.in b/lib/libefi/Makefile.in index 25d61b27f..50d497122 100644 --- a/lib/libefi/Makefile.in +++ b/lib/libefi/Makefile.in @@ -43,6 +43,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/lib/libnvpair/Makefile.in b/lib/libnvpair/Makefile.in index 691c08142..9ce848511 100644 --- a/lib/libnvpair/Makefile.in +++ b/lib/libnvpair/Makefile.in @@ -43,6 +43,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/lib/libshare/Makefile.in b/lib/libshare/Makefile.in index 0025019dd..3705c7d28 100644 --- a/lib/libshare/Makefile.in +++ b/lib/libshare/Makefile.in @@ -43,6 +43,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/lib/libspl/Makefile.in b/lib/libspl/Makefile.in index 92be7c177..d2f6231a9 100644 --- a/lib/libspl/Makefile.in +++ b/lib/libspl/Makefile.in @@ -43,6 +43,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/lib/libspl/asm-generic/Makefile.in b/lib/libspl/asm-generic/Makefile.in index 8fed7b6ea..003b5eceb 100644 --- a/lib/libspl/asm-generic/Makefile.in +++ b/lib/libspl/asm-generic/Makefile.in @@ -42,6 +42,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/lib/libspl/asm-i386/Makefile.in b/lib/libspl/asm-i386/Makefile.in index 703cbf506..cd415e192 100644 --- a/lib/libspl/asm-i386/Makefile.in +++ b/lib/libspl/asm-i386/Makefile.in @@ -43,6 +43,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/lib/libspl/asm-x86_64/Makefile.in b/lib/libspl/asm-x86_64/Makefile.in index ff5ba0f2c..df8e8f96e 100644 --- a/lib/libspl/asm-x86_64/Makefile.in +++ b/lib/libspl/asm-x86_64/Makefile.in @@ -43,6 +43,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/lib/libspl/include/Makefile.in b/lib/libspl/include/Makefile.in index 6891306c2..87293bfa5 100644 --- a/lib/libspl/include/Makefile.in +++ b/lib/libspl/include/Makefile.in @@ -43,6 +43,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/lib/libspl/include/ia32/Makefile.in b/lib/libspl/include/ia32/Makefile.in index a758a73e7..2f14b4af8 100644 --- a/lib/libspl/include/ia32/Makefile.in +++ b/lib/libspl/include/ia32/Makefile.in @@ -41,6 +41,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/lib/libspl/include/ia32/sys/Makefile.in b/lib/libspl/include/ia32/sys/Makefile.in index 7d9c283d9..d01d7da9e 100644 --- a/lib/libspl/include/ia32/sys/Makefile.in +++ b/lib/libspl/include/ia32/sys/Makefile.in @@ -43,6 +43,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/lib/libspl/include/rpc/Makefile.in b/lib/libspl/include/rpc/Makefile.in index d15599a73..baaa5a002 100644 --- a/lib/libspl/include/rpc/Makefile.in +++ b/lib/libspl/include/rpc/Makefile.in @@ -43,6 +43,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/lib/libspl/include/sys/Makefile.in b/lib/libspl/include/sys/Makefile.in index 300730690..ac6916079 100644 --- a/lib/libspl/include/sys/Makefile.in +++ b/lib/libspl/include/sys/Makefile.in @@ -43,6 +43,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/lib/libspl/include/sys/dktp/Makefile.in b/lib/libspl/include/sys/dktp/Makefile.in index 4f858653e..91e105976 100644 --- a/lib/libspl/include/sys/dktp/Makefile.in +++ b/lib/libspl/include/sys/dktp/Makefile.in @@ -43,6 +43,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/lib/libspl/include/sys/sysevent/Makefile.in b/lib/libspl/include/sys/sysevent/Makefile.in index d254e86cf..db38bb06c 100644 --- a/lib/libspl/include/sys/sysevent/Makefile.in +++ b/lib/libspl/include/sys/sysevent/Makefile.in @@ -43,6 +43,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/lib/libspl/include/util/Makefile.in b/lib/libspl/include/util/Makefile.in index d9d313f02..dca1d4a88 100644 --- a/lib/libspl/include/util/Makefile.in +++ b/lib/libspl/include/util/Makefile.in @@ -43,6 +43,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/lib/libunicode/Makefile.in b/lib/libunicode/Makefile.in index 757f76b4f..af101e31d 100644 --- a/lib/libunicode/Makefile.in +++ b/lib/libunicode/Makefile.in @@ -43,6 +43,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/lib/libuutil/Makefile.in b/lib/libuutil/Makefile.in index 391ad4b53..27b02d154 100644 --- a/lib/libuutil/Makefile.in +++ b/lib/libuutil/Makefile.in @@ -43,6 +43,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/lib/libzfs/Makefile.in b/lib/libzfs/Makefile.in index 3c3c39994..cdaab9431 100644 --- a/lib/libzfs/Makefile.in +++ b/lib/libzfs/Makefile.in @@ -43,6 +43,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/lib/libzpool/Makefile.in b/lib/libzpool/Makefile.in index ec612eea3..bb20477a9 100644 --- a/lib/libzpool/Makefile.in +++ b/lib/libzpool/Makefile.in @@ -43,6 +43,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/man/Makefile.in b/man/Makefile.in index c1c9ca324..52952b118 100644 --- a/man/Makefile.in +++ b/man/Makefile.in @@ -41,6 +41,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/man/man8/Makefile.in b/man/man8/Makefile.in index 48dba3f4d..9a9967725 100644 --- a/man/man8/Makefile.in +++ b/man/man8/Makefile.in @@ -41,6 +41,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/module/zfs/zfs_vfsops.c b/module/zfs/zfs_vfsops.c index ed847f130..920d87e4f 100644 --- a/module/zfs/zfs_vfsops.c +++ b/module/zfs/zfs_vfsops.c @@ -600,12 +600,6 @@ zfs_sb_create(const char *osname, zfs_sb_t **zsbp) zsb->z_show_ctldir = ZFS_SNAPDIR_VISIBLE; zsb->z_os = os; - error = -bdi_init(&zsb->z_bdi); - if (error) { - kmem_free(zsb, sizeof (zfs_sb_t)); - return (error); - } - error = zfs_get_zplprop(os, ZFS_PROP_VERSION, &zsb->z_version); if (error) { goto out; @@ -807,7 +801,6 @@ zfs_sb_free(zfs_sb_t *zsb) zfs_fuid_destroy(zsb); - bdi_destroy(&zsb->z_bdi); mutex_destroy(&zsb->z_znodes_lock); mutex_destroy(&zsb->z_lock); list_destroy(&zsb->z_all_znodes); @@ -1089,9 +1082,9 @@ zfs_sb_teardown(zfs_sb_t *zsb, boolean_t unmounting) } EXPORT_SYMBOL(zfs_sb_teardown); -#ifdef HAVE_BDI -static atomic_long_t bdi_seq = ATOMIC_LONG_INIT(0); -#endif /* HAVE_BDI */ +#if defined(HAVE_BDI) && !defined(HAVE_BDI_SETUP_AND_REGISTER) +atomic_long_t zfs_bdi_seq = ATOMIC_LONG_INIT(0); +#endif /* HAVE_BDI && !HAVE_BDI_SETUP_AND_REGISTER */ int zfs_domount(struct super_block *sb, void *data, int silent) @@ -1118,7 +1111,23 @@ zfs_domount(struct super_block *sb, void *data, int silent) sb->s_time_gran = 1; sb->s_blocksize = recordsize; sb->s_blocksize_bits = ilog2(recordsize); - bdi_put_sb(sb, NULL); + +#ifdef HAVE_BDI + /* + * 2.6.32 API change, + * Added backing_device_info (BDI) per super block interfaces. A BDI + * must be configured when using a non-device backed filesystem for + * proper writeback. This is not required for older pdflush kernels. + * + * NOTE: Linux read-ahead is disabled in favor of zfs read-ahead. + */ + zsb->z_bdi.ra_pages = 0; + sb->s_bdi = &zsb->z_bdi; + + error = -bdi_setup_and_register(&zsb->z_bdi, "zfs", BDI_CAP_MAP_COPY); + if (error) + goto out; +#endif /* HAVE_BDI */ /* Set callback operations for the file system. */ sb->s_op = &zpl_super_operations; @@ -1143,16 +1152,6 @@ zfs_domount(struct super_block *sb, void *data, int silent) dmu_objset_set_user(zsb->z_os, zsb); mutex_exit(&zsb->z_os->os_user_ptr_lock); } else { - /* Disable Linux read-ahead handled by lower layers */ - zsb->z_bdi.ra_pages = 0; - - error = -bdi_register(&zsb->z_bdi, NULL, "zfs-%d", - atomic_long_inc_return(&bdi_seq)); - if (error) - goto out; - - bdi_put_sb(sb, &zsb->z_bdi); - error = zfs_sb_setup(zsb, B_TRUE); #ifdef HAVE_SNAPSHOT (void) zfs_snap_create(zsb); @@ -1193,10 +1192,9 @@ zfs_umount(struct super_block *sb) VERIFY(zfs_sb_teardown(zsb, B_TRUE) == 0); os = zsb->z_os; - if (bdi_get_sb(sb)) { - bdi_unregister(bdi_get_sb(sb)); - bdi_put_sb(sb, NULL); - } +#ifdef HAVE_BDI + bdi_destroy(sb->s_bdi); +#endif /* HAVE_BDI */ /* * z_os will be NULL if there was an error in diff --git a/scripts/Makefile.in b/scripts/Makefile.in index 6994a48bb..8b9a832cb 100644 --- a/scripts/Makefile.in +++ b/scripts/Makefile.in @@ -42,6 +42,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/scripts/zpios-profile/Makefile.in b/scripts/zpios-profile/Makefile.in index f172314c9..b154c9c1a 100644 --- a/scripts/zpios-profile/Makefile.in +++ b/scripts/zpios-profile/Makefile.in @@ -42,6 +42,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/scripts/zpios-test/Makefile.in b/scripts/zpios-test/Makefile.in index f48d9cc03..9408ad291 100644 --- a/scripts/zpios-test/Makefile.in +++ b/scripts/zpios-test/Makefile.in @@ -42,6 +42,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/scripts/zpool-config/Makefile.in b/scripts/zpool-config/Makefile.in index 4930111d4..8e9d3fd92 100644 --- a/scripts/zpool-config/Makefile.in +++ b/scripts/zpool-config/Makefile.in @@ -42,6 +42,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/scripts/zpool-layout/Makefile.in b/scripts/zpool-layout/Makefile.in index ea73f3388..f083be715 100644 --- a/scripts/zpool-layout/Makefile.in +++ b/scripts/zpool-layout/Makefile.in @@ -42,6 +42,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/udev/Makefile.in b/udev/Makefile.in index ff7fb618d..e34da7240 100644 --- a/udev/Makefile.in +++ b/udev/Makefile.in @@ -41,6 +41,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/udev/rules.d/Makefile.in b/udev/rules.d/Makefile.in index a91f67edc..47b84a190 100644 --- a/udev/rules.d/Makefile.in +++ b/udev/rules.d/Makefile.in @@ -42,6 +42,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \ $(top_srcdir)/config/kernel-bdev-logical-size.m4 \ + $(top_srcdir)/config/kernel-bdi-setup-and-register.m4 \ $(top_srcdir)/config/kernel-bdi.m4 \ $(top_srcdir)/config/kernel-bio-empty-barrier.m4 \ $(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \ diff --git a/zfs_config.h.in b/zfs_config.h.in index cf3c25c46..6f18dca54 100644 --- a/zfs_config.h.in +++ b/zfs_config.h.in @@ -21,6 +21,9 @@ /* struct super_block has s_bdi */ #undef HAVE_BDI +/* bdi_setup_and_register() is available */ +#undef HAVE_BDI_SETUP_AND_REGISTER + /* bio_empy_barrier() is defined */ #undef HAVE_BIO_EMPTY_BARRIER |