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)
This commit is contained in:
Frans Kaashoek 2011-08-26 10:08:29 -04:00
parent 8a9b6dbd44
commit 3a5fa7ed90
12 changed files with 106 additions and 63 deletions

5
defs.h
View file

@ -5,6 +5,7 @@ struct inode;
struct pipe;
struct proc;
struct spinlock;
struct sleeplock;
struct stat;
struct superblock;
@ -129,6 +130,10 @@ void initlock(struct spinlock*, char*);
void release(struct spinlock*);
void pushcli(void);
void popcli(void);
void initsleeplock(struct sleeplock*);
void acquire_sleeplock(struct sleeplock*,struct spinlock*);
void release_sleeplock(struct sleeplock*);
int acquired_sleeplock(struct sleeplock*);
// string.c
int memcmp(const void*, const void*, uint);