PERFORCE change 165547 for review

Aditya Sarawgi truncs at FreeBSD.org
Thu Jul 2 16:46:55 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=165547

Change 165547 by truncs at aditya on 2009/07/02 16:46:32

	1) Remove #ifdef 
	2) get group descriptors using get_group_desc2()

Affected files ...

.. //depot/projects/soc2009/soc_ext2fs/src/sys/gnu/fs/ext2fs/ext2_alloc.c#24 edit

Differences ...

==== //depot/projects/soc2009/soc_ext2fs/src/sys/gnu/fs/ext2fs/ext2_alloc.c#24 (text+ko) ====

@@ -51,9 +51,7 @@
 #include <gnu/fs/ext2fs/fs.h>
 #include <gnu/fs/ext2fs/ext2_extern.h>
 
-#ifdef notyet
 static daddr_t	ext2_alloccg(struct inode *, int, daddr_t, int);
-#endif
 static u_long	ext2_dirpref(struct m_ext2fs *);
 static void	ext2_fserr(struct m_ext2fs *, u_int, char *);
 static struct ext2_gd *	 get_group_desc2(struct m_ext2fs *, int, struct buf **);
@@ -61,9 +59,7 @@
 				daddr_t (*)(struct inode *, int, daddr_t, 
 						int));
 static daddr_t	ext2_nodealloccg(struct inode *, int, daddr_t, int);
-#ifdef notyet
 static daddr_t  ext2_mapsearch(struct m_ext2fs *, char *, daddr_t);
-#endif
 
 /*
  * Linux calls this functions at the following locations:
@@ -670,7 +666,6 @@
  * Check to see if a block of the appropriate size is available,
  * and if it is, allocate it.
  */
-#ifdef notyet
 static daddr_t
 ext2_alloccg(struct inode *ip, int cg, daddr_t bpref, int size)
 {
@@ -682,16 +677,14 @@
 	int error, bno, start, end, loc;
 	
 	fs = ip->i_e2fs;
-	gdp = (struct ext2_gd *) fs->e2fs_group_desc[cg]->b_data;
+	gdp = get_group_desc2(fs, cg, NULL);
 	if (gdp->ext2bgd_nbfree == 0)
 		return (0);
-	lock_super(DEVVP(ip));
 	error = bread(ip->i_devvp, fsbtodb(fs,
 		gdp->ext2bgd_b_bitmap),
 		(int)fs->e2fs_bsize, NOCRED, &bp);
 	if (error) {
 		brelse(bp);
-		unlock_super(DEVVP(ip));
 		return (0);
 	}
 	bbp = (char *)bp->b_data;
@@ -748,12 +741,10 @@
 	setbit(bbp, (daddr_t)bno);
 	fs->e2fs->e2fs_fbcount--;
 	gdp->ext2bgd_nbfree--;
-	mark_buffer_dirty2(bp);
 	fs->e2fs_fmod = 1;
-	unlock_super(DEVVP(ip));
+	bdwrite(bp);
 	return (cg * fs->e2fs->e2fs_fpg + fs->e2fs->e2fs_first_dblock + bno);
 }
-#endif
 /*
  * Determine whether an inode can be allocated.
  *
@@ -842,7 +833,6 @@
  * It is a panic if a request is made to find a block if none are
  * available.
  */
-#ifdef notyet
 static daddr_t
 ext2_mapsearch(struct m_ext2fs *fs, char *bbp, daddr_t bpref)
 {
@@ -881,7 +871,6 @@
 	panic("ext2fs_mapsearch: block not in map");
 	/* NOTREACHED */
 }
-#endif
 
 /*
  * This function is taken from ext2_linux_ialloc.c and is under GPL. NetBSD has e2fs_gd which contains all the group desc and is


More information about the p4-projects mailing list