summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2011-08-01 18:24:40 -0700
committerBrian Behlendorf <[email protected]>2011-08-04 13:37:38 -0700
commit76659dc110ef2ada13bcb8e4e2ec60d8216c6836 (patch)
tree19de8ecbb20ae764ae16b0f05399fff16424c440
parent3c0e5c0f455576d045fa443cbab74834d70ded55 (diff)
Add backing_device_info per-filesystem
For a long time now the kernel has been moving away from using the pdflush daemon to write 'old' dirty pages to disk. The primary reason for this is because the pdflush daemon is single threaded and can be a limiting factor for performance. Since pdflush sequentially walks the dirty inode list for each super block any delay in processing can slow down dirty page writeback for all filesystems. The replacement for pdflush is called bdi (backing device info). The bdi system involves creating a per-filesystem control structure each with its own private sets of queues to manage writeback. The advantage is greater parallelism which improves performance and prevents a single filesystem from slowing writeback to the others. For a long time both systems co-existed in the kernel so it wasn't strictly required to implement the bdi scheme. However, as of Linux 2.6.36 kernels the pdflush functionality has been retired. Since ZFS already bypasses the page cache for most I/O this is only an issue for mmap(2) writes which must go through the page cache. Even then adding this missing support for newer kernels was overlooked because there are other mechanisms which can trigger writeback. However, there is one critical case where not implementing the bdi functionality can cause problems. If an application handles a page fault it can enter the balance_dirty_pages() callpath. This will result in the application hanging until the number of dirty pages in the system drops below the dirty ratio. Without a registered backing_device_info for the filesystem the dirty pages will not get written out. Thus the application will hang. As mentioned above this was less of an issue with older kernels because pdflush would eventually write out the dirty pages. This change adds a backing_device_info structure to the zfs_sb_t which is already allocated per-super block. It is then registered when the filesystem mounted and unregistered on unmount. It will not be registered for mounted snapshots which are read-only. This change will result in flush-<pool> thread being dynamically created and destroyed per-mounted filesystem for writeback. Signed-off-by: Brian Behlendorf <[email protected]> Closes #174
-rw-r--r--Makefile.in1
-rw-r--r--cmd/Makefile.in1
-rw-r--r--cmd/mount_zfs/Makefile.in1
-rw-r--r--cmd/sas_switch_id/Makefile.in1
-rw-r--r--cmd/zdb/Makefile.in1
-rw-r--r--cmd/zfs/Makefile.in1
-rw-r--r--cmd/zinject/Makefile.in1
-rw-r--r--cmd/zpios/Makefile.in1
-rw-r--r--cmd/zpool/Makefile.in1
-rw-r--r--cmd/zpool_id/Makefile.in1
-rw-r--r--cmd/zpool_layout/Makefile.in1
-rw-r--r--cmd/ztest/Makefile.in1
-rw-r--r--cmd/zvol_id/Makefile.in1
-rw-r--r--config/kernel-bdi.m418
-rw-r--r--config/kernel.m41
-rwxr-xr-xconfigure132
-rw-r--r--dracut/90zfs/Makefile.in1
-rw-r--r--dracut/Makefile.in1
-rw-r--r--etc/Makefile.in1
-rw-r--r--etc/init.d/Makefile.in1
-rw-r--r--etc/udev/Makefile.in1
-rw-r--r--etc/udev/rules.d/Makefile.in1
-rw-r--r--etc/zfs/Makefile.in1
-rw-r--r--include/Makefile.in1
-rw-r--r--include/linux/Makefile.in1
-rw-r--r--include/linux/vfs_compat.h19
-rw-r--r--include/sys/Makefile.in1
-rw-r--r--include/sys/fm/Makefile.in1
-rw-r--r--include/sys/fm/fs/Makefile.in1
-rw-r--r--include/sys/fs/Makefile.in1
-rw-r--r--include/sys/zfs_vfsops.h1
-rw-r--r--lib/Makefile.in1
-rw-r--r--lib/libavl/Makefile.in1
-rw-r--r--lib/libefi/Makefile.in1
-rw-r--r--lib/libnvpair/Makefile.in1
-rw-r--r--lib/libshare/Makefile.in1
-rw-r--r--lib/libspl/Makefile.in1
-rw-r--r--lib/libspl/asm-generic/Makefile.in1
-rw-r--r--lib/libspl/asm-i386/Makefile.in1
-rw-r--r--lib/libspl/asm-x86_64/Makefile.in1
-rw-r--r--lib/libspl/include/Makefile.in1
-rw-r--r--lib/libspl/include/ia32/Makefile.in1
-rw-r--r--lib/libspl/include/ia32/sys/Makefile.in1
-rw-r--r--lib/libspl/include/rpc/Makefile.in1
-rw-r--r--lib/libspl/include/sys/Makefile.in1
-rw-r--r--lib/libspl/include/sys/dktp/Makefile.in1
-rw-r--r--lib/libspl/include/sys/sysevent/Makefile.in1
-rw-r--r--lib/libspl/include/util/Makefile.in1
-rw-r--r--lib/libunicode/Makefile.in1
-rw-r--r--lib/libuutil/Makefile.in1
-rw-r--r--lib/libzfs/Makefile.in1
-rw-r--r--lib/libzpool/Makefile.in1
-rw-r--r--man/Makefile.in1
-rw-r--r--man/man8/Makefile.in1
-rw-r--r--module/zfs/zfs_vfsops.c27
-rw-r--r--scripts/Makefile.in1
-rw-r--r--scripts/zpios-profile/Makefile.in1
-rw-r--r--scripts/zpios-test/Makefile.in1
-rw-r--r--scripts/zpool-config/Makefile.in1
-rw-r--r--scripts/zpool-layout/Makefile.in1
-rw-r--r--zfs_config.h.in3
61 files changed, 255 insertions, 0 deletions
diff --git a/Makefile.in b/Makefile.in
index 1e3861111..dc46e32ab 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/cmd/Makefile.in b/cmd/Makefile.in
index 379fbf913..7d868d8a6 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/cmd/mount_zfs/Makefile.in b/cmd/mount_zfs/Makefile.in
index 97aa72952..ccd7a15de 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/cmd/sas_switch_id/Makefile.in b/cmd/sas_switch_id/Makefile.in
index bb6c03a09..34bb462df 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/cmd/zdb/Makefile.in b/cmd/zdb/Makefile.in
index c0db5455b..bc78a755c 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/cmd/zfs/Makefile.in b/cmd/zfs/Makefile.in
index 42a488418..7a111898e 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/cmd/zinject/Makefile.in b/cmd/zinject/Makefile.in
index b0210f8de..1897fd067 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/cmd/zpios/Makefile.in b/cmd/zpios/Makefile.in
index 363617f48..ade9237bd 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/cmd/zpool/Makefile.in b/cmd/zpool/Makefile.in
index 4d2340e16..89c7aac14 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/cmd/zpool_id/Makefile.in b/cmd/zpool_id/Makefile.in
index b4d250a74..f4e837c2d 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/cmd/zpool_layout/Makefile.in b/cmd/zpool_layout/Makefile.in
index 3445915a6..e38308a90 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/cmd/ztest/Makefile.in b/cmd/ztest/Makefile.in
index 5e8d4517d..a9460c6f1 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/cmd/zvol_id/Makefile.in b/cmd/zvol_id/Makefile.in
index 114fa20a5..ed80d404f 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/config/kernel-bdi.m4 b/config/kernel-bdi.m4
new file mode 100644
index 000000000..34ffaabd5
--- /dev/null
+++ b/config/kernel-bdi.m4
@@ -0,0 +1,18 @@
+dnl #
+dnl # 2.6.32 API change
+dnl # Private backing_device_info interfaces available
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_BDI], [
+ AC_MSG_CHECKING([whether super_block has s_bdi])
+ ZFS_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+ ],[
+ struct super_block sb __attribute__ ((unused));
+ sb.s_bdi = NULL;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_BDI, 1, [struct super_block has s_bdi])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
diff --git a/config/kernel.m4 b/config/kernel.m4
index 5eaa4d879..87c49a82c 100644
--- a/config/kernel.m4
+++ b/config/kernel.m4
@@ -40,6 +40,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
ZFS_AC_KERNEL_TRUNCATE_SETSIZE
ZFS_AC_KERNEL_6ARGS_SECURITY_INODE_INIT_SECURITY
ZFS_AC_KERNEL_MOUNT_NODEV
+ ZFS_AC_KERNEL_BDI
if test "$LINUX_OBJ" != "$LINUX"; then
KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
diff --git a/configure b/configure
index f46cc5110..9f444638f 100755
--- a/configure
+++ b/configure
@@ -14686,6 +14686,72 @@ _ACEOF
+ { $as_echo "$as_me:$LINENO: checking whether super_block has s_bdi" >&5
+$as_echo_n "checking whether super_block has s_bdi... " >&6; }
+
+
+cat confdefs.h - <<_ACEOF >conftest.c
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+
+ #include <linux/fs.h>
+
+int
+main (void)
+{
+
+ struct super_block sb __attribute__ ((unused));
+ sb.s_bdi = NULL;
+
+ ;
+ return 0;
+}
+
+_ACEOF
+
+
+ rm -Rf build && mkdir -p build
+ echo "obj-m := conftest.o" >build/Makefile
+ if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_BDI 1
+_ACEOF
+
+
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+
+
+
+fi
+
+ rm -Rf build
+
+
+
+
if test "$LINUX_OBJ" != "$LINUX"; then
KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
fi
@@ -18956,6 +19022,72 @@ _ACEOF
+ { $as_echo "$as_me:$LINENO: checking whether super_block has s_bdi" >&5
+$as_echo_n "checking whether super_block has s_bdi... " >&6; }
+
+
+cat confdefs.h - <<_ACEOF >conftest.c
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+
+ #include <linux/fs.h>
+
+int
+main (void)
+{
+
+ struct super_block sb __attribute__ ((unused));
+ sb.s_bdi = NULL;
+
+ ;
+ return 0;
+}
+
+_ACEOF
+
+
+ rm -Rf build && mkdir -p build
+ echo "obj-m := conftest.o" >build/Makefile
+ if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_BDI 1
+_ACEOF
+
+
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+
+
+
+fi
+
+ rm -Rf build
+
+
+
+
if test "$LINUX_OBJ" != "$LINUX"; then
KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
fi
diff --git a/dracut/90zfs/Makefile.in b/dracut/90zfs/Makefile.in
index 33ac12c38..d3959296a 100644
--- a/dracut/90zfs/Makefile.in
+++ b/dracut/90zfs/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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/dracut/Makefile.in b/dracut/Makefile.in
index 66ec11d7f..ee654dec9 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/etc/Makefile.in b/etc/Makefile.in
index c3ed6f260..4f012e504 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/etc/init.d/Makefile.in b/etc/init.d/Makefile.in
index 1ea6c623c..7fb9034f0 100644
--- a/etc/init.d/Makefile.in
+++ b/etc/init.d/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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/etc/udev/Makefile.in b/etc/udev/Makefile.in
index 81ba8b215..7a9a0c32f 100644
--- a/etc/udev/Makefile.in
+++ b/etc/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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/etc/udev/rules.d/Makefile.in b/etc/udev/rules.d/Makefile.in
index f5dce7fba..852d44d8b 100644
--- a/etc/udev/rules.d/Makefile.in
+++ b/etc/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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/etc/zfs/Makefile.in b/etc/zfs/Makefile.in
index 1f3db549c..ffdd1a959 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/include/Makefile.in b/include/Makefile.in
index 379657fbc..8764d0958 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/include/linux/Makefile.in b/include/linux/Makefile.in
index e0678c1ef..3a901c33e 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/include/linux/vfs_compat.h b/include/linux/vfs_compat.h
index 1d8a523cd..cbbf21e61 100644
--- a/include/linux/vfs_compat.h
+++ b/include/linux/vfs_compat.h
@@ -62,4 +62,23 @@ truncate_setsize(struct inode *ip, loff_t new)
}
#endif /* HAVE_TRUNCATE_SETSIZE */
+/*
+ * 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.
+ */
+#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 */
+
#endif /* _ZFS_VFS_H */
diff --git a/include/sys/Makefile.in b/include/sys/Makefile.in
index 53c721f67..4cf397cba 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/include/sys/fm/Makefile.in b/include/sys/fm/Makefile.in
index fce681a1e..30d2c4aff 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/include/sys/fm/fs/Makefile.in b/include/sys/fm/fs/Makefile.in
index 859972f52..76a215704 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/include/sys/fs/Makefile.in b/include/sys/fs/Makefile.in
index 61c97ab10..8567e0186 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/include/sys/zfs_vfsops.h b/include/sys/zfs_vfsops.h
index ae5f811c0..c8861f6e2 100644
--- a/include/sys/zfs_vfsops.h
+++ b/include/sys/zfs_vfsops.h
@@ -43,6 +43,7 @@ struct znode;
typedef struct zfs_sb {
struct super_block *z_sb; /* generic super_block */
+ struct backing_dev_info z_bdi; /* generic backing dev info */
struct zfs_sb *z_parent; /* parent fs */
objset_t *z_os; /* objset reference */
uint64_t z_flags; /* super_block flags */
diff --git a/lib/Makefile.in b/lib/Makefile.in
index 001235471..2f8d492cd 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/lib/libavl/Makefile.in b/lib/libavl/Makefile.in
index 05a76d471..33484b3ab 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/lib/libefi/Makefile.in b/lib/libefi/Makefile.in
index 17cf68457..ec4e14aa1 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/lib/libnvpair/Makefile.in b/lib/libnvpair/Makefile.in
index 02c351198..7d3eaa433 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/lib/libshare/Makefile.in b/lib/libshare/Makefile.in
index b2af5fdc3..6254a97b7 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/lib/libspl/Makefile.in b/lib/libspl/Makefile.in
index 11b517ae5..238ab009a 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/lib/libspl/asm-generic/Makefile.in b/lib/libspl/asm-generic/Makefile.in
index 4356f51f6..6fe820cd7 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/lib/libspl/asm-i386/Makefile.in b/lib/libspl/asm-i386/Makefile.in
index 4346d0d21..1f951adfe 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/lib/libspl/asm-x86_64/Makefile.in b/lib/libspl/asm-x86_64/Makefile.in
index e9bab0719..10226a96e 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/lib/libspl/include/Makefile.in b/lib/libspl/include/Makefile.in
index 4990f24b9..88b840495 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/lib/libspl/include/ia32/Makefile.in b/lib/libspl/include/ia32/Makefile.in
index e54dd3be5..36af1a80b 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/lib/libspl/include/ia32/sys/Makefile.in b/lib/libspl/include/ia32/sys/Makefile.in
index cbcc2e4c3..ff11b1de4 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/lib/libspl/include/rpc/Makefile.in b/lib/libspl/include/rpc/Makefile.in
index 133664598..e2ae91cf9 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/lib/libspl/include/sys/Makefile.in b/lib/libspl/include/sys/Makefile.in
index ae28b4245..eeaca9be1 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/lib/libspl/include/sys/dktp/Makefile.in b/lib/libspl/include/sys/dktp/Makefile.in
index 0d33f468c..c9b011530 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/lib/libspl/include/sys/sysevent/Makefile.in b/lib/libspl/include/sys/sysevent/Makefile.in
index 99d2433e6..c37669fc4 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/lib/libspl/include/util/Makefile.in b/lib/libspl/include/util/Makefile.in
index 553937802..70ce9733b 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/lib/libunicode/Makefile.in b/lib/libunicode/Makefile.in
index faa940e3d..6b5d57590 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/lib/libuutil/Makefile.in b/lib/libuutil/Makefile.in
index 45c4e84f5..2c2c8e5a3 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/lib/libzfs/Makefile.in b/lib/libzfs/Makefile.in
index 5dc7d3570..ad31c720a 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/lib/libzpool/Makefile.in b/lib/libzpool/Makefile.in
index 212c964d0..1b60fe324 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/man/Makefile.in b/man/Makefile.in
index 3c9e7a370..068617beb 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/man/man8/Makefile.in b/man/man8/Makefile.in
index 1c18675a6..f9fe5fb80 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/module/zfs/zfs_vfsops.c b/module/zfs/zfs_vfsops.c
index e0987e919..31692f437 100644
--- a/module/zfs/zfs_vfsops.c
+++ b/module/zfs/zfs_vfsops.c
@@ -600,6 +600,12 @@ 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;
@@ -799,6 +805,7 @@ 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);
@@ -1077,6 +1084,10 @@ zfsvfs_teardown(zfs_sb_t *zsb, boolean_t unmounting)
return (0);
}
+#ifdef HAVE_BDI
+static atomic_long_t bdi_seq = ATOMIC_LONG_INIT(0);
+#endif /* HAVE_BDI */
+
int
zfs_domount(struct super_block *sb, void *data, int silent)
{
@@ -1102,6 +1113,7 @@ 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);
/* Set callback operations for the file system. */
sb->s_op = &zpl_super_operations;
@@ -1126,6 +1138,16 @@ 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);
@@ -1166,6 +1188,11 @@ zfs_umount(struct super_block *sb)
VERIFY(zfsvfs_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);
+ }
+
/*
* z_os will be NULL if there was an error in
* attempting to reopen zsb.
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
index 51dadb458..3e0c8f904 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/scripts/zpios-profile/Makefile.in b/scripts/zpios-profile/Makefile.in
index 550fab69f..cef88fb46 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/scripts/zpios-test/Makefile.in b/scripts/zpios-test/Makefile.in
index d8627109d..8dbaa6b3d 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/scripts/zpool-config/Makefile.in b/scripts/zpool-config/Makefile.in
index 530fb2332..3a8d836dd 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/scripts/zpool-layout/Makefile.in b/scripts/zpool-layout/Makefile.in
index 2a000783c..e34d0dce8 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.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
$(top_srcdir)/config/kernel-bio-failfast.m4 \
diff --git a/zfs_config.h.in b/zfs_config.h.in
index d244ac383..cf3c25c46 100644
--- a/zfs_config.h.in
+++ b/zfs_config.h.in
@@ -18,6 +18,9 @@
/* bdev_logical_block_size() is available */
#undef HAVE_BDEV_LOGICAL_BLOCK_SIZE
+/* struct super_block has s_bdi */
+#undef HAVE_BDI
+
/* bio_empy_barrier() is defined */
#undef HAVE_BIO_EMPTY_BARRIER