* Cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31869 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+100
-95
@@ -208,7 +208,8 @@ private:
|
|||||||
class Get : public Action {
|
class Get : public Action {
|
||||||
public:
|
public:
|
||||||
Get(block_cache* cache, cached_block* block)
|
Get(block_cache* cache, cached_block* block)
|
||||||
: Action(cache, block)
|
:
|
||||||
|
Action(cache, block)
|
||||||
{
|
{
|
||||||
Initialized();
|
Initialized();
|
||||||
}
|
}
|
||||||
@@ -219,7 +220,8 @@ public:
|
|||||||
class Put : public Action {
|
class Put : public Action {
|
||||||
public:
|
public:
|
||||||
Put(block_cache* cache, cached_block* block)
|
Put(block_cache* cache, cached_block* block)
|
||||||
: Action(cache, block)
|
:
|
||||||
|
Action(cache, block)
|
||||||
{
|
{
|
||||||
Initialized();
|
Initialized();
|
||||||
}
|
}
|
||||||
@@ -230,7 +232,8 @@ public:
|
|||||||
class Read : public Action {
|
class Read : public Action {
|
||||||
public:
|
public:
|
||||||
Read(block_cache* cache, cached_block* block)
|
Read(block_cache* cache, cached_block* block)
|
||||||
: Action(cache, block)
|
:
|
||||||
|
Action(cache, block)
|
||||||
{
|
{
|
||||||
Initialized();
|
Initialized();
|
||||||
}
|
}
|
||||||
@@ -241,7 +244,8 @@ public:
|
|||||||
class Write : public Action {
|
class Write : public Action {
|
||||||
public:
|
public:
|
||||||
Write(block_cache* cache, cached_block* block)
|
Write(block_cache* cache, cached_block* block)
|
||||||
: Action(cache, block)
|
:
|
||||||
|
Action(cache, block)
|
||||||
{
|
{
|
||||||
Initialized();
|
Initialized();
|
||||||
}
|
}
|
||||||
@@ -252,7 +256,8 @@ public:
|
|||||||
class Flush : public Action {
|
class Flush : public Action {
|
||||||
public:
|
public:
|
||||||
Flush(block_cache* cache, cached_block* block, bool getUnused = false)
|
Flush(block_cache* cache, cached_block* block, bool getUnused = false)
|
||||||
: Action(cache, block),
|
:
|
||||||
|
Action(cache, block),
|
||||||
fGetUnused(getUnused)
|
fGetUnused(getUnused)
|
||||||
{
|
{
|
||||||
Initialized();
|
Initialized();
|
||||||
@@ -434,108 +439,108 @@ private:
|
|||||||
namespace TransactionTracing {
|
namespace TransactionTracing {
|
||||||
|
|
||||||
class Action : public AbstractTraceEntry {
|
class Action : public AbstractTraceEntry {
|
||||||
public:
|
public:
|
||||||
Action(const char* label, block_cache* cache,
|
Action(const char* label, block_cache* cache,
|
||||||
cache_transaction* transaction)
|
cache_transaction* transaction)
|
||||||
:
|
:
|
||||||
fCache(cache),
|
fCache(cache),
|
||||||
fTransaction(transaction),
|
fTransaction(transaction),
|
||||||
fID(transaction->id),
|
fID(transaction->id),
|
||||||
fSub(transaction->has_sub_transaction),
|
fSub(transaction->has_sub_transaction),
|
||||||
fNumBlocks(transaction->num_blocks),
|
fNumBlocks(transaction->num_blocks),
|
||||||
fSubNumBlocks(transaction->sub_num_blocks)
|
fSubNumBlocks(transaction->sub_num_blocks)
|
||||||
{
|
{
|
||||||
strlcpy(fLabel, label, sizeof(fLabel));
|
strlcpy(fLabel, label, sizeof(fLabel));
|
||||||
Initialized();
|
Initialized();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void AddDump(TraceOutput& out)
|
virtual void AddDump(TraceOutput& out)
|
||||||
{
|
{
|
||||||
out.Print("block cache %p, %s transaction %p (id %ld)%s"
|
out.Print("block cache %p, %s transaction %p (id %ld)%s"
|
||||||
", %ld/%ld blocks", fCache, fLabel, fTransaction, fID,
|
", %ld/%ld blocks", fCache, fLabel, fTransaction, fID,
|
||||||
fSub ? " sub" : "", fNumBlocks, fSubNumBlocks);
|
fSub ? " sub" : "", fNumBlocks, fSubNumBlocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
char fLabel[12];
|
char fLabel[12];
|
||||||
block_cache *fCache;
|
block_cache* fCache;
|
||||||
cache_transaction *fTransaction;
|
cache_transaction* fTransaction;
|
||||||
int32 fID;
|
int32 fID;
|
||||||
bool fSub;
|
bool fSub;
|
||||||
int32 fNumBlocks;
|
int32 fNumBlocks;
|
||||||
int32 fSubNumBlocks;
|
int32 fSubNumBlocks;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Detach : public AbstractTraceEntry {
|
class Detach : public AbstractTraceEntry {
|
||||||
public:
|
public:
|
||||||
Detach(block_cache* cache, cache_transaction* transaction,
|
Detach(block_cache* cache, cache_transaction* transaction,
|
||||||
cache_transaction* newTransaction)
|
cache_transaction* newTransaction)
|
||||||
:
|
:
|
||||||
fCache(cache),
|
fCache(cache),
|
||||||
fTransaction(transaction),
|
fTransaction(transaction),
|
||||||
fID(transaction->id),
|
fID(transaction->id),
|
||||||
fSub(transaction->has_sub_transaction),
|
fSub(transaction->has_sub_transaction),
|
||||||
fNewTransaction(newTransaction),
|
fNewTransaction(newTransaction),
|
||||||
fNewID(newTransaction->id)
|
fNewID(newTransaction->id)
|
||||||
{
|
{
|
||||||
Initialized();
|
Initialized();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void AddDump(TraceOutput& out)
|
virtual void AddDump(TraceOutput& out)
|
||||||
{
|
{
|
||||||
out.Print("block cache %p, detach transaction %p (id %ld)"
|
out.Print("block cache %p, detach transaction %p (id %ld)"
|
||||||
"from transaction %p (id %ld)%s",
|
"from transaction %p (id %ld)%s",
|
||||||
fCache, fNewTransaction, fNewID, fTransaction, fID,
|
fCache, fNewTransaction, fNewID, fTransaction, fID,
|
||||||
fSub ? " sub" : "");
|
fSub ? " sub" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
block_cache *fCache;
|
block_cache* fCache;
|
||||||
cache_transaction *fTransaction;
|
cache_transaction* fTransaction;
|
||||||
int32 fID;
|
int32 fID;
|
||||||
bool fSub;
|
bool fSub;
|
||||||
cache_transaction *fNewTransaction;
|
cache_transaction* fNewTransaction;
|
||||||
int32 fNewID;
|
int32 fNewID;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Abort : public AbstractTraceEntry {
|
class Abort : public AbstractTraceEntry {
|
||||||
public:
|
public:
|
||||||
Abort(block_cache* cache, cache_transaction* transaction)
|
Abort(block_cache* cache, cache_transaction* transaction)
|
||||||
:
|
:
|
||||||
fCache(cache),
|
fCache(cache),
|
||||||
fTransaction(transaction),
|
fTransaction(transaction),
|
||||||
fID(transaction->id),
|
fID(transaction->id),
|
||||||
fNumBlocks(0)
|
fNumBlocks(0)
|
||||||
{
|
{
|
||||||
bool isSub = transaction->has_sub_transaction;
|
bool isSub = transaction->has_sub_transaction;
|
||||||
fNumBlocks = isSub ? transaction->sub_num_blocks
|
fNumBlocks = isSub ? transaction->sub_num_blocks
|
||||||
: transaction->num_blocks;
|
: transaction->num_blocks;
|
||||||
fBlocks = (off_t*)alloc_tracing_buffer(fNumBlocks * sizeof(off_t));
|
fBlocks = (off_t*)alloc_tracing_buffer(fNumBlocks * sizeof(off_t));
|
||||||
if (fBlocks != NULL) {
|
if (fBlocks != NULL) {
|
||||||
cached_block* block = transaction->first_block;
|
cached_block* block = transaction->first_block;
|
||||||
for (int32 i = 0; block != NULL && i < fNumBlocks;
|
for (int32 i = 0; block != NULL && i < fNumBlocks;
|
||||||
block = block->transaction_next) {
|
block = block->transaction_next) {
|
||||||
fBlocks[i++] = block->block_number;
|
fBlocks[i++] = block->block_number;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
fNumBlocks = 0;
|
fNumBlocks = 0;
|
||||||
Initialized();
|
Initialized();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void AddDump(TraceOutput& out)
|
virtual void AddDump(TraceOutput& out)
|
||||||
{
|
{
|
||||||
out.Print("block cache %p, abort transaction "
|
out.Print("block cache %p, abort transaction "
|
||||||
"%p (id %ld), blocks", fCache, fTransaction, fID);
|
"%p (id %ld), blocks", fCache, fTransaction, fID);
|
||||||
for (int32 i = 0; i < fNumBlocks && !out.IsFull(); i++)
|
for (int32 i = 0; i < fNumBlocks && !out.IsFull(); i++)
|
||||||
out.Print(" %Ld", fBlocks[i]);
|
out.Print(" %Ld", fBlocks[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
block_cache *fCache;
|
block_cache* fCache;
|
||||||
cache_transaction *fTransaction;
|
cache_transaction* fTransaction;
|
||||||
int32 fID;
|
int32 fID;
|
||||||
off_t *fBlocks;
|
off_t* fBlocks;
|
||||||
int32 fNumBlocks;
|
int32 fNumBlocks;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace TransactionTracing
|
} // namespace TransactionTracing
|
||||||
|
|||||||
Reference in New Issue
Block a user