summaryrefslogtreecommitdiff
path: root/bio.c
diff options
context:
space:
mode:
Diffstat (limited to 'bio.c')
-rw-r--r--bio.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bio.c b/bio.c
index 88b0964..de1d0f2 100644
--- a/bio.c
+++ b/bio.c
@@ -79,9 +79,9 @@ bget(uint dev, uint sector)
}
}
- // Not cached; recycle some existing buffer.
+ // Not cached; recycle some non-busy and clean buffer.
for(b = bcache.head.prev; b != &bcache.head; b = b->prev){
- if((b->flags & B_BUSY) == 0){
+ if((b->flags & B_BUSY) == 0 && (b->flags & B_DIRTY) == 0){
b->dev = dev;
b->sector = sector;
b->flags = B_BUSY;