fuse: add atomic open+truncate support
This patch allows fuse filesystems to implement open(..., O_TRUNC) as a single request, instead of separate truncate and open requests. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
17637cbaba
commit
6ff958edbf
@@ -531,6 +531,8 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
|
||||
fc->async_read = 1;
|
||||
if (!(arg->flags & FUSE_POSIX_LOCKS))
|
||||
fc->no_lock = 1;
|
||||
if (arg->flags & FUSE_ATOMIC_O_TRUNC)
|
||||
fc->atomic_o_trunc = 1;
|
||||
} else {
|
||||
ra_pages = fc->max_read / PAGE_CACHE_SIZE;
|
||||
fc->no_lock = 1;
|
||||
@@ -553,7 +555,8 @@ static void fuse_send_init(struct fuse_conn *fc, struct fuse_req *req)
|
||||
arg->major = FUSE_KERNEL_VERSION;
|
||||
arg->minor = FUSE_KERNEL_MINOR_VERSION;
|
||||
arg->max_readahead = fc->bdi.ra_pages * PAGE_CACHE_SIZE;
|
||||
arg->flags |= FUSE_ASYNC_READ | FUSE_POSIX_LOCKS | FUSE_FILE_OPS;
|
||||
arg->flags |= FUSE_ASYNC_READ | FUSE_POSIX_LOCKS | FUSE_FILE_OPS |
|
||||
FUSE_ATOMIC_O_TRUNC;
|
||||
req->in.h.opcode = FUSE_INIT;
|
||||
req->in.numargs = 1;
|
||||
req->in.args[0].size = sizeof(*arg);
|
||||
|
||||
Reference in New Issue
Block a user