- 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
This commit is contained in:
Jeff Roberson 2003-08-28 00:52:23 +00:00
parent 289dc689c6
commit 7abc12de03
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=119512
2 changed files with 4 additions and 20 deletions

View File

@ -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); \

View File

@ -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); \