DEVEL15-linux-disable-readahad-20081108

LICENSE IPL10
FIXES 123604

The code has long contained a backing_dev_info structure, but it
was never attached to anything.  Initialize its use properly with
bdi_init, and attach it to i_mapping for every newly filled inode.
bdi_init and bdi_destroy are needed for proper initialization of
some percpu counters, otherwise we get some oopses.


(cherry picked from commit 18e78d91e78e541fce6c9295919946af0744aa7e)
This commit is contained in:
Marc Dionne 2008-11-08 16:13:59 +00:00 committed by Derrick Brashear
parent 230c54bef4
commit 856e99dcdf
4 changed files with 21 additions and 0 deletions

View File

@ -829,6 +829,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
LINUX_EXPORTS_FIND_TASK_BY_PID
LINUX_EXPORTS_PROC_ROOT_FS
LINUX_HAVE_CURRENT_KERNEL_TIME
LINUX_HAVE_BDI_INIT
LINUX_KMEM_CACHE_INIT
LINUX_HAVE_KMEM_CACHE_T
LINUX_KMEM_CACHE_CREATE_TAKES_DTOR

View File

@ -149,6 +149,9 @@ afs_read_super(struct super_block *sb, void *data, int silent)
#if defined(AFS_LINUX26_ENV) && !defined(AFS_NONFSTRANS)
sb->s_export_op = &afs_export_ops;
#endif
#if defined(HAVE_BDI_INIT)
bdi_init(&afs_backing_dev_info);
#endif
#if defined(MAX_NON_LFS)
#ifdef AFS_64BIT_CLIENT
#if !defined(MAX_LFS_FILESIZE)
@ -400,6 +403,9 @@ afs_put_super(struct super_block *sbp)
#endif
osi_linux_verify_alloced_memory();
#if defined(HAVE_BDI_INIT)
bdi_destroy(&afs_backing_dev_info);
#endif
AFS_GUNLOCK();
sbp->s_dev = 0;

View File

@ -53,6 +53,7 @@ RCSID
#if defined(AFS_LINUX26_ENV)
#define LockPage(pp) lock_page(pp)
#define UnlockPage(pp) unlock_page(pp)
extern struct backing_dev_info afs_backing_dev_info;
#endif
extern struct vcache *afs_globalVp;
@ -2231,6 +2232,7 @@ afs_fill_inode(struct inode *ip, struct vattr *vattr)
if (vattr)
vattr2inode(ip, vattr);
ip->i_mapping->backing_dev_info = &afs_backing_dev_info;
/* Reset ops if symlink or directory. */
if (S_ISREG(ip->i_mode)) {
ip->i_op = &afs_file_iops;

View File

@ -1092,3 +1092,15 @@ AC_DEFUN([LINUX_SEMAPHORE_H_EXISTS], [
AC_DEFINE([LINUX_SEMAPHORE_H], 1, [define if linux/semaphore.h exists])
fi])
AC_DEFUN([LINUX_HAVE_BDI_INIT], [
AC_MSG_CHECKING([for linux bdi_init()])
AC_CACHE_VAL([ac_cv_linux_bdi_init], [
AC_TRY_KBUILD(
[#include <linux/backing-dev.h>],
[bdi_init(NULL);],
ac_cv_linux_bdi_init=yes,
ac_cv_linux_bdi_init=no)])
AC_MSG_RESULT($ac_cv_linux_bdi_init)
if test "x$ac_cv_linux_bdi_init" = "xyes"; then
AC_DEFINE([HAVE_BDI_INIT], 1, [define if your kernel has a bdi_init()])
fi])