Commit be8e5f4a authored by Jakob Unterwurzacher's avatar Jakob Unterwurzacher Committed by Han-Wen Nienhuys

fuse: debug logging: mark nodeids as "nXXX"

nodeid and inode number used to be identical, which is
why both could be marked as "iXXX". This is no longer the
case, so make nodeids distinguishable.

Example:

23:47:17.637736 rx 9156: MKDIR n28 {0777 (00)} ["d90X"] 5b
23:47:17.637801 tx 9156:     OK, {n112 g1 tE=1s tA=1s {M040755 SZ=4096 L=2 1026:1026 B8*4096 i0:2769795 A 1601761637.637385 M 1601761637.637385 C 1601761637.637385}}

v4: also update orphaned inode warning

Change-Id: Ib29dabfd4cf6692cf4118191f8dc73529562426f
parent 1d0096e5
...@@ -309,8 +309,8 @@ func (n *Inode) Path(root *Inode) string { ...@@ -309,8 +309,8 @@ func (n *Inode) Path(root *Inode) string {
if root != nil && root != p { if root != nil && root != p {
deletedPlaceholder := fmt.Sprintf(".go-fuse.%d/deleted", rand.Uint64()) deletedPlaceholder := fmt.Sprintf(".go-fuse.%d/deleted", rand.Uint64())
n.bridge.logf("warning: Inode.Path: inode i%d is orphaned, replacing segment with %q", n.bridge.logf("warning: Inode.Path: n%d is orphaned, replacing segment with %q",
n.stableAttr.Ino, deletedPlaceholder) n.nodeId, deletedPlaceholder)
// NOSUBMIT - should replace rather than append? // NOSUBMIT - should replace rather than append?
segments = append(segments, deletedPlaceholder) segments = append(segments, deletedPlaceholder)
} }
...@@ -451,7 +451,7 @@ retry: ...@@ -451,7 +451,7 @@ retry:
n.changeCounter++ n.changeCounter++
if n.lookupCount != 0 { if n.lookupCount != 0 {
log.Panicf("i%d %p lookupCount changed: %d", n.nodeId, n, n.lookupCount) log.Panicf("n%d %p lookupCount changed: %d", n.nodeId, n, n.lookupCount)
} }
unlockNodes(lockme...) unlockNodes(lockme...)
......
...@@ -314,7 +314,7 @@ func doBatchForget(server *Server, req *request) { ...@@ -314,7 +314,7 @@ func doBatchForget(server *Server, req *request) {
forgets := *(*[]_ForgetOne)(unsafe.Pointer(h)) forgets := *(*[]_ForgetOne)(unsafe.Pointer(h))
for i, f := range forgets { for i, f := range forgets {
if server.opts.Debug { if server.opts.Debug {
log.Printf("doBatchForget: rx %d %d/%d: FORGET i%d {Nlookup=%d}", log.Printf("doBatchForget: rx %d %d/%d: FORGET n%d {Nlookup=%d}",
req.inHeader.Unique, i+1, len(forgets), f.NodeId, f.Nlookup) req.inHeader.Unique, i+1, len(forgets), f.NodeId, f.Nlookup)
} }
if f.NodeId == pollHackInode { if f.NodeId == pollHackInode {
......
...@@ -214,13 +214,13 @@ func ft(tsec uint64, tnsec uint32) float64 { ...@@ -214,13 +214,13 @@ func ft(tsec uint64, tnsec uint32) float64 {
// Returned by LOOKUP // Returned by LOOKUP
func (o *EntryOut) string() string { func (o *EntryOut) string() string {
return fmt.Sprintf("{i%d g%d tE=%gs tA=%gs %v}", return fmt.Sprintf("{n%d g%d tE=%gs tA=%gs %v}",
o.NodeId, o.Generation, ft(o.EntryValid, o.EntryValidNsec), o.NodeId, o.Generation, ft(o.EntryValid, o.EntryValidNsec),
ft(o.AttrValid, o.AttrValidNsec), &o.Attr) ft(o.AttrValid, o.AttrValidNsec), &o.Attr)
} }
func (o *CreateOut) string() string { func (o *CreateOut) string() string {
return fmt.Sprintf("{i%d g%d %v %v}", o.NodeId, o.Generation, &o.EntryOut, &o.OpenOut) return fmt.Sprintf("{n%d g%d %v %v}", o.NodeId, o.Generation, &o.EntryOut, &o.OpenOut)
} }
func (o *StatfsOut) string() string { func (o *StatfsOut) string() string {
...@@ -243,11 +243,11 @@ func (o *NotifyInvalDeleteOut) string() string { ...@@ -243,11 +243,11 @@ func (o *NotifyInvalDeleteOut) string() string {
} }
func (o *NotifyStoreOut) string() string { func (o *NotifyStoreOut) string() string {
return fmt.Sprintf("{i%d [%d +%d)}", o.Nodeid, o.Offset, o.Size) return fmt.Sprintf("{n%d [%d +%d)}", o.Nodeid, o.Offset, o.Size)
} }
func (o *NotifyRetrieveOut) string() string { func (o *NotifyRetrieveOut) string() string {
return fmt.Sprintf("{> %d: i%d [%d +%d)}", o.NotifyUnique, o.Nodeid, o.Offset, o.Size) return fmt.Sprintf("{> %d: n%d [%d +%d)}", o.NotifyUnique, o.Nodeid, o.Offset, o.Size)
} }
func (i *NotifyRetrieveIn) string() string { func (i *NotifyRetrieveIn) string() string {
...@@ -260,7 +260,7 @@ func (f *FallocateIn) string() string { ...@@ -260,7 +260,7 @@ func (f *FallocateIn) string() string {
} }
func (f *LinkIn) string() string { func (f *LinkIn) string() string {
return fmt.Sprintf("{Oldnodeid: %d}", f.Oldnodeid) return fmt.Sprintf("{Oldnodeid: n%d}", f.Oldnodeid)
} }
func (o *WriteOut) string() string { func (o *WriteOut) string() string {
...@@ -268,7 +268,7 @@ func (o *WriteOut) string() string { ...@@ -268,7 +268,7 @@ func (o *WriteOut) string() string {
} }
func (i *CopyFileRangeIn) string() string { func (i *CopyFileRangeIn) string() string {
return fmt.Sprintf("{Fh %d [%d +%d) => i%d Fh %d [%d, %d)}", return fmt.Sprintf("{Fh %d [%d +%d) => n%d Fh %d [%d, %d)}",
i.FhIn, i.OffIn, i.Len, i.NodeIdOut, i.FhOut, i.OffOut, i.Len) i.FhIn, i.OffIn, i.Len, i.NodeIdOut, i.FhOut, i.OffOut, i.Len)
} }
......
...@@ -103,7 +103,7 @@ func (r *request) InputDebug() string { ...@@ -103,7 +103,7 @@ func (r *request) InputDebug() string {
names += fmt.Sprintf("%s %db", data, len(r.arg)) names += fmt.Sprintf("%s %db", data, len(r.arg))
} }
return fmt.Sprintf("rx %d: %s i%d %s%s", return fmt.Sprintf("rx %d: %s n%d %s%s",
r.inHeader.Unique, operationName(r.inHeader.Opcode), r.inHeader.NodeId, r.inHeader.Unique, operationName(r.inHeader.Opcode), r.inHeader.NodeId,
val, names) val, names)
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment