* 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)
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user