PERFORCE change 178876 for review

Zheng Liu lz at FreeBSD.org
Thu May 27 11:26:21 UTC 2010


http://p4web.freebsd.org/@@178876?ac=10

Change 178876 by lz at gnehzuil-freebsd on 2010/05/27 11:25:58

	       Modify remove rsv lock graunlarity.

Affected files ...

.. //depot/projects/soc2010/extfs/src/sys/fs/ext2fs/ext2_alloc.c#18 edit

Differences ...

==== //depot/projects/soc2010/extfs/src/sys/fs/ext2fs/ext2_alloc.c#18 (text+ko) ====

@@ -126,8 +126,7 @@
                 return;
 
         EXT2_TREE_LOCK(ip->i_e2fs);
-	if (rp != NULL && rp->rsv_end != EXT2_RSV_NOT_ALLOCATED)
-		ext2_remove_rsv_win(ip->i_e2fs, rp);
+        ext2_remove_rsv_win(ip->i_e2fs, rp);
         EXT2_TREE_UNLOCK(ip->i_e2fs);
 }
 
@@ -295,7 +294,7 @@
                         bpref = ext2_mapsearch(fs, bbp, bpref);
                         if (bpref < 0)
                                 return (0);
-                        goto allocated1;
+                        goto allocated;
                 }
                 EXT2_TREE_UNLOCK(fs);
 
@@ -303,15 +302,16 @@
                 len = howmany(fs->e2fs->e2fs_fpg, NBBY) - start;
                 loc = skpc(0xff, len, &bbp[start]);
                 if (loc == 0) {
-                        EXT2_TREE_LOCK(fs);
-                        if (rp->rsv_end != EXT2_RSV_NOT_ALLOCATED)
+                        if (rp->rsv_end != EXT2_RSV_NOT_ALLOCATED) {
+                                EXT2_TREE_LOCK(fs);
                                 ext2_remove_rsv_win(fs, rp);
-                        EXT2_TREE_UNLOCK(fs);
+                                EXT2_TREE_UNLOCK(fs);
+                        }
 
                         bpref = ext2_mapsearch(fs, bbp, bpref);
                         if (bpref < 0)
                                 return (0);
-                        goto allocated1;
+                        goto allocated;
                 }
                 i = start + len - loc;
                 map = bbp[i];
@@ -322,8 +322,10 @@
 
                 start = cg * fs->e2fs->e2fs_fpg + fs->e2fs->e2fs_first_dblock + bpref;
                 if (start >= rp->rsv_start &&
-                    start < rp->rsv_end)
+                    start < rp->rsv_end) {
+                        rp->rsv_alloc_hit++;
                         goto allocated;
+                }
 
                 bpref = start;
                 search_rsv = rp;
@@ -340,8 +342,6 @@
         EXT2_TREE_UNLOCK(fs);
 
 allocated:
-        rp->rsv_alloc_hit++;
-allocated1:
         setbit(bbp, (daddr_t)bpref);
         EXT2_LOCK(ump);
         fs->e2fs->e2fs_fbcount--;
@@ -379,10 +379,11 @@
         }
         
 find:
-        EXT2_TREE_LOCK(fs);
-        if (rp->rsv_end != EXT2_RSV_NOT_ALLOCATED);
+        if (rp->rsv_end != EXT2_RSV_NOT_ALLOCATED) {
+                EXT2_TREE_LOCK(fs);
                 ext2_remove_rsv_win(fs, rp);
-        EXT2_TREE_UNLOCK(fs);
+                EXT2_TREE_UNLOCK(fs);
+        }
 
         bno = ext2_mapsearch(fs, bbp, bpref);
         if (bno < 0)


More information about the p4-projects mailing list