|
@@ -126,10 +126,10 @@ func (dir *Dir) Create(ctx context.Context, req *fuse.CreateRequest,
|
|
|
},
|
|
|
OExcl: req.Flags&fuse.OpenExclusive != 0,
|
|
|
}
|
|
|
- glog.V(1).Infof("create: %v", req.String())
|
|
|
+ glog.V(1).Infof("create %s/%s: %v", dir.Path, req.Name, req.Flags)
|
|
|
|
|
|
- if err := dir.wfs.WithFilerClient(ctx, func(ctx context.Context, client filer_pb.SeaweedFilerClient) error {
|
|
|
- if err := filer_pb.CreateEntry(ctx, client, request); err != nil {
|
|
|
+ if err := dir.wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
|
|
+ if err := filer_pb.CreateEntry(client, request); err != nil {
|
|
|
if strings.Contains(err.Error(), "EEXIST") {
|
|
|
return fuse.EEXIST
|
|
|
}
|
|
@@ -167,7 +167,7 @@ func (dir *Dir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fs.Node, err
|
|
|
},
|
|
|
}
|
|
|
|
|
|
- err := dir.wfs.WithFilerClient(ctx, func(ctx context.Context, client filer_pb.SeaweedFilerClient) error {
|
|
|
+ err := dir.wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
|
|
|
|
|
request := &filer_pb.CreateEntryRequest{
|
|
|
Directory: dir.Path,
|
|
@@ -175,7 +175,7 @@ func (dir *Dir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fs.Node, err
|
|
|
}
|
|
|
|
|
|
glog.V(1).Infof("mkdir: %v", request)
|
|
|
- if err := filer_pb.CreateEntry(ctx, client, request); err != nil {
|
|
|
+ if err := filer_pb.CreateEntry(client, request); err != nil {
|
|
|
glog.V(0).Infof("mkdir %s/%s: %v", dir.Path, req.Name, err)
|
|
|
return err
|
|
|
}
|
|
@@ -200,7 +200,7 @@ func (dir *Dir) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.
|
|
|
|
|
|
if entry == nil {
|
|
|
// glog.V(3).Infof("dir Lookup cache miss %s", fullFilePath)
|
|
|
- entry, err = filer2.GetEntry(ctx, dir.wfs, fullFilePath)
|
|
|
+ entry, err = filer2.GetEntry(dir.wfs, fullFilePath)
|
|
|
if err != nil {
|
|
|
glog.V(1).Infof("dir GetEntry %s: %v", fullFilePath, err)
|
|
|
return nil, fuse.ENOENT
|
|
@@ -239,7 +239,7 @@ func (dir *Dir) ReadDirAll(ctx context.Context) (ret []fuse.Dirent, err error) {
|
|
|
|
|
|
cacheTtl := 5 * time.Minute
|
|
|
|
|
|
- readErr := filer2.ReadDirAllEntries(ctx, dir.wfs, filer2.FullPath(dir.Path), "", func(entry *filer_pb.Entry, isLast bool) {
|
|
|
+ readErr := filer2.ReadDirAllEntries(dir.wfs, filer2.FullPath(dir.Path), "", func(entry *filer_pb.Entry, isLast bool) {
|
|
|
fullpath := filer2.NewFullPath(dir.Path, entry.Name)
|
|
|
inode := fullpath.AsInode()
|
|
|
if entry.IsDirectory {
|
|
@@ -262,17 +262,17 @@ func (dir *Dir) ReadDirAll(ctx context.Context) (ret []fuse.Dirent, err error) {
|
|
|
func (dir *Dir) Remove(ctx context.Context, req *fuse.RemoveRequest) error {
|
|
|
|
|
|
if !req.Dir {
|
|
|
- return dir.removeOneFile(ctx, req)
|
|
|
+ return dir.removeOneFile(req)
|
|
|
}
|
|
|
|
|
|
- return dir.removeFolder(ctx, req)
|
|
|
+ return dir.removeFolder(req)
|
|
|
|
|
|
}
|
|
|
|
|
|
-func (dir *Dir) removeOneFile(ctx context.Context, req *fuse.RemoveRequest) error {
|
|
|
+func (dir *Dir) removeOneFile(req *fuse.RemoveRequest) error {
|
|
|
|
|
|
filePath := filer2.NewFullPath(dir.Path, req.Name)
|
|
|
- entry, err := filer2.GetEntry(ctx, dir.wfs, filePath)
|
|
|
+ entry, err := filer2.GetEntry(dir.wfs, filePath)
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
@@ -280,11 +280,11 @@ func (dir *Dir) removeOneFile(ctx context.Context, req *fuse.RemoveRequest) erro
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
- dir.wfs.deleteFileChunks(ctx, entry.Chunks)
|
|
|
+ dir.wfs.deleteFileChunks(entry.Chunks)
|
|
|
|
|
|
dir.wfs.cacheDelete(filePath)
|
|
|
|
|
|
- return dir.wfs.WithFilerClient(ctx, func(ctx context.Context, client filer_pb.SeaweedFilerClient) error {
|
|
|
+ return dir.wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
|
|
|
|
|
request := &filer_pb.DeleteEntryRequest{
|
|
|
Directory: dir.Path,
|
|
@@ -293,7 +293,7 @@ func (dir *Dir) removeOneFile(ctx context.Context, req *fuse.RemoveRequest) erro
|
|
|
}
|
|
|
|
|
|
glog.V(3).Infof("remove file: %v", request)
|
|
|
- _, err := client.DeleteEntry(ctx, request)
|
|
|
+ _, err := client.DeleteEntry(context.Background(), request)
|
|
|
if err != nil {
|
|
|
glog.V(3).Infof("not found remove file %s/%s: %v", dir.Path, req.Name, err)
|
|
|
return fuse.ENOENT
|
|
@@ -304,11 +304,11 @@ func (dir *Dir) removeOneFile(ctx context.Context, req *fuse.RemoveRequest) erro
|
|
|
|
|
|
}
|
|
|
|
|
|
-func (dir *Dir) removeFolder(ctx context.Context, req *fuse.RemoveRequest) error {
|
|
|
+func (dir *Dir) removeFolder(req *fuse.RemoveRequest) error {
|
|
|
|
|
|
dir.wfs.cacheDelete(filer2.NewFullPath(dir.Path, req.Name))
|
|
|
|
|
|
- return dir.wfs.WithFilerClient(ctx, func(ctx context.Context, client filer_pb.SeaweedFilerClient) error {
|
|
|
+ return dir.wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
|
|
|
|
|
request := &filer_pb.DeleteEntryRequest{
|
|
|
Directory: dir.Path,
|
|
@@ -317,7 +317,7 @@ func (dir *Dir) removeFolder(ctx context.Context, req *fuse.RemoveRequest) error
|
|
|
}
|
|
|
|
|
|
glog.V(3).Infof("remove directory entry: %v", request)
|
|
|
- _, err := client.DeleteEntry(ctx, request)
|
|
|
+ _, err := client.DeleteEntry(context.Background(), request)
|
|
|
if err != nil {
|
|
|
glog.V(3).Infof("not found remove %s/%s: %v", dir.Path, req.Name, err)
|
|
|
return fuse.ENOENT
|
|
@@ -419,7 +419,7 @@ func (dir *Dir) Forget() {
|
|
|
func (dir *Dir) maybeLoadEntry(ctx context.Context) error {
|
|
|
if dir.entry == nil {
|
|
|
parentDirPath, name := filer2.FullPath(dir.Path).DirAndName()
|
|
|
- entry, err := dir.wfs.maybeLoadEntry(ctx, parentDirPath, name)
|
|
|
+ entry, err := dir.wfs.maybeLoadEntry(parentDirPath, name)
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
@@ -432,7 +432,7 @@ func (dir *Dir) saveEntry(ctx context.Context) error {
|
|
|
|
|
|
parentDir, name := filer2.FullPath(dir.Path).DirAndName()
|
|
|
|
|
|
- return dir.wfs.WithFilerClient(ctx, func(ctx context.Context, client filer_pb.SeaweedFilerClient) error {
|
|
|
+ return dir.wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
|
|
|
|
|
request := &filer_pb.UpdateEntryRequest{
|
|
|
Directory: parentDir,
|
|
@@ -440,7 +440,7 @@ func (dir *Dir) saveEntry(ctx context.Context) error {
|
|
|
}
|
|
|
|
|
|
glog.V(1).Infof("save dir entry: %v", request)
|
|
|
- _, err := client.UpdateEntry(ctx, request)
|
|
|
+ _, err := client.UpdateEntry(context.Background(), request)
|
|
|
if err != nil {
|
|
|
glog.V(0).Infof("UpdateEntry dir %s/%s: %v", parentDir, name, err)
|
|
|
return fuse.EIO
|