diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2007-10-18 06:07:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-18 17:37:31 -0400 |
commit | 6ff958edbf39c014eb06b65ad25b736be08c4e63 (patch) | |
tree | f87af1ae11b321cfa38c25378229f25942797385 /fs/fuse/inode.c | |
parent | 17637cbaba592076c221dc045ca78422b4af6290 (diff) |
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>
Diffstat (limited to 'fs/fuse/inode.c')
-rw-r--r-- | fs/fuse/inode.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 6ef3973f4048..3c13981f48e2 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
@@ -531,6 +531,8 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req) | |||
531 | fc->async_read = 1; | 531 | fc->async_read = 1; |
532 | if (!(arg->flags & FUSE_POSIX_LOCKS)) | 532 | if (!(arg->flags & FUSE_POSIX_LOCKS)) |
533 | fc->no_lock = 1; | 533 | fc->no_lock = 1; |
534 | if (arg->flags & FUSE_ATOMIC_O_TRUNC) | ||
535 | fc->atomic_o_trunc = 1; | ||
534 | } else { | 536 | } else { |
535 | ra_pages = fc->max_read / PAGE_CACHE_SIZE; | 537 | ra_pages = fc->max_read / PAGE_CACHE_SIZE; |
536 | fc->no_lock = 1; | 538 | fc->no_lock = 1; |
@@ -553,7 +555,8 @@ static void fuse_send_init(struct fuse_conn *fc, struct fuse_req *req) | |||
553 | arg->major = FUSE_KERNEL_VERSION; | 555 | arg->major = FUSE_KERNEL_VERSION; |
554 | arg->minor = FUSE_KERNEL_MINOR_VERSION; | 556 | arg->minor = FUSE_KERNEL_MINOR_VERSION; |
555 | arg->max_readahead = fc->bdi.ra_pages * PAGE_CACHE_SIZE; | 557 | arg->max_readahead = fc->bdi.ra_pages * PAGE_CACHE_SIZE; |
556 | arg->flags |= FUSE_ASYNC_READ | FUSE_POSIX_LOCKS | FUSE_FILE_OPS; | 558 | arg->flags |= FUSE_ASYNC_READ | FUSE_POSIX_LOCKS | FUSE_FILE_OPS | |
559 | FUSE_ATOMIC_O_TRUNC; | ||
557 | req->in.h.opcode = FUSE_INIT; | 560 | req->in.h.opcode = FUSE_INIT; |
558 | req->in.numargs = 1; | 561 | req->in.numargs = 1; |
559 | req->in.args[0].size = sizeof(*arg); | 562 | req->in.args[0].size = sizeof(*arg); |