summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2003-08-28 00:52:23 +0000
committerjeff <jeff@FreeBSD.org>2003-08-28 00:52:23 +0000
commitfd0b166b71c15af75d2190250d396854e4d82787 (patch)
treecab2c27d94406d08a8ec7b75be6542ca9b3d238c /sys
parent9d9494d58d14ab797db5ae8f3082a45dc5568e3e (diff)
downloadFreeBSD-src-fd0b166b71c15af75d2190250d396854e4d82787.zip
FreeBSD-src-fd0b166b71c15af75d2190250d396854e4d82787.tar.gz
- In LCK_BUF() simply change the owner of the buf to the kernel.
- In ULCK_BUF we no longer need to acquire the lock, just write the buf out. - The combination of these changes eliminates one more use of B_LOCKED which is in the way of making the buffer cache SMP safe. In the long term ext2fs should probably not try to optimize the use of their metadata bufs with a private cache. This will starve the rest of the system for buffers in the extreme case. Discussed with: bde (A long time ago..) Tested on: md disk/x86
Diffstat (limited to 'sys')
-rw-r--r--sys/gnu/ext2fs/fs.h12
-rw-r--r--sys/gnu/fs/ext2fs/fs.h12
2 files changed, 4 insertions, 20 deletions
diff --git a/sys/gnu/ext2fs/fs.h b/sys/gnu/ext2fs/fs.h
index 9c0cf71..c54f979 100644
--- a/sys/gnu/ext2fs/fs.h
+++ b/sys/gnu/ext2fs/fs.h
@@ -156,22 +156,14 @@ extern u_char *fragtbl[];
* To lock a buffer, set the B_LOCKED flag and then brelse() it. To unlock,
* reset the B_LOCKED flag and brelse() the buffer back on the LRU list
*/
-#define LCK_BUF(bp) { \
- int s; \
- s = splbio(); \
- (bp)->b_flags |= B_LOCKED; \
- splx(s); \
- brelse(bp); \
-}
+#define LCK_BUF(bp) BUF_KERNPROC(bp);
#define ULCK_BUF(bp) { \
long flags; \
int s; \
s = splbio(); \
- BUF_LOCK(bp, LK_EXCLUSIVE, NULL); \
flags = (bp)->b_flags; \
- (bp)->b_flags &= ~(B_DIRTY | B_LOCKED); \
- bremfree(bp); \
+ (bp)->b_flags &= ~(B_DIRTY); \
splx(s); \
if (flags & B_DIRTY) \
bwrite(bp); \
diff --git a/sys/gnu/fs/ext2fs/fs.h b/sys/gnu/fs/ext2fs/fs.h
index 9c0cf71..c54f979 100644
--- a/sys/gnu/fs/ext2fs/fs.h
+++ b/sys/gnu/fs/ext2fs/fs.h
@@ -156,22 +156,14 @@ extern u_char *fragtbl[];
* To lock a buffer, set the B_LOCKED flag and then brelse() it. To unlock,
* reset the B_LOCKED flag and brelse() the buffer back on the LRU list
*/
-#define LCK_BUF(bp) { \
- int s; \
- s = splbio(); \
- (bp)->b_flags |= B_LOCKED; \
- splx(s); \
- brelse(bp); \
-}
+#define LCK_BUF(bp) BUF_KERNPROC(bp);
#define ULCK_BUF(bp) { \
long flags; \
int s; \
s = splbio(); \
- BUF_LOCK(bp, LK_EXCLUSIVE, NULL); \
flags = (bp)->b_flags; \
- (bp)->b_flags &= ~(B_DIRTY | B_LOCKED); \
- bremfree(bp); \
+ (bp)->b_flags &= ~(B_DIRTY); \
splx(s); \
if (flags & B_DIRTY) \
bwrite(bp); \
OpenPOWER on IntegriCloud