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