Commit 00110399 authored by Kirill Smelkov's avatar Kirill Smelkov

.

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