From 3a5fa7ed9020eaf8ab843a16d26db7393b2ec072 Mon Sep 17 00:00:00 2001 From: Frans Kaashoek Date: Fri, 26 Aug 2011 10:08:29 -0400 Subject: Introduce and use sleeplocks instead of BUSY flags Remove I_BUSY, B_BUSY, and intrans defs and usages One spinlock per buf to avoid ugly loop in bget fix race in filewrite (don't update f->off after releasing lock) --- buf.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'buf.h') diff --git a/buf.h b/buf.h index 9c586f2..cfeb8c6 100644 --- a/buf.h +++ b/buf.h @@ -2,12 +2,13 @@ struct buf { int flags; uint dev; uint sector; + struct spinlock lock; + struct sleeplock sleeplock; struct buf *prev; // LRU cache list struct buf *next; struct buf *qnext; // disk queue uchar data[512]; }; -#define B_BUSY 0x1 // buffer is locked by some process -#define B_VALID 0x2 // buffer has been read from disk -#define B_DIRTY 0x4 // buffer needs to be written to disk +#define B_VALID 0x1 // buffer has been read from disk +#define B_DIRTY 0x2 // buffer needs to be written to disk -- cgit v1.2.3