aboutsummaryrefslogtreecommitdiff
path: root/weed/filesys/file.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/filesys/file.go')
-rw-r--r--weed/filesys/file.go21
1 files changed, 13 insertions, 8 deletions
diff --git a/weed/filesys/file.go b/weed/filesys/file.go
index 519e12c59..8db892447 100644
--- a/weed/filesys/file.go
+++ b/weed/filesys/file.go
@@ -85,7 +85,7 @@ func (file *File) Getxattr(ctx context.Context, req *fuse.GetxattrRequest, resp
func (file *File) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (fs.Handle, error) {
- glog.V(4).Infof("file %v open %+v", file.fullpath(), req)
+ glog.V(5).Infof("file %v open %+v", file.fullpath(), req)
file.isOpen++
@@ -93,7 +93,7 @@ func (file *File) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.Op
resp.Handle = fuse.HandleID(handle.handle)
- glog.V(4).Infof("%v file open handle id = %d", file.fullpath(), handle.handle)
+ glog.V(5).Infof("%v file open handle id = %d", file.fullpath(), handle.handle)
return handle, nil
@@ -101,7 +101,7 @@ func (file *File) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.Op
func (file *File) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) error {
- glog.V(4).Infof("%v file setattr %+v, old:%+v", file.fullpath(), req, file.entry.Attributes)
+ glog.V(5).Infof("%v file setattr %+v", file.fullpath(), req)
if err := file.maybeLoadEntry(ctx); err != nil {
return err
@@ -121,10 +121,10 @@ func (file *File) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *f
int64Size = int64(req.Size) - chunk.Offset
if int64Size > 0 {
chunks = append(chunks, chunk)
- glog.V(4).Infof("truncated chunk %+v from %d to %d\n", chunk, chunk.Size, int64Size)
+ glog.V(4).Infof("truncated chunk %+v from %d to %d\n", chunk.GetFileIdString(), chunk.Size, int64Size)
chunk.Size = uint64(int64Size)
} else {
- glog.V(4).Infof("truncated whole chunk %+v\n", chunk)
+ glog.V(4).Infof("truncated whole chunk %+v\n", chunk.GetFileIdString())
truncatedChunks = append(truncatedChunks, chunk)
}
}
@@ -133,10 +133,11 @@ func (file *File) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *f
file.entry.Chunks = chunks
file.entryViewCache = nil
file.reader = nil
- file.dirtyMetadata = true
}
file.entry.Attributes.FileSize = req.Size
+ file.dirtyMetadata = true
}
+
if req.Valid.Mode() {
file.entry.Attributes.FileMode = uint32(req.Mode)
file.dirtyMetadata = true
@@ -170,6 +171,10 @@ func (file *File) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *f
return nil
}
+ if !file.dirtyMetadata {
+ return nil
+ }
+
return file.saveEntry()
}
@@ -232,7 +237,7 @@ func (file *File) Fsync(ctx context.Context, req *fuse.FsyncRequest) error {
func (file *File) Forget() {
t := util.NewFullPath(file.dir.FullPath(), file.Name)
- glog.V(4).Infof("Forget file %s", t)
+ glog.V(5).Infof("Forget file %s", t)
file.wfs.fsNodeCache.DeleteFsNode(t)
}
@@ -285,7 +290,7 @@ func (file *File) saveEntry() error {
Entry: file.entry,
}
- glog.V(1).Infof("save file entry: %v", request)
+ glog.V(4).Infof("save file entry: %v", request)
_, err := client.UpdateEntry(context.Background(), request)
if err != nil {
glog.V(0).Infof("UpdateEntry file %s/%s: %v", file.dir.FullPath(), file.Name, err)