Changeset 756
- Timestamp:
- 07/08/08 18:16:50 (2 months ago)
- Location:
- Whitix/branches/fs/fs/journal
- Files:
-
- 3 modified
-
init.c (modified) (2 diffs)
-
journals.c (modified) (1 diff)
-
transaction.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
Whitix/branches/fs/fs/journal/init.c
r751 r756 26 26 struct Thread* journalCommitter=NULL; 27 27 28 struct Cache* journalCache=NULL ;28 struct Cache* journalCache=NULL, *journHandleCache=NULL, *journTransCache=NULL; 29 29 30 30 static void JournalCommitter() … … 45 45 /* Init caches. */ 46 46 journalCache=MemCacheCreate("Journal cache", sizeof(struct Journal), NULL, NULL, 0); 47 journHandleCache=MemCacheCreate("Journal handle cache", 48 sizeof(struct JournalHandle), NULL, NULL, 0); 49 journTransCache=MemCacheCreate("Journal transaction cache", 50 sizeof(struct JournalTrans), NULL, NULL, 0); 47 51 48 52 journalCommitter=ThrCreateKernelThread(JournalCommitter); -
Whitix/branches/fs/fs/journal/journals.c
r751 r756 88 88 journal->maxLength=vNode->size/BYTES_PER_SECTOR(vNode->superBlock); 89 89 journal->sectorSize=BYTES_PER_SECTOR(vNode->superBlock); 90 journal->transSequence=1; 90 91 91 92 if (BeToCpu32(jSb->maxLen) < journal->maxLength) -
Whitix/branches/fs/fs/journal/transaction.c
r751 r756 22 22 #include <slab.h> 23 23 24 extern struct Cache* journHandleCache ;24 extern struct Cache* journHandleCache, *journTransCache; 25 25 26 int JournalTransCreate(struct Journal* journal) 26 /******************************************************************************* 27 * 28 * FUNCTION: JournalTransCreate 29 * 30 * DESCRIPTION: Create a new current transaction for the journal. The journal 31 * lock must be held on entry to this function. Create it in a 32 * RUNNING state and add it to the new journal. 33 * 34 * PARAMETERS: journal - the journal to create a new filesystem transaction for 35 * 36 * RETURNS: a structure representing the new current transaction for the 37 * journal. 38 * 39 ******************************************************************************/ 40 41 struct JournalTrans* JournalTransCreate(struct Journal* journal) 27 42 { 28 KePrint("JournalTransCreate\n"); 43 struct JournalTrans* ret; 44 45 ret=(struct JournalTrans*)MemCacheAlloc(journTransCache); 46 47 if (!ret) 48 return NULL; 49 50 ret->journal=journal; 51 ret->state=JTRANS_RUNNING; 52 ret->transId=journal->transSequence++; 53 54 /* TODO: Set up timer. */ 55 56 journal->currTransaction=ret; 57 58 return ret; 29 59 } 30 60 … … 32 62 { 33 63 int numBlocks=handle->numBlocks; 64 struct JournalTrans* trans; 65 int needed; 34 66 35 67 if (numBlocks > journal->maxTransactionBuffers) … … 49 81 if (!journal->currTransaction) 50 82 journal->currTransaction=JournalTransCreate(journal); 83 84 trans=journal->currTransaction; 85 86 /* Check if locked. */ 87 88 needed=trans->outstandingBlocks+numBlocks; 89 90 if (needed > journal->maxTransactionBuffers) 91 { 92 /* Current transaction is too large. TODO: Commit it. */ 93 } 94 95 /* Check log space left. */ 96 97 /* Account for all the buffers, and add the handle to the running transaction. */ 98 handle->transaction=trans; 99 trans->outstandingBlocks+=numBlocks; 100 trans->updates++; 101 trans->handleCount++; 102 103 JournalUnlock(journal); 104 105 return 0; 51 106 } 52 107 … … 92 147 93 148 SYMBOL_EXPORT(JournalStart); 149 150 /* Intent to modify a buffer for metadata update. */ 151 152 int JournalGetWriteAccess(struct JournalHandle* handle, struct Buffer* buffer) 153 { 154 struct JournalTrans* trans=handle->transaction; 155 struct Journal* journal=trans->journal; 156 struct JournalHead* head; 157 158 head=JournalAddHeader(buffer); 159 160 return 0; 161 } 162 163 SYMBOL_EXPORT(JournalGetWriteAccess);
