diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-06-30 12:33:04 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-07-01 01:19:31 -0700 |
| commit | 07f20155fdced66dd22ff41915299100dca35a3b (patch) | |
| tree | 76ecfbce96c4ef9171c2c55797c56aeac138f0f1 /weed/filesys/file.go | |
| parent | 90badb820159bbcda96f94285576fce47098ba3a (diff) | |
| download | seaweedfs-07f20155fdced66dd22ff41915299100dca35a3b.tar.xz seaweedfs-07f20155fdced66dd22ff41915299100dca35a3b.zip | |
small optimization
Diffstat (limited to 'weed/filesys/file.go')
| -rw-r--r-- | weed/filesys/file.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/weed/filesys/file.go b/weed/filesys/file.go index c50ac0549..8f58511e2 100644 --- a/weed/filesys/file.go +++ b/weed/filesys/file.go @@ -144,17 +144,17 @@ func (file *File) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *f file.dirtyMetadata = true } - if req.Valid.Mode() { + if req.Valid.Mode() && entry.Attributes.FileMode != uint32(req.Mode){ entry.Attributes.FileMode = uint32(req.Mode) file.dirtyMetadata = true } - if req.Valid.Uid() { + if req.Valid.Uid() && entry.Attributes.Uid != req.Uid { entry.Attributes.Uid = req.Uid file.dirtyMetadata = true } - if req.Valid.Gid() { + if req.Valid.Gid() && entry.Attributes.Gid != req.Gid { entry.Attributes.Gid = req.Gid file.dirtyMetadata = true } @@ -164,7 +164,7 @@ func (file *File) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *f file.dirtyMetadata = true } - if req.Valid.Mtime() { + if req.Valid.Mtime() && entry.Attributes.Mtime != req.Mtime.Unix() { entry.Attributes.Mtime = req.Mtime.Unix() file.dirtyMetadata = true } |
