Commit 34f8ad4a authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

nodefs: update some comments

parent 1070358b
...@@ -38,14 +38,18 @@ ...@@ -38,14 +38,18 @@
// tree. InodeOf can be used to get particular Inode associated with // tree. InodeOf can be used to get particular Inode associated with
// a Operations. // a Operations.
// //
// XXX ^^^ inodes cleaned on cache clean (FORGET). // The kernel can evict inode data to free up memory. It does so by
// issuing FORGET calls. When a node has no children, and no kernel
// references, it is removed from the file system trees.
//
// File system trees can also be constructed in advance. This is done
// by instantiating "persistent" inodes. Persistent inodes remain in
// memory even if the kernel has forgotten them.
// //
// XXX describe how to mount. // XXX describe how to mount.
// //
// XXX node example with Lookup. // XXX node example with Lookup.
// //
// XXX describe how to pre-add nodes to tree.
//
package nodefs package nodefs
import ( import (
......
...@@ -377,7 +377,6 @@ func (b *rawBridge) Rename(cancel <-chan struct{}, input *fuse.RenameIn, oldName ...@@ -377,7 +377,6 @@ func (b *rawBridge) Rename(cancel <-chan struct{}, input *fuse.RenameIn, oldName
status := p1.node.Rename(&fuse.Context{Caller: input.Caller, Cancel: cancel}, oldName, p2.node, newName, input.Flags) status := p1.node.Rename(&fuse.Context{Caller: input.Caller, Cancel: cancel}, oldName, p2.node, newName, input.Flags)
if status.Ok() { if status.Ok() {
if input.Flags&unix.RENAME_EXCHANGE != 0 { if input.Flags&unix.RENAME_EXCHANGE != 0 {
// XXX - test coverage.
p1.ExchangeChild(oldName, p2, newName) p1.ExchangeChild(oldName, p2, newName)
} else { } else {
p1.MvChild(oldName, p2, newName, true) p1.MvChild(oldName, p2, newName, true)
...@@ -609,7 +608,6 @@ func (b *rawBridge) ReadDir(cancel <-chan struct{}, input *fuse.ReadIn, out *fus ...@@ -609,7 +608,6 @@ func (b *rawBridge) ReadDir(cancel <-chan struct{}, input *fuse.ReadIn, out *fus
f.hasOverflow = false f.hasOverflow = false
} }
// TODO - should post '..' and '.' ?
for f.dirStream.HasNext() { for f.dirStream.HasNext() {
e, status := f.dirStream.Next() e, status := f.dirStream.Next()
...@@ -663,7 +661,7 @@ func (b *rawBridge) ReadDirPlus(cancel <-chan struct{}, input *fuse.ReadIn, out ...@@ -663,7 +661,7 @@ func (b *rawBridge) ReadDirPlus(cancel <-chan struct{}, input *fuse.ReadIn, out
b.addNewChild(n, e.Name, child, nil, 0, entryOut) b.addNewChild(n, e.Name, child, nil, 0, entryOut)
b.setEntryOutTimeout(entryOut) b.setEntryOutTimeout(entryOut)
if (e.Mode &^ 07777) != (child.mode &^ 07777) { if (e.Mode &^ 07777) != (child.mode &^ 07777) {
// XXX should go back and change the // should go back and change the
// already serialized entry // already serialized entry
log.Panicf("mode mismatch between readdir %o and lookup %o", e.Mode, child.mode) log.Panicf("mode mismatch between readdir %o and lookup %o", e.Mode, child.mode)
} }
......
...@@ -11,8 +11,6 @@ import ( ...@@ -11,8 +11,6 @@ import (
"github.com/hanwen/go-fuse/fuse" "github.com/hanwen/go-fuse/fuse"
) )
// XXX fill out here.
func (f *loopbackFile) Allocate(ctx context.Context, off uint64, sz uint64, mode uint32) fuse.Status { func (f *loopbackFile) Allocate(ctx context.Context, off uint64, sz uint64, mode uint32) fuse.Status {
return fuse.ENOSYS return fuse.ENOSYS
} }
......
...@@ -333,7 +333,8 @@ retry: ...@@ -333,7 +333,8 @@ retry:
lockNodes(lockme...) lockNodes(lockme...)
if n.changeCounter != nChange { if n.changeCounter != nChange {
unlockNodes(lockme...) unlockNodes(lockme...)
n.mu.Lock() // TODO could avoid unlocking and relocking n here. // could avoid unlocking and relocking n here.
n.mu.Lock()
continue retry continue retry
} }
...@@ -391,7 +392,8 @@ retry: ...@@ -391,7 +392,8 @@ retry:
lockNodes(lockme...) lockNodes(lockme...)
if n.changeCounter != nChange { if n.changeCounter != nChange {
unlockNodes(lockme...) unlockNodes(lockme...)
n.mu.Lock() // TODO could avoid unlocking and relocking n here. // could avoid unlocking and relocking n here.
n.mu.Lock()
continue retry continue retry
} }
...@@ -467,7 +469,6 @@ retry: ...@@ -467,7 +469,6 @@ retry:
unlockNodes(n, newParent, oldChild, destChild) unlockNodes(n, newParent, oldChild, destChild)
if destChild != nil { if destChild != nil {
// XXX would be better to do this under lock above too.
destChild.removeRef(0, false) destChild.removeRef(0, false)
} }
return true return true
...@@ -539,7 +540,7 @@ func (n *Inode) NotifyEntry(name string) fuse.Status { ...@@ -539,7 +540,7 @@ func (n *Inode) NotifyEntry(name string) fuse.Status {
return n.bridge.server.EntryNotify(n.nodeID.Ino, name) return n.bridge.server.EntryNotify(n.nodeID.Ino, name)
} }
// XXX DeleteNotify ? // XXX naming: DeleteNotify ?
func (n *Inode) NotifyDelete(name string, child *Inode) fuse.Status { func (n *Inode) NotifyDelete(name string, child *Inode) fuse.Status {
// XXX arg ordering? // XXX arg ordering?
return n.bridge.server.DeleteNotify(n.nodeID.Ino, child.nodeID.Ino, name) return n.bridge.server.DeleteNotify(n.nodeID.Ino, child.nodeID.Ino, name)
......
...@@ -550,8 +550,6 @@ func TestReadDir(t *testing.T) { ...@@ -550,8 +550,6 @@ func TestReadDir(t *testing.T) {
defer f.Close() defer f.Close()
// add entries after opening the directory // add entries after opening the directory
// XXX what about ".." and "." ?
want := map[string]bool{} want := map[string]bool{}
for i := 0; i < 110; i++ { for i := 0; i < 110; i++ {
// 40 bytes of filename, so 110 entries overflows a // 40 bytes of filename, so 110 entries overflows a
......
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