From db23268f682564000f2ac4f9f845d4fd261d4c90 Mon Sep 17 00:00:00 2001 From: Marc Dionne Date: Thu, 17 Sep 2009 16:57:52 -0400 Subject: [PATCH] Linux: 2.6.32 - Adapt to writeback changes Adapt to the writeback changes in kernel 2.6.32 - Since we define our own backing_dev, it needs to be registered with the writeback code and attached to the super_block. Otherwise it might get ignored when writeback is needed. - Each backing_dev now gets its own kernel thread. The name of the thread is based on the registered name - the openafs one will appear as "flush-afs". Reviewed-on: http://gerrit.openafs.org/574 Tested-by: Derrick Brashear Reviewed-by: Derrick Brashear --- acinclude.m4 | 1 + src/afs/LINUX/osi_vfsops.c | 5 +++++ src/cf/linux-test4.m4 | 15 +++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/acinclude.m4 b/acinclude.m4 index 03a98547a2..275bc22c97 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -904,6 +904,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) LINUX_DEFINES_FOR_EACH_PROCESS LINUX_DEFINES_PREV_TASK LINUX_FS_STRUCT_SUPER_HAS_ALLOC_INODE + LINUX_STRUCT_SUPER_BLOCK_HAS_S_BDI LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_GFP_MASK LINUX_FS_STRUCT_INODE_HAS_I_ALLOC_SEM diff --git a/src/afs/LINUX/osi_vfsops.c b/src/afs/LINUX/osi_vfsops.c index 89f5612729..8f2b4012f4 100644 --- a/src/afs/LINUX/osi_vfsops.c +++ b/src/afs/LINUX/osi_vfsops.c @@ -108,6 +108,11 @@ afs_fill_super(struct super_block *sb, void *data, int silent) #if defined(HAVE_BDI_INIT) bdi_init(&afs_backing_dev_info); #endif +#if defined (STRUCT_SUPER_BLOCK_HAS_S_BDI) + sb->s_bdi = &afs_backing_dev_info; + /* The name specified here will appear in the flushing thread name - flush-afs */ + bdi_register(&afs_backing_dev_info, NULL, "afs"); +#endif #if !defined(AFS_NONFSTRANS) sb->s_export_op = &afs_export_ops; #endif diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4 index 306587d426..6763f15583 100644 --- a/src/cf/linux-test4.m4 +++ b/src/cf/linux-test4.m4 @@ -1289,3 +1289,18 @@ AC_DEFUN([LINUX_KEYS_HAVE_SESSION_TO_PARENT], [ if test "x$ac_cv_linux_have_session_to_parent" = "xyes"; then AC_DEFINE([HAVE_SESSION_TO_PARENT], 1, [define if keyctl has the KEYCTL_SESSION_TO_PARENT function]) fi]) + +AC_DEFUN([LINUX_STRUCT_SUPER_BLOCK_HAS_S_BDI], [ + AC_MSG_CHECKING([if struct super_block has s_bdi]) + AC_CACHE_VAL([ac_cv_linux_struct_super_block_has_s_bdi], [ + AC_TRY_KBUILD( +[#include ], +[struct super_block _sb; +_sb.s_bdi= NULL;], + ac_cv_linux_struct_super_block_has_s_bdi=yes, + ac_cv_linux_struct_super_block_has_s_bdi=no)]) + AC_MSG_RESULT($ac_cv_linux_struct_super_block_has_s_bdi) + if test "x$ac_cv_linux_struct_super_block_has_s_bdi" = "xyes"; then + AC_DEFINE([STRUCT_SUPER_BLOCK_HAS_S_BDI], 1, [define if struct super_block has an s_bdi member]) + fi]) +