PERFORCE change 165288 for review
Aditya Sarawgi
truncs at FreeBSD.org
Fri Jun 26 20:57:49 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=165288
Change 165288 by truncs at aditya on 2009/06/26 20:57:45
Super block locking.
Affected files ...
.. //depot/projects/soc2009/soc_ext2fs/src/sys/gnu/fs/ext2fs/ext2_alloc.c#14 edit
Differences ...
==== //depot/projects/soc2009/soc_ext2fs/src/sys/gnu/fs/ext2fs/ext2_alloc.c#14 (text+ko) ====
@@ -635,11 +635,13 @@
fs = ip->i_e2fs;
if (fs->e2fs_gd[cg].ext2bgd_nbfree == 0)
return (0);
+ lock_super(DEVVP(ip));
error = bread(ip->i_devvp, fsbtodb(fs,
fs->e2fs_gd[cg].ext2bgd_b_bitmap),
(int)fs->e2fs_bsize, NOCRED, &bp);
if (error) {
brelse(bp);
+ unlock_super(DEVVP(ip));
return (0);
}
bbp = (char *)bp->b_data;
@@ -681,8 +683,10 @@
}
bno = ext2fs_mapsearch(fs, bbp, bpref);
- if (bno < 0)
+ if (bno < 0){
+ unlock_super(DEVVP(ip));
return (0);
+ }
gotit:
#ifdef DIAGNOSTIC
if (isset(bbp, (daddr_t)bno)) {
@@ -696,7 +700,7 @@
fs->e2fs_gd[cg].ext2bgd_nbfree--;
mark_buffer_dirty(bp);
fs->e2fs_fmod = 1;
-
+ unlock_super(DEVVP(ip));
return (cg * fs->e2fs.e2fs_fpg + fs->e2fs.e2fs_first_dblock + bno);
}
@@ -720,11 +724,13 @@
fs = ip->i_e2fs;
if (fs->e2fs_gd[cg].ext2bgd_nifree == 0)
return (0);
+ lock_super(DEVVP(ip));
error = bread(ip->i_devvp, fsbtodb(fs,
fs->e2fs_gd[cg].ext2bgd_i_bitmap),
(int)fs->e2fs_bsize, NOCRED, &bp);
if (error) {
brelse(bp);
+ unlock_super(DEVVP(ip));
return (0);
}
ibp = (char *)bp->b_data;
@@ -757,6 +763,7 @@
fs->e2fs_gd[cg].ext2bgd_ndirs++;
}
mark_buffer_dirty(bp);
+ unlock_buffer(DEVVP(ip));
return (cg * fs->e2fs.e2fs_ipg + ipref +1);
}
More information about the p4-projects
mailing list