mirror of https://github.com/trapexit/mergerfs.git
Browse Source
Merge pull request #1209 from trapexit/o_direct
Merge pull request #1209 from trapexit/o_direct
Align msg buffer memory to allow O_DIRECT to workpull/1212/head
trapexit
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 85 additions and 20 deletions
-
2libfuse/lib/fuse.c
-
72libfuse/lib/fuse_msgbuf.cpp
-
4libfuse/lib/fuse_msgbuf.hpp
-
25tests/TEST_o_direct
@ -0,0 +1,25 @@ |
|||||
|
#!/usr/bin/env python3 |
||||
|
|
||||
|
import os |
||||
|
import sys |
||||
|
import tempfile |
||||
|
import mmap |
||||
|
import resource |
||||
|
|
||||
|
(fd,filepath) = tempfile.mkstemp(dir=sys.argv[1]) |
||||
|
|
||||
|
os.close(fd) |
||||
|
|
||||
|
fd = os.open(filepath,os.O_RDWR|os.O_DIRECT|os.O_TRUNC) |
||||
|
|
||||
|
os.unlink(filepath) |
||||
|
|
||||
|
data = mmap.mmap(-1, resource.getpagesize()) |
||||
|
|
||||
|
os.write(fd,data) |
||||
|
|
||||
|
os.lseek(fd,0,os.SEEK_SET) |
||||
|
|
||||
|
data = os.read(fd,resource.getpagesize()) |
||||
|
|
||||
|
os.close(fd) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue