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 <sxw@inf.ed.ac.uk>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Derrick Brashear 2010-02-16 13:10:09 -05:00
parent 86acebb123
commit 8f1e1199a2
2 changed files with 12 additions and 9 deletions

View File

@ -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;

View File

@ -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;