cleanup loop
This commit is contained in:
parent
2186f88c21
commit
0655445ba9
1 changed files with 10 additions and 12 deletions
8
bio.c
8
bio.c
|
@ -71,12 +71,9 @@ bget(uint dev, uint sector)
|
|||
|
||||
loop:
|
||||
// Try for cached block.
|
||||
for(b = bufhead.next; b != &bufhead; b = b->next)
|
||||
for(b = bufhead.next; b != &bufhead; b = b->next){
|
||||
if((b->flags & (B_BUSY|B_VALID)) &&
|
||||
b->dev == dev && b->sector == sector)
|
||||
break;
|
||||
|
||||
if(b != &bufhead){
|
||||
b->dev == dev && b->sector == sector){
|
||||
if(b->flags & B_BUSY){
|
||||
sleep(buf, &buf_table_lock);
|
||||
goto loop;
|
||||
|
@ -86,6 +83,7 @@ bget(uint dev, uint sector)
|
|||
release(&buf_table_lock);
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
// Allocate fresh block.
|
||||
for(b = bufhead.prev; b != &bufhead; b = b->prev){
|
||||
|
|
Loading…
Reference in a new issue