Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Oct 2009 20:48:41 GMT
From:      Aditya Sarawgi <truncs@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 169625 for review
Message-ID:  <200910202048.n9KKmfw7012796@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/chv.cgi?CH=169625

Change 169625 by truncs@aditya on 2009/10/20 20:47:46

	Apply locks to ext2_balloc.

Affected files ...

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

Differences ...

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

@@ -64,6 +64,7 @@
 	int flags;
 {
 	struct m_ext2fs *fs;
+	struct ext2mount *ump;
 	int32_t nb;
 	struct buf *bp, *nbp;
 	struct vnode *vp = ITOV(ip);
@@ -75,6 +76,7 @@
 	if (lbn < 0)
 		return (EFBIG);
 	fs = ip->i_e2fs;
+	ump = ip->i_ump;
 
 	/*
 	 * check if this is a sequential block allocation. 
@@ -133,6 +135,7 @@
 				nsize = fragroundup(fs, size);
 			else
 				nsize = fs->e2fs_bsize;
+			EXT2_LOCK(ump);	
 			error = ext2_alloc(ip, lbn,
 			    ext2_blkpref(ip, lbn, (int)lbn, &ip->i_db[0], 0),
 			    nsize, cred, &newb);
@@ -177,7 +180,8 @@
 		   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
@@ -228,7 +232,8 @@
 			 */
 			pref = ext2_blkpref(ip, lbn, indirs[i].in_off, bap,
 						bp->b_lblkno);
-#else
+#else			
+			EXT2_LOCK(ump);
 			pref = ext2_blkpref(ip, lbn, 0, (int32_t *)0, 0);
 #endif
 		if ((error =
@@ -264,6 +269,7 @@
 	 * Get the data block, allocating if necessary.
 	 */
 	if (nb == 0) {
+		EXT2_LOCK(ump);
 		pref = ext2_blkpref(ip, lbn, indirs[i].in_off, &bap[0], 
 				bp->b_lblkno);
 		if ((error = ext2_alloc(ip,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200910202048.n9KKmfw7012796>