Changeset 777
- Timestamp:
- 07/11/08 12:17:13 (2 months ago)
- Files:
-
- 1 modified
-
Whitix/trunk/fs/vfs/bcache.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
Whitix/trunk/fs/vfs/bcache.c
r696 r777 95 95 INIT_WAITQUEUE_ENTRY(bufferWait); 96 96 97 WaitAddToQueue(&buffer->waitQueue, &bufferWait);98 99 97 do 100 98 { 99 WaitAddToQueue(&buffer->waitQueue, &bufferWait); 101 100 ThrSuspendThread(currThread); 102 103 if (!BufferLocked(buffer))104 break;105 106 101 ThrSchedule(); 107 102 }while (BufferLocked(buffer)); … … 157 152 158 153 INIT_WAITQUEUE_HEAD(&buff->waitQueue); 154 BufferLock(buff); 159 155 BlockAddToHashTable(buff); 160 156 … … 259 255 return -EFAULT; 260 256 261 /* The buffer will be unlocked in StorageEndRequest */ 262 BufferLock(buff); 257 /* Buffer should already be locked if we're coming from BlockRead */ 263 258 264 259 err=BlockSendRequestRaw(device,request); … … 308 303 309 304 request=StorageBuildRequest(buff, REQUEST_READ); 310 311 BufferLock(buff);312 305 313 306 StorageDoRequest(device,request); … … 446 439 ThrSchedule(); 447 440 448 /* Really have to go through everything? */449 441 ListForEachEntry(sDevice,&sDeviceList,list) 450 442 BlockSyncDevice(sDevice); … … 480 472 { 481 473 struct ListHead* head=BUFFER_HASH(device, blockNum); 482 struct Buffer* curr; 474 struct Buffer* curr, *ret=NULL; 475 476 PreemptDisable(); 483 477 484 478 ListForEachEntry(curr, head, list) … … 486 480 { 487 481 BufferGet(curr); 488 return curr; 482 WaitForBuffer(curr); 483 ret=curr; 484 goto out; 489 485 } 490 486 491 return NULL; 487 out: 488 PreemptEnable(); 489 return ret; 492 490 } 493 491
