* Added "bfs" prefix to tracing output.

* When an inode is trimmed, it now also traces the previous internal
  size as well as the target size.
* Remove extraneous white space.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24575 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-03-25 18:51:35 +00:00
parent 4616b7ed27
commit 2f20bf154e
2 changed files with 25 additions and 21 deletions
@@ -50,7 +50,7 @@ class Allocate : public AbstractTraceEntry {
virtual void AddDump(TraceOutput& out) virtual void AddDump(TraceOutput& out)
{ {
out.Print("alloc %lu.%u.%u", fRun.AllocationGroup(), out.Print("bfs:alloc %lu.%u.%u", fRun.AllocationGroup(),
fRun.Start(), fRun.Length()); fRun.Start(), fRun.Length());
} }
@@ -69,7 +69,7 @@ class Free : public AbstractTraceEntry {
virtual void AddDump(TraceOutput& out) virtual void AddDump(TraceOutput& out)
{ {
out.Print("free %lu.%u.%u", fRun.AllocationGroup(), out.Print("bfs:free %lu.%u.%u", fRun.AllocationGroup(),
fRun.Start(), fRun.Length()); fRun.Start(), fRun.Length());
} }
@@ -109,7 +109,7 @@ class Block : public AbstractTraceEntry {
virtual void AddDump(TraceOutput& out) virtual void AddDump(TraceOutput& out)
{ {
out.Print("%s: block %Ld (%p), sum %lu, s/l %lu/%lu", fLabel, out.Print("bfs:%s: block %Ld (%p), sum %lu, s/l %lu/%lu", fLabel,
fBlock, fData, fSum, fStart, fLength); fBlock, fData, fSum, fStart, fLength);
} }
@@ -846,7 +846,7 @@ BlockAllocator::Free(Transaction &transaction, block_run run)
DEBUGGER(("tried to free reserved block")); DEBUGGER(("tried to free reserved block"));
return B_BAD_VALUE; return B_BAD_VALUE;
} }
#ifdef DEBUG #ifdef DEBUG
if (CheckBlockRun(run) < B_OK) if (CheckBlockRun(run) < B_OK)
return B_BAD_DATA; return B_BAD_DATA;
#endif #endif
@@ -953,12 +953,12 @@ BlockAllocator::StopChecking(check_control *control)
delete cookie->iterator; delete cookie->iterator;
cookie->iterator = NULL; cookie->iterator = NULL;
// the current directory inode is still locked in memory // the current directory inode is still locked in memory
put_vnode(fVolume->ID(), fVolume->ToVnode(cookie->current)); put_vnode(fVolume->ID(), fVolume->ToVnode(cookie->current));
} }
// if CheckNextNode() could completely work through, we can // if CheckNextNode() could completely work through, we can
// fix any damages of the bitmap // fix any damages of the bitmap
if (control != NULL && control->status == B_ENTRY_NOT_FOUND) { if (control != NULL && control->status == B_ENTRY_NOT_FOUND) {
// calculate the number of used blocks in the check bitmap // calculate the number of used blocks in the check bitmap
size_t size = fVolume->BlockSize() * fNumGroups * fBlocksPerGroup; size_t size = fVolume->BlockSize() * fNumGroups * fBlocksPerGroup;
@@ -1088,12 +1088,12 @@ BlockAllocator::CheckNextNode(check_control *control)
delete cookie->iterator; delete cookie->iterator;
cookie->iterator = NULL; cookie->iterator = NULL;
// unlock the directory's inode from memory // unlock the directory's inode from memory
put_vnode(fVolume->ID(), fVolume->ToVnode(cookie->current)); put_vnode(fVolume->ID(), fVolume->ToVnode(cookie->current));
continue; continue;
} else if (status == B_OK) { } else if (status == B_OK) {
// ignore "." and ".." entries // ignore "." and ".." entries
if (!strcmp(name, ".") || !strcmp(name, "..")) if (!strcmp(name, ".") || !strcmp(name, ".."))
continue; continue;
@@ -1129,7 +1129,7 @@ BlockAllocator::CheckNextNode(check_control *control)
// file don't fit to its parent, there is a serious problem) // file don't fit to its parent, there is a serious problem)
if (((cookie->parent_mode & S_ATTR_DIR) != 0 && !inode->IsAttribute()) if (((cookie->parent_mode & S_ATTR_DIR) != 0 && !inode->IsAttribute())
|| ((cookie->parent_mode & S_INDEX_DIR) != 0 && !inode->IsIndex()) || ((cookie->parent_mode & S_INDEX_DIR) != 0 && !inode->IsIndex())
|| ((cookie->parent_mode & (S_DIRECTORY | S_ATTR_DIR | S_INDEX_DIR)) || ((cookie->parent_mode & (S_DIRECTORY | S_ATTR_DIR | S_INDEX_DIR))
== S_DIRECTORY == S_DIRECTORY
&& (inode->Mode() & (S_ATTR | S_ATTR_DIR | S_INDEX_DIR)) != 0)) { && (inode->Mode() & (S_ATTR | S_ATTR_DIR | S_INDEX_DIR)) != 0)) {
FATAL(("inode at %Ld is of wrong type: %o (parent %o at %Ld)!\n", FATAL(("inode at %Ld is of wrong type: %o (parent %o at %Ld)!\n",
+16 -12
View File
@@ -38,7 +38,7 @@ class Create : public AbstractTraceEntry {
virtual void AddDump(TraceOutput& out) virtual void AddDump(TraceOutput& out)
{ {
out.Print("CREATE %Ld (%p), parent %Ld (%p), \"%s\", " out.Print("bfs:Create %Ld (%p), parent %Ld (%p), \"%s\", "
"mode %lx, omode %x, type %lx", fID, fInode, fParentID, "mode %lx, omode %x, type %lx", fID, fInode, fParentID,
fParent, fName, fMode, fOpenMode, fType); fParent, fName, fMode, fOpenMode, fType);
} }
@@ -68,7 +68,7 @@ class Remove : public AbstractTraceEntry {
virtual void AddDump(TraceOutput& out) virtual void AddDump(TraceOutput& out)
{ {
out.Print("REMOVE %Ld (%p), \"%s\"", fID, fInode, fName); out.Print("bfs:Remove %Ld (%p), \"%s\"", fID, fInode, fName);
} }
private: private:
@@ -90,7 +90,7 @@ class Action : public AbstractTraceEntry {
virtual void AddDump(TraceOutput& out) virtual void AddDump(TraceOutput& out)
{ {
out.Print("%s %Ld (%p)\n", fAction, fID, fInode); out.Print("bfs:%s %Ld (%p)\n", fAction, fID, fInode);
} }
private: private:
@@ -101,20 +101,21 @@ class Action : public AbstractTraceEntry {
class Resize : public AbstractTraceEntry { class Resize : public AbstractTraceEntry {
public: public:
Resize(Inode* inode, off_t oldSize, off_t newSize) Resize(Inode* inode, off_t oldSize, off_t newSize, bool trim)
: :
fInode(inode), fInode(inode),
fID(inode->ID()), fID(inode->ID()),
fOldSize(oldSize), fOldSize(oldSize),
fNewSize(newSize) fNewSize(newSize),
fTrim(trim)
{ {
Initialized(); Initialized();
} }
virtual void AddDump(TraceOutput& out) virtual void AddDump(TraceOutput& out)
{ {
out.Print("RESIZE %Ld (%p), %Ld -> %Ld", fID, fInode, out.Print("bfs:%s %Ld (%p), %Ld -> %Ld", fTrim ? "Trim" : "Resize",
fOldSize, fNewSize); fID, fInode, fOldSize, fNewSize);
} }
private: private:
@@ -122,6 +123,7 @@ class Resize : public AbstractTraceEntry {
ino_t fID; ino_t fID;
off_t fOldSize; off_t fOldSize;
off_t fNewSize; off_t fNewSize;
bool fTrim;
}; };
} // namespace BFSInodeTracing } // namespace BFSInodeTracing
@@ -2024,7 +2026,7 @@ Inode::SetFileSize(Transaction &transaction, off_t size)
if (size == oldSize) if (size == oldSize)
return B_OK; return B_OK;
T(Resize(this, oldSize, size)); T(Resize(this, oldSize, size, false));
// should the data stream grow or shrink? // should the data stream grow or shrink?
status_t status; status_t status;
@@ -2063,9 +2065,10 @@ Inode::Append(Transaction &transaction, off_t bytes)
bool bool
Inode::NeedsTrimming() Inode::NeedsTrimming()
{ {
// We never trim preallocated index blocks to make them grow as smooth as possible. // We never trim preallocated index blocks to make them grow as smooth as
// There are only few indices anyway, so this doesn't hurt // possible. There are only few indices anyway, so this doesn't hurt.
// Also, if an inode is already in deleted state, we don't bother trimming it // Also, if an inode is already in deleted state, we don't bother trimming
// it.
if (IsIndex() || IsDeleted()) if (IsIndex() || IsDeleted())
return false; return false;
@@ -2081,7 +2084,8 @@ Inode::NeedsTrimming()
status_t status_t
Inode::TrimPreallocation(Transaction &transaction) Inode::TrimPreallocation(Transaction &transaction)
{ {
T(Action("TRIM", this)); T(Resize(this, max_c(Node().data.MaxDirectRange(),
Node().data.MaxIndirectRange()), Size(), true));
status_t status = _ShrinkStream(transaction, Size()); status_t status = _ShrinkStream(transaction, Size());
if (status < B_OK) if (status < B_OK)