Commit 00110399 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 2a4703b2
......@@ -905,6 +905,8 @@ out:
/* PyBigFile: mmap methods.
* They redirect op X to type.blkmmapper.X without going to Python level */
// XXX make sure not to hold the GIL ?
static void*
pybigfile_mmap_setup_read(VMA *vma, BigFile *file0, blk_t blk, size_t blklen)
{
......
......@@ -130,7 +130,7 @@ type fsNode struct {
xpath atomic.Value
}
func (n *fsNode) Open(flags uint32, fctx *fuse.Context) (nodefs.File, fuse.Status) {
func (n *fsNode) Open(flags uint32, _ *fuse.Context) (nodefs.File, fuse.Status) {
return &nodefs.WithFlags{
File: nil,
FuseFlags: fuse.FOPEN_KEEP_CACHE,
......@@ -215,22 +215,22 @@ func NewSmallFile(readData func() []byte) *SmallFile {
return newSmallFile(readData, fuse.FOPEN_DIRECT_IO)
}
func (f *SmallFile) Open(flags uint32, fctx *fuse.Context) (nodefs.File, fuse.Status) {
func (f *SmallFile) Open(flags uint32, _ *fuse.Context) (nodefs.File, fuse.Status) {
return &nodefs.WithFlags{
File: nil,
FuseFlags: f.fuseFlags,
}, fuse.OK
}
func (f *SmallFile) GetAttr(out *fuse.Attr, _ nodefs.File, _ *fuse.Context) fuse.Status {
data := f.readData()
func (f *SmallFile) GetAttr(out *fuse.Attr, _ nodefs.File, fctx *fuse.Context) fuse.Status {
data := f.readData() // XXX pass in fctx, so that the call could be canceled
out.Size = uint64(len(data))
out.Mode = fuse.S_IFREG | 0644
return fuse.OK
}
func (f *SmallFile) Read(_ nodefs.File, dest []byte, off int64, _ *fuse.Context) (fuse.ReadResult, fuse.Status) {
data := f.readData()
func (f *SmallFile) Read(_ nodefs.File, dest []byte, off int64, fctx *fuse.Context) (fuse.ReadResult, fuse.Status) {
data := f.readData() // XXX +fctx -> cancel
l := int64(len(data))
end := off + l
if end > l {
......@@ -339,8 +339,8 @@ func (sk *FileSock) Write(data []byte) (n int, err error) {
}
// Read implements nodefs.File and is paired with filesock.Write().
func (f *skFile) Read(dest []byte, /*ignored*/off int64) (fuse.ReadResult, fuse.Status) {
n, err := f.rx.Read(dest)
func (f *skFile) Read(dest []byte, /*ignored*/off int64, fctx *fuse.Context) (fuse.ReadResult, fuse.Status) {
n, err := f.rx.Read(dest) // XXX fctx.cancel
if n != 0 {
err = nil
}
......@@ -365,7 +365,7 @@ func (sk *FileSock) Read(dest []byte) (n int, err error) {
}
// Write implements nodefs.File and is paired with filesock.Read()
func (f *skFile) Write(data []byte, /*ignored*/off int64) (uint32, fuse.Status) {
func (f *skFile) Write(data []byte, /*ignored*/off int64, fctx *fuse.Context) (uint32, fuse.Status) {
// cap data to 2GB (not 4GB not to overflow int on 32-bit platforms)
l := len(data)
if l > math.MaxInt32 {
......@@ -373,7 +373,7 @@ func (f *skFile) Write(data []byte, /*ignored*/off int64) (uint32, fuse.Status)
data = data[:l]
}
n, err := f.tx.Write(data)
n, err := f.tx.Write(data) // XXX fctx.cancel
if n != 0 {
err = nil
}
......
......@@ -1126,7 +1126,7 @@ func (root *Root) lockRevFile(rev zodb.Tid, fid zodb.Oid) (_ *BigFile, unlock fu
// /(head|<rev>)/bigfile/<bigfileX> -> Read serves reading bigfile data.
func (f *BigFile) Read(_ nodefs.File, dest []byte, off int64, fctx *fuse.Context) (fuse.ReadResult, fuse.Status) {
f.head.zheadMu.RLock()
f.head.zheadMu.RLock() // XXX +fctx to cancel
defer f.head.zheadMu.RUnlock()
// cap read request to file size
......@@ -1941,7 +1941,7 @@ func (bfdir *BigFileDir) lookup(out *fuse.Attr, name string, fctx *fuse.Context)
return nil, eINVALf("not oid")
}
bfdir.head.zheadMu.RLock()
bfdir.head.zheadMu.RLock() // XXX +fctx -> cancel
defer bfdir.head.zheadMu.RUnlock()
defer func() {
......@@ -2160,10 +2160,10 @@ func (h *Head) readAt() []byte {
}
// /(head|<rev>)/ -> Getattr serves stat.
func (head *Head) GetAttr(out *fuse.Attr, _ nodefs.File, _ *fuse.Context) fuse.Status {
func (head *Head) GetAttr(out *fuse.Attr, _ nodefs.File, fctx *fuse.Context) fuse.Status {
at := head.rev
if at == 0 {
head.zheadMu.RLock()
head.zheadMu.RLock() // XXX +fctx -> cancel
at = head.zconn.At()
head.zheadMu.RUnlock()
}
......@@ -2175,8 +2175,8 @@ func (head *Head) GetAttr(out *fuse.Attr, _ nodefs.File, _ *fuse.Context) fuse.S
}
// /(head|<rev>)/bigfile/<bigfileX> -> Getattr serves stat.
func (f *BigFile) GetAttr(out *fuse.Attr, _ nodefs.File, _ *fuse.Context) fuse.Status {
f.head.zheadMu.RLock()
func (f *BigFile) GetAttr(out *fuse.Attr, _ nodefs.File, fctx *fuse.Context) fuse.Status {
f.head.zheadMu.RLock() // XXX +fctx -> cancel
defer f.head.zheadMu.RUnlock()
f.getattr(out)
......@@ -2235,7 +2235,7 @@ func (zh *_wcfs_Zhead) Open(flags uint32, fctx *fuse.Context) (nodefs.File, fuse
sk := NewFileSock()
sk.CloseRead()
groot.head.zheadMu.Lock()
groot.head.zheadMu.Lock() // XXX +fctx -> cancel
defer groot.head.zheadMu.Unlock()
// XXX del zheadSockTab[sk] on sk.File.Release (= client drops opened handle)
......
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