From 8f1e1199a2ef65ac0c5f00dcb30aeb8114c95551 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Tue, 16 Feb 2010 13:10:09 -0500 Subject: [PATCH] linux bdi allocate memory allocate bdi with osi_Alloc (and free with osi_Free) seems to fix an oops FIXES 126514 Change-Id: I667391710c5fd2b6712117471247f1cd7c20aa9b Reviewed-on: http://gerrit.openafs.org/1332 Reviewed-by: Simon Wilkinson Tested-by: Derrick Brashear Reviewed-by: Derrick Brashear --- src/afs/LINUX/osi_vfsops.c | 17 ++++++++++------- src/afs/LINUX/osi_vnodeops.c | 4 ++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/afs/LINUX/osi_vfsops.c b/src/afs/LINUX/osi_vfsops.c index 6e67e12401..47247cab2d 100644 --- a/src/afs/LINUX/osi_vfsops.c +++ b/src/afs/LINUX/osi_vfsops.c @@ -80,9 +80,7 @@ struct file_system_type afs_fs_type = { .fs_flags = FS_BINARY_MOUNTDATA, }; -struct backing_dev_info afs_backing_dev_info = { - .ra_pages = 32, -}; +struct backing_dev_info *afs_backing_dev_info; int afs_fill_super(struct super_block *sb, void *data, int silent) @@ -107,13 +105,17 @@ afs_fill_super(struct super_block *sb, void *data, int silent) sb->s_blocksize_bits = 10; sb->s_magic = AFS_VFSMAGIC; sb->s_op = &afs_sops; /* Super block (vfs) ops */ + /* used for inodes backing_dev_info field, also */ + afs_backing_dev_info = osi_Alloc(sizeof(struct backing_dev_info)); #if defined(HAVE_BDI_INIT) - bdi_init(&afs_backing_dev_info); + bdi_init(afs_backing_dev_info); #endif + afs_backing_dev_info->name = "openafs"; + afs_backing_dev_info->ra_pages = 32; #if defined (STRUCT_SUPER_BLOCK_HAS_S_BDI) - sb->s_bdi = &afs_backing_dev_info; + 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"); + bdi_register(afs_backing_dev_info, NULL, "afs"); #endif #if !defined(AFS_NONFSTRANS) sb->s_export_op = &afs_export_ops; @@ -316,8 +318,9 @@ afs_put_super(struct super_block *sbp) osi_linux_verify_alloced_memory(); #if defined(HAVE_BDI_INIT) - bdi_destroy(&afs_backing_dev_info); + bdi_destroy(afs_backing_dev_info); #endif + osi_Free(afs_backing_dev_info, sizeof(struct backing_dev_info)); AFS_GUNLOCK(); sbp->s_dev = 0; diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index a72b752637..708b1ba135 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -49,7 +49,7 @@ #define MAX_ERRNO 1000L #endif -extern struct backing_dev_info afs_backing_dev_info; +extern struct backing_dev_info *afs_backing_dev_info; extern struct vcache *afs_globalVp; extern int afs_notify_change(struct dentry *dp, struct iattr *iattrp); @@ -2463,7 +2463,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; + 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;