Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
e8c26821
Commit
e8c26821
authored
Oct 15, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
46e6f6a0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
82 deletions
+9
-82
wcfs/misc.go
wcfs/misc.go
+3
-9
wcfs/wcfs.go
wcfs/wcfs.go
+6
-73
No files found.
wcfs/misc.go
View file @
e8c26821
...
...
@@ -34,12 +34,9 @@ import (
"lab.nexedi.com/kirr/neo/go/zodb"
)
// // errors as fuse.Status (not already exposed by fuse iteself)
// const (
// fEEXIST = fuse.Status(syscall.EEXIST)
// )
// eInvalError is the error wrapper signifying that underlying error is about "invalid argument".
// err2LogStatus converts such errors into EINVAL return code + logs as warning.
type
eInvalError
struct
{
err
error
}
...
...
@@ -75,18 +72,15 @@ func err2LogStatus(err error) fuse.Status {
}
// otherwise log as warnings EINVAL and as errors everything else
var
st
fuse
.
Status
switch
errors
.
Cause
(
err
)
.
(
type
)
{
case
*
eInvalError
:
st
=
fuse
.
EINVAL
log
.
Warning
(
err
)
return
fuse
.
EINVAL
default
:
st
=
fuse
.
EIO
log
.
Error
(
err
)
return
fuse
.
EIO
}
return
st
}
...
...
wcfs/wcfs.go
View file @
e8c26821
...
...
@@ -356,74 +356,11 @@ type blkLoadState struct {
// ----------------------------------------
/*
// create new read-only transaction for this bigfile
txn, txnCtx := transaction.New(context.Background())
defer func() {
if status != fuse.OK {
txn.Abort()
}
}()
// create new DB/Connection for this bigfile
// XXX better ctx = transaction.PutIntoContext(ctx, txn)
ctx, cancel := xcontext.Merge(asctx(fctx), txnCtx)
defer cancel()
zdb := zodb.NewDB(bfroot.zstor)
zconn, err := zdb.Open(ctx, &zodb.ConnOptions{}) // XXX .NoSync=true ?
if err != nil {
log.Errorf("/bigfile: mkdir %q: %s", name, err)
return nil, fuse.EIO
}
xzbf, err := zconn.Get(ctx, oid)
if err != nil {
switch errors.Cause(err).(type) {
case *zodb.NoObjectError:
return nil, fuse.EINVAL
case *zodb.NoDataError:
return nil, fuse.EINVAL // XXX what to do if it was existing and got deleted?
default:
log.Errorf("/bigfile: mkdir %q: %s", name, err)
return nil, fuse.EIO
}
}
zbf, ok := xzbf.(*ZBigFile)
if !ok {
log.Warningf("/bigfile: mkdir %q: %s is not a ZBigFile", name, typeOf(xzbf))
return nil, fuse.EINVAL
}
// activate ZBigFile and keep it this way
err = zbf.PActivate(ctx)
if err != nil {
log.Errorf("/bigfile: mkdir %q: %s", name, err)
return nil, fuse.EIO
}
defer func() {
if status != fuse.OK {
zbf.PDeactivate()
}
}()
zbfSize, err := zbf.Size(ctx)
if err != nil {
log.Errorf("/bigfile: mkdir %q: %s", name, err)
return nil, fuse.EIO
}
*/
// /bigfile -> Mkdir receives client request to create /bigfile/<bigfileX>.
//
// It creates <bigfileX>/head/* along the way.
func
(
bfroot
*
BigFileRoot
)
Mkdir
(
name
string
,
mode
uint32
,
fctx
*
fuse
.
Context
)
(
_
*
nodefs
.
Inode
,
status
fuse
.
Status
)
{
// XXX ok to ignore mode?
inode
,
err
:=
bfroot
.
mkdir
(
name
,
fctx
)
func
(
bfroot
*
BigFileRoot
)
Mkdir
(
name
string
,
mode
uint32
,
fctx
*
fuse
.
Context
)
(
*
nodefs
.
Inode
,
fuse
.
Status
)
{
inode
,
err
:=
bfroot
.
mkdir
(
name
,
fctx
)
// XXX ok to ignore mode?
return
inode
,
err2LogStatus
(
err
)
}
...
...
@@ -436,7 +373,6 @@ func (bfroot *BigFileRoot) mkdir(name string, fctx *fuse.Context) (_ *nodefs.Ino
return
nil
,
eINVALf
(
"not oid"
)
}
// check to see if dir(oid) is already there
bfroot
.
mu
.
Lock
()
_
,
already
:=
bfroot
.
tab
[
oid
]
...
...
@@ -446,7 +382,7 @@ func (bfroot *BigFileRoot) mkdir(name string, fctx *fuse.Context) (_ *nodefs.Ino
return
nil
,
syscall
.
EEXIST
}
// not there - without bfroot lock proceed to
load corresponding objects
from ZODB
// not there - without bfroot lock proceed to
open BigFile
from ZODB
zdb
:=
zodb
.
NewDB
(
bfroot
.
zstor
)
bf
,
err
:=
bigopen
(
asctx
(
fctx
),
zdb
,
oid
,
&
zodb
.
ConnOptions
{})
if
err
!=
nil
{
...
...
@@ -500,8 +436,7 @@ func (bfroot *BigFileRoot) mkdir(name string, fctx *fuse.Context) (_ *nodefs.Ino
// /bigfile/<bigfileX> -> Mkdir receives client request to create @<tid>/.
func
(
bfdir
*
BigFileDir
)
Mkdir
(
name
string
,
mode
uint32
,
fctx
*
fuse
.
Context
)
(
*
nodefs
.
Inode
,
fuse
.
Status
)
{
// XXX ok to ignore mode?
inode
,
err
:=
bfdir
.
mkdir
(
name
,
fctx
)
inode
,
err
:=
bfdir
.
mkdir
(
name
,
fctx
)
// XXX ok to ignore mode?
return
inode
,
err2LogStatus
(
err
)
}
...
...
@@ -519,8 +454,7 @@ func (bfdir *BigFileDir) mkdir(name string, fctx *fuse.Context) (_ *nodefs.Inode
return
nil
,
eINVALf
(
"not @tid"
)
}
// check to see if dir(tid) is already
// check to see if dir(tid) is already there
bfdir
.
mu
.
Lock
()
_
,
already
:=
bfdir
.
revTab
[
tid
]
bfdir
.
mu
.
Unlock
()
...
...
@@ -529,8 +463,7 @@ func (bfdir *BigFileDir) mkdir(name string, fctx *fuse.Context) (_ *nodefs.Inode
return
nil
,
syscall
.
EEXIST
}
// not there - without bfdir lock proceed to create @tid historical connection
// not there - without bfdir lock proceed to open BigFile @tid view of ZODB
bf
,
err
:=
bigopen
(
asctx
(
fctx
),
bfdir
.
zdb
,
bfdir
.
oid
,
&
zodb
.
ConnOptions
{
At
:
tid
,
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment