* 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:
@@ -50,7 +50,7 @@ class Allocate : public AbstractTraceEntry {
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ class Free : public AbstractTraceEntry {
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ class Block : public AbstractTraceEntry {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -846,7 +846,7 @@ BlockAllocator::Free(Transaction &transaction, block_run run)
|
||||
DEBUGGER(("tried to free reserved block"));
|
||||
return B_BAD_VALUE;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
if (CheckBlockRun(run) < B_OK)
|
||||
return B_BAD_DATA;
|
||||
#endif
|
||||
@@ -953,12 +953,12 @@ BlockAllocator::StopChecking(check_control *control)
|
||||
delete cookie->iterator;
|
||||
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));
|
||||
}
|
||||
|
||||
// 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) {
|
||||
// calculate the number of used blocks in the check bitmap
|
||||
size_t size = fVolume->BlockSize() * fNumGroups * fBlocksPerGroup;
|
||||
@@ -1088,12 +1088,12 @@ BlockAllocator::CheckNextNode(check_control *control)
|
||||
delete cookie->iterator;
|
||||
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));
|
||||
|
||||
continue;
|
||||
} else if (status == B_OK) {
|
||||
// ignore "." and ".." entries
|
||||
// ignore "." and ".." entries
|
||||
if (!strcmp(name, ".") || !strcmp(name, ".."))
|
||||
continue;
|
||||
|
||||
@@ -1129,7 +1129,7 @@ BlockAllocator::CheckNextNode(check_control *control)
|
||||
// file don't fit to its parent, there is a serious problem)
|
||||
if (((cookie->parent_mode & S_ATTR_DIR) != 0 && !inode->IsAttribute())
|
||||
|| ((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
|
||||
&& (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",
|
||||
|
||||
@@ -38,7 +38,7 @@ class Create : public AbstractTraceEntry {
|
||||
|
||||
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,
|
||||
fParent, fName, fMode, fOpenMode, fType);
|
||||
}
|
||||
@@ -68,7 +68,7 @@ class Remove : public AbstractTraceEntry {
|
||||
|
||||
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:
|
||||
@@ -90,7 +90,7 @@ class Action : public AbstractTraceEntry {
|
||||
|
||||
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:
|
||||
@@ -101,20 +101,21 @@ class Action : public AbstractTraceEntry {
|
||||
|
||||
class Resize : public AbstractTraceEntry {
|
||||
public:
|
||||
Resize(Inode* inode, off_t oldSize, off_t newSize)
|
||||
Resize(Inode* inode, off_t oldSize, off_t newSize, bool trim)
|
||||
:
|
||||
fInode(inode),
|
||||
fID(inode->ID()),
|
||||
fOldSize(oldSize),
|
||||
fNewSize(newSize)
|
||||
fNewSize(newSize),
|
||||
fTrim(trim)
|
||||
{
|
||||
Initialized();
|
||||
}
|
||||
|
||||
virtual void AddDump(TraceOutput& out)
|
||||
{
|
||||
out.Print("RESIZE %Ld (%p), %Ld -> %Ld", fID, fInode,
|
||||
fOldSize, fNewSize);
|
||||
out.Print("bfs:%s %Ld (%p), %Ld -> %Ld", fTrim ? "Trim" : "Resize",
|
||||
fID, fInode, fOldSize, fNewSize);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -122,6 +123,7 @@ class Resize : public AbstractTraceEntry {
|
||||
ino_t fID;
|
||||
off_t fOldSize;
|
||||
off_t fNewSize;
|
||||
bool fTrim;
|
||||
};
|
||||
|
||||
} // namespace BFSInodeTracing
|
||||
@@ -2024,7 +2026,7 @@ Inode::SetFileSize(Transaction &transaction, off_t size)
|
||||
if (size == oldSize)
|
||||
return B_OK;
|
||||
|
||||
T(Resize(this, oldSize, size));
|
||||
T(Resize(this, oldSize, size, false));
|
||||
|
||||
// should the data stream grow or shrink?
|
||||
status_t status;
|
||||
@@ -2063,9 +2065,10 @@ Inode::Append(Transaction &transaction, off_t bytes)
|
||||
bool
|
||||
Inode::NeedsTrimming()
|
||||
{
|
||||
// We never trim preallocated index blocks to make them grow as smooth as 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
|
||||
// We never trim preallocated index blocks to make them grow as smooth as
|
||||
// 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.
|
||||
if (IsIndex() || IsDeleted())
|
||||
return false;
|
||||
|
||||
@@ -2081,7 +2084,8 @@ Inode::NeedsTrimming()
|
||||
status_t
|
||||
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());
|
||||
if (status < B_OK)
|
||||
|
||||
Reference in New Issue
Block a user