5304310452
Use refcnt to pin blocks into the cache Replace flags/B_VALID with a boolean field valid Use info[id].status to signal completion of disk interrupt Pass a read/write flag to virtio_disk_rw
13 lines
247 B
C
13 lines
247 B
C
struct buf {
|
|
int valid; // has data been read from disk?
|
|
uint dev;
|
|
uint blockno;
|
|
struct sleeplock lock;
|
|
uint refcnt;
|
|
struct buf *prev; // LRU cache list
|
|
struct buf *next;
|
|
struct buf *qnext; // disk queue
|
|
uchar data[BSIZE];
|
|
};
|
|
|