From ec0474c458fa4162bdea016821c68694840ce909 Mon Sep 17 00:00:00 2001 From: dyson Date: Mon, 4 Aug 1997 05:10:31 +0000 Subject: Fix a problem with ext2fs so that filesystems mounted at reboot don't keep ahold of buffers, and therefore leave filesystems dirty. I haven't been able to test, but the code compiles. Those who run -current, please test and report back!!! (Sorry :-)). PR: kern/3571 Submitted by: Dirk Keunecke --- sys/gnu/fs/ext2fs/fs.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'sys/gnu/fs/ext2fs/fs.h') diff --git a/sys/gnu/fs/ext2fs/fs.h b/sys/gnu/fs/ext2fs/fs.h index 03f137c..3cb4fc0 100644 --- a/sys/gnu/fs/ext2fs/fs.h +++ b/sys/gnu/fs/ext2fs/fs.h @@ -155,3 +155,23 @@ extern u_char *fragtbl[]; #define lock_super(devvp) vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, curproc) #define unlock_super(devvp) VOP_UNLOCK(devvp, 0, curproc) +/* + * 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 ULCK_BUF(bp) { \ + int s; \ + s = splbio(); \ + (bp)->b_flags &= ~B_LOCKED; \ + splx(s); \ + bremfree(bp); \ + brelse(bp); \ +} -- cgit v1.1