Subject: afs/fs/cachefs super.c,1.33,1.34

From: [email-masked]
Date: Wed, 11 Jun 2003 13:11:36 +0100

Update of /home/cvs/afs/fs/cachefs
In directory phoenix.infradead.org:/tmp/cvs-serv9203/fs/cachefs

Modified Files:
	super.c 
Log Message:
register the blockdev with cachefs in fill_super rather than get_sb

Index: super.c
===================================================================
RCS file: /home/cvs/afs/fs/cachefs/super.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- super.c	11 Jun 2003 11:59:52 -0000	1.33
+++ super.c	11 Jun 2003 12:11:33 -0000	1.34
@@ -118,30 +118,13 @@
 					  char *dev_name,
 					  void *options)
 {
-	struct cachefs_search_result *srch;
 	struct super_block *sb;
 
 	_enter(",,%s,%p",dev_name,options);
 
-	/* pre-allocate an active-inode record for the FSDEF index of this cache
-	 * - we don't want to have to try and get rid of the superblock due to an error after
-	 *   we've got it
-	 */
-	srch = kmalloc(sizeof(*srch),GFP_KERNEL);
-	if (!srch) {
-		kleave(" = -ENOMEM");
-		return ERR_PTR(-ENOMEM);
-	}
-
 	/* allocate a device superblock */
 	sb = get_sb_bdev(fs_type,flags,dev_name,options,cachefs_fill_super);
 
-	/* if successful add to the list of available caches */
-	if (!IS_ERR(sb) && sb->s_fs_info)
-		cachefs_add_cache((struct cachefs_super *)sb->s_fs_info,srch);
-	else
-		kfree(srch);
-
 	_leave(" = %p",sb);
 	return sb;
 } /* end cachefs_get_sb() */
@@ -221,6 +204,7 @@
  */
 static int cachefs_fill_super(struct super_block *sb, void *_data, int silent)
 {
+	struct cachefs_search_result *srch = NULL;
 	struct cachefs_super *super = NULL;
 	struct cachefs_inode *inode = NULL, *inode2;
 	struct dentry *root = NULL;
@@ -270,6 +254,10 @@
 
 	super->vjnl_count = CACHEFS_ONDISC_VJNL_ENTS;
 
+	srch = kmalloc(sizeof(*srch),GFP_KERNEL);
+	if (!srch)
+		goto error;
+
 	/* fill in the superblock */
 	sb->s_magic		= CACHEFS_FS_MAGIC;
 	sb->s_op		= &cachefs_super_ops;
@@ -417,10 +405,15 @@
 
 	sb->s_root = root;
 
+	cachefs_add_cache((struct cachefs_super *)sb->s_fs_info,srch);
+
 	kleave(" = 0 [super=%p]",super);
 	return 0;
 
  error:
+	if (srch)
+		kfree(srch);
+
 	if (super) {
 		if (super->dmn_task) {
 			super->dmn_die = 1;
@@ -428,8 +421,8 @@
 			wait_for_completion(&super->dmn_dead);
 		}
 
-		if (super->alloc_node)		page_cache_release(super->alloc_node);
-		if (super->recycle_node)	page_cache_release(super->recycle_node);
+		cachefs_put_page(super->alloc_next);
+		cachefs_put_page(super->recycle_node);
 		if (super->rcm_atm_list)	free_page((unsigned long)super->rcm_atm_list);
 		if (super->rcm_imm_buf)		free_page((unsigned long)super->rcm_imm_buf);
 		if (super->vjnl_map)		free_page((unsigned long)super->vjnl_map);
@@ -440,14 +433,15 @@
 	if (page) {
 		wait_on_page_locked(page);
 		dbgfree(page_address(page));
-		page_cache_release(page);
+		cachefs_put_page(page);
 	}
-	if (root)	dput(root);
-	if (inode)	iput(&inode->vfs_inode);
+	if (root)
+		dput(root);
+
+	cachefs_iput(inode);
 
 	if (super) {
-		if (super->imetadata)
-			cachefs_iput(super->imetadata);
+		cachefs_iput(super->imetadata);
 		if (super->imisc)
 			iput(super->imisc);
 		dbgfree(super);