PERFORCE change 171300 for review

Aditya Sarawgi truncs at FreeBSD.org
Wed Dec 2 20:14:16 UTC 2009


http://p4web.freebsd.org/chv.cgi?CH=171300

Change 171300 by truncs at aditya on 2009/12/02 20:13:46

	Get rid of the unwanted #ifdef ugliness.

Affected files ...

.. //depot/projects/soc2009/soc_ext2fs/src/sys/fs/ext2fs/ext2_balloc.c#9 edit

Differences ...

==== //depot/projects/soc2009/soc_ext2fs/src/sys/fs/ext2fs/ext2_balloc.c#9 (text+ko) ====

@@ -167,24 +167,9 @@
 	--num;
 	nb = ip->i_ib[indirs[0].in_off];
 	if (nb == 0) {
-#if 0
-		pref = ext2_blkpref(ip, lbn, 0, (int32_t *)0, 0);
-#else
-		/* see the comment by ext2_blkpref. What we do here is
-		   to pretend that it'd be good for a block holding indirect
-		   pointers to be allocated near its predecessor in terms 
-		   of indirection, or the last direct block. 
-		   We shamelessly exploit the fact that i_ib immediately
-		   follows i_db. 
-		   Godmar thinks it make sense to allocate i_ib[0] immediately
-		   after i_db[11], but it's not utterly clear whether this also
-		   applies to i_ib[1] and i_ib[0]
-		*/
-
 		EXT2_LOCK(ump);
 		pref = ext2_blkpref(ip, lbn, indirs[0].in_off + 
 					     EXT2_NDIR_BLOCKS, &ip->i_db[0], 0);
-#endif
 	        if ((error = ext2_alloc(ip, lbn, pref, 
 			(int)fs->e2fs_bsize, cred, &newb)))
 			return (error);
@@ -222,22 +207,13 @@
 			bqrelse(bp);
 			continue;
 		}
-		if (pref == 0) 
-#if 1
-			/* see the comment above and by ext2_blkpref
-			 * I think this implements Linux policy, but
-			 * does it really make sense to allocate to
-			 * block containing pointers together ?
-			 * Also, will it ever succeed ?
-			 */
-			pref = ext2_blkpref(ip, lbn, indirs[i].in_off, bap,
-						bp->b_lblkno);
-#else
+		if (pref == 0) { 
 			EXT2_LOCK(ump);
 			pref = ext2_blkpref(ip, lbn, 0, (int32_t *)0, 0);
-#endif
-		if ((error =
-		    ext2_alloc(ip, lbn, pref, (int)fs->e2fs_bsize, cred, &newb)) != 0) {
+		} else 
+			EXT2_LOCK(ump);
+		error =  ext2_alloc(ip, lbn, pref, (int)fs->e2fs_bsize, cred, &newb);
+		if(error) {
 			brelse(bp);
 			return (error);
 		}


More information about the p4-projects mailing list