diff -urp vboxvfs.old/utils.c vboxvfs/utils.c --- vboxvfs.old/utils.c 2009-12-29 21:28:05.000000000 +0100 +++ vboxvfs/utils.c 2009-12-29 22:17:19.000000000 +0100 @@ -49,6 +49,21 @@ static struct backing_dev_info sf_backin | BDI_CAP_EXEC_MAP, /* can be mapped for execution */ # endif }; + +int sf_bdi_init (const struct vbsf_mount_info_new *info) +{ + int err; + + err = bdi_init (&sf_backing_dev_info); + if (!err) + err = bdi_register (&sf_backing_dev_info, NULL, "vboxvfs-%s", info->name); + return err; +} + +void sf_bdi_destroy (void) +{ + bdi_destroy (&sf_backing_dev_info); +} #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 0) */ #if LINUX_VERSION_CODE < KERNEL_VERSION (2, 6, 0) diff -urp vboxvfs.old/vfsmod.c vboxvfs/vfsmod.c --- vboxvfs.old/vfsmod.c 2009-12-29 21:27:25.000000000 +0100 +++ vboxvfs/vfsmod.c 2009-12-29 22:14:03.000000000 +0100 @@ -286,6 +286,14 @@ sf_read_super_aux (struct super_block *s goto fail3; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 0) + if (sf_bdi_init (info)) { + err = -ENOMEM; /* XXX */ + LogFunc(("could not init bdi\n")); + goto fail4; + } +#endif + sf_init_inode (sf_g, iroot, &fsinfo); SET_INODE_INFO (iroot, sf_i); @@ -297,13 +305,15 @@ sf_read_super_aux (struct super_block *s if (!droot) { err = -ENOMEM; /* XXX */ LogFunc(("d_alloc_root failed\n")); - goto fail4; + goto fail5; } sb->s_root = droot; SET_GLOB_INFO (sb, sf_g); return 0; + fail5: + sf_bdi_destroy (); fail4: iput (iroot); fail3: @@ -369,6 +379,9 @@ sf_put_super (struct super_block *sb) { struct sf_glob_info *sf_g; +#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 0) + sf_bdi_destroy (); +#endif sf_g = GET_GLOB_INFO (sb); BUG_ON (!sf_g); sf_glob_free (sf_g); diff -urp vboxvfs.old/vfsmod.h vboxvfs/vfsmod.h --- vboxvfs.old/vfsmod.h 2009-12-29 21:27:25.000000000 +0100 +++ vboxvfs/vfsmod.h 2009-12-29 22:17:14.000000000 +0100 @@ -81,6 +81,13 @@ extern struct address_space_operations s extern void sf_init_inode (struct sf_glob_info *sf_g, struct inode *inode, RTFSOBJINFO *info); + +extern int +sf_bdi_init (const struct vbsf_mount_info_new *info); + +extern void +sf_bdi_destroy (void); + extern int sf_stat (const char *caller, struct sf_glob_info *sf_g, SHFLSTRING *path, RTFSOBJINFO *result, int ok_to_fail);