1 /* 2 * Copyright 2001-2010, Haiku Inc. All rights reserved. 3 * This file may be used under the terms of the MIT License. 4 * 5 * Authors: 6 * Janito V. Ferreira Filho 7 */ 8 9 10 #include "NoJournal.h" 11 12 #include <string.h> 13 14 #include <fs_cache.h> 15 16 17 //#define TRACE_EXT2 18 #ifdef TRACE_EXT2 19 # define TRACE(x...) dprintf("\33[34mext2:\33[0m " x) 20 #else 21 # define TRACE(x...) ; 22 #endif 23 24 25 NoJournal::NoJournal(Volume* volume) 26 : 27 Journal() 28 { 29 fFilesystemVolume = volume; 30 fFilesystemBlockCache = volume->BlockCache(); 31 fJournalVolume = volume; 32 fHasSubTransaction = false; 33 fSeparateSubTransactions = false; 34 } 35 36 37 NoJournal::~NoJournal() 38 { 39 } 40 41 42 status_t 43 NoJournal::InitCheck() 44 { 45 return B_OK; 46 } 47 48 49 status_t 50 NoJournal::Recover() 51 { 52 return B_OK; 53 } 54 55 56 status_t 57 NoJournal::StartLog() 58 { 59 return B_OK; 60 } 61 62 63 status_t 64 NoJournal::Lock(Transaction* owner, bool separateSubTransactions) 65 { 66 status_t status = block_cache_sync(fFilesystemBlockCache); 67 TRACE("NoJournal::Lock(): block_cache_sync: %s\n", strerror(status)); 68 69 if (status == B_OK) 70 status = Journal::Lock(owner, separateSubTransactions); 71 72 return status; 73 } 74 75 76 status_t 77 NoJournal::Unlock(Transaction* owner, bool success) 78 { 79 TRACE("NoJournal::Unlock\n"); 80 return Journal::Unlock(owner, success); 81 } 82 83 84 status_t 85 NoJournal::_WriteTransactionToLog() 86 { 87 TRACE("NoJournal::_WriteTransactionToLog(): Ending transaction %" B_PRId32 88 "\n", fTransactionID); 89 90 fTransactionID = cache_end_transaction(fFilesystemBlockCache, 91 fTransactionID, _TransactionWritten, NULL); 92 93 return B_OK; 94 } 95 96 97 /*static*/ void 98 NoJournal::_TransactionWritten(int32 transactionID, int32 event, void* param) 99 { 100 TRACE("Transaction %" B_PRId32" checkpointed\n", transactionID); 101 } 102