Changeset 800 for Whitix/branches
- Timestamp:
- 07/14/08 20:33:50 (4 months ago)
- Files:
-
- 1 modified
-
Whitix/branches/fs/fs/journal/journals.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
Whitix/branches/fs/fs/journal/journals.c
r786 r800 54 54 struct JournalHead* ret; 55 55 56 PreemptDisable(); 57 56 58 if (BufferJournal(buffer)) 57 59 { … … 64 66 ret->buffer=buffer; 65 67 INIT_WAITQUEUE_HEAD(&ret->wait); 68 INIT_LIST_HEAD(&ret->next); 66 69 67 70 BufferGet(buffer); 68 71 } 72 73 ret->refs++; 74 75 PreemptEnable(); 76 77 // KePrint("JournalAddHeader = %#X, %u\n", ret, ret->refs); 69 78 70 79 return ret; 80 } 81 82 void JournalRemoveHeader(struct JournalHead* header) 83 { 84 header->refs--; 85 86 if (!header->refs) 87 { 88 PreemptDisable(); 89 90 BufferRelease(header->buffer); 91 header->buffer->privData=NULL; 92 header->buffer->flags &= ~(1 << BUFFER_JOURNAL); 93 WakeUp(&header->wait); 94 95 free(header); 96 PreemptEnable(); 97 } 71 98 } 72 99 … … 97 124 /* Set up timer. */ 98 125 commitTimer->func=SleepWakeup; 99 commitTimer->expires=journal->commitInterval*100000 /HZ;126 commitTimer->expires=journal->commitInterval*100000; 100 127 commitTimer->data=currThread; 101 128 … … 137 164 ThrSuspendThread(currThread); 138 165 ThrSchedule(); /* Will return here when the thread is scheduled again */ 166 TimerRemove(&commitTimer); 167 139 168 WaitRemoveFromQueue(&journal->commitWait, &commitWait); 140 169 … … 158 187 159 188 oldBuf=JournHeadToBuffer(old); 160 161 189 newBuf=BlockBufferAlloc(oldBuf->device, blockNo); 162 190 163 191 /* Buffer is now locked, so copy over the data from old's buffer. */ 164 memcpy(newBuf->data, oldBuf->data, oldBuf->device-> blockSize);192 memcpy(newBuf->data, oldBuf->data, oldBuf->device->softBlockSize); 165 193 166 194 *new=JournalAddHeader(newBuf); … … 205 233 return NULL; 206 234 207 memset(buffer->data, 0, journal->sectorSize);235 memset(buffer->data, journal->sectorSize, 0); 208 236 209 237 return JournalAddHeader(buffer); … … 212 240 int JournalDestroy(struct Journal* journal) 213 241 { 214 /* Shut down the committer thread. */242 /* Shut down the committer thread. */ 215 243 journal->flags|=JOURN_UNMOUNT; 216 244 WakeUp(&journal->commitWait); … … 222 250 JournalLock(journal); 223 251 224 JournalCheckpoint(journal); 252 while (!ListEmpty(&journal->checkpointTrans)) 253 JournalCheckpoint(journal); 225 254 226 255 journal->tail=0;
