Commit b3bdd01d authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Implement BATCH_FORGET. Bump kernel interface to 7.16.

parent 72dbac68
......@@ -248,7 +248,7 @@ type DefaultFile struct{}
// Include DefaultRawFileSystem to inherit a null implementation.
type RawFileSystem interface {
Lookup(header *InHeader, name string) (out *EntryOut, status Status)
Forget(header *InHeader, input *ForgetIn)
Forget(nodeid, nlookup uint64)
// Attributes.
GetAttr(header *InHeader, input *GetAttrIn) (out *AttrOut, code Status)
......
......@@ -11,7 +11,7 @@ func (me *DefaultRawFileSystem) Lookup(h *InHeader, name string) (out *EntryOut,
return nil, ENOSYS
}
func (me *DefaultRawFileSystem) Forget(h *InHeader, input *ForgetIn) {
func (me *DefaultRawFileSystem) Forget(nodeID, nlookup uint64) {
}
func (me *DefaultRawFileSystem) GetAttr(header *InHeader, input *GetAttrIn) (out *AttrOut, code Status) {
......
......@@ -137,7 +137,6 @@ func (me *FileSystemConnector) forgetUpdate(node *Inode, forgetCount int) {
me.recursiveConsiderDropInode(node)
}
// InodeCount returns the number of inodes registered with the kernel.
func (me *FileSystemConnector) InodeHandleCount() int {
return me.inodeMap.Count()
......
......@@ -73,9 +73,9 @@ func (me *FileSystemConnector) Lookup(header *InHeader, name string) (out *Entry
return out, OK
}
func (me *FileSystemConnector) Forget(h *InHeader, input *ForgetIn) {
node := me.toInode(h.NodeId)
me.forgetUpdate(node, int(input.Nlookup))
func (me *FileSystemConnector) Forget(nodeID, nlookup uint64) {
node := me.toInode(nodeID)
me.forgetUpdate(node, int(nlookup))
}
func (me *FileSystemConnector) GetAttr(header *InHeader, input *GetAttrIn) (out *AttrOut, code Status) {
......
......@@ -163,9 +163,9 @@ func (me *LockingRawFileSystem) Lookup(h *InHeader, name string) (out *EntryOut,
return me.RawFileSystem.Lookup(h, name)
}
func (me *LockingRawFileSystem) Forget(h *InHeader, input *ForgetIn) {
func (me *LockingRawFileSystem) Forget(nodeID uint64, nlookup uint64) {
defer me.locked()()
me.RawFileSystem.Forget(h, input)
me.RawFileSystem.Forget(nodeID, nlookup)
}
func (me *LockingRawFileSystem) GetAttr(header *InHeader, input *GetAttrIn) (out *AttrOut, code Status) {
......
......@@ -44,7 +44,7 @@ func ToStatus(err error) Status {
case os.ErrInvalid:
return EINVAL
}
switch t := err.(type) {
case syscall.Errno:
return Status(t)
......
......@@ -59,7 +59,7 @@ func mount(mountPoint string, options string) (f *os.File, finalMountPoint strin
if err != nil {
return
}
w, err := proc.Wait()
if err != nil {
return
......
......@@ -248,10 +248,8 @@ func (me *MountState) handleRequest(req *request) {
}
func (me *MountState) write(req *request) Status {
// If we try to write OK, nil, we will get
// error: writer: Writev [[16 0 0 0 0 0 0 0 17 0 0 0 0 0 0 0]]
// failed, err: writev: no such file or directory
if req.inHeader.opcode == _OP_FORGET {
// Forget does not wait for reply.
if req.inHeader.opcode == _OP_FORGET || req.inHeader.opcode == _OP_BATCH_FORGET {
return OK
}
......
This diff is collapsed.
......@@ -231,3 +231,11 @@ func (me *WithFlags) String() string {
me.File, me.Description, flagString(openFlagNames, int(me.OpenFlags), "O_RDONLY"),
flagString(fuseOpenFlagNames, int(me.FuseFlags), ""))
}
func (me *ForgetIn) String() string {
return fmt.Sprintf("{%d}", me.Nlookup)
}
func (me *BatchForgetIn) String() string {
return fmt.Sprintf("{%d}", me.Count)
}
......@@ -127,6 +127,16 @@ type ForgetIn struct {
Nlookup uint64
}
type ForgetOne struct {
NodeId uint64
Nlookup uint64
}
type BatchForgetIn struct {
Count uint32
Dummy uint32
}
const (
// Mask for GetAttrIn.Flags. If set, GetAttrIn has a file handle set.
FUSE_GETATTR_FH = (1 << 0)
......
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