aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2008-05-12 17:02:32 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-05-13 11:02:26 -0400
commit78bb6cb9a890d3d50ca3b02fce9223d3e734ab9b (patch)
tree330cc4fd17af9176ae9e2ee833e1097638fd1b30 /fs/fuse
parent0f146a764ff08c4c210c04239c5e6784b4b77485 (diff)
fuse: add flag to turn on big writes
Prior to 2.6.26 fuse only supported single page write requests. In theory all fuse filesystem should be able support bigger than 4k writes, as there's nothing in the API to prevent it. Unfortunately there's a known case in NTFS-3G where big writes cause filesystem corruption. There could also be other filesystems, where the lack of testing with big write requests would result in bugs. To prevent such problems on a kernel upgrade, disable big writes by default, but let filesystems set a flag to turn it on. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Cc: Szabolcs Szakacsits <szaka@ntfs-3g.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/file.c2
-rw-r--r--fs/fuse/fuse_i.h3
-rw-r--r--fs/fuse/inode.c5
3 files changed, 9 insertions, 1 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index f28cf8b46f80..8092f0d9fd1f 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -804,6 +804,8 @@ static ssize_t fuse_fill_write_pages(struct fuse_req *req,
804 if (offset == PAGE_CACHE_SIZE) 804 if (offset == PAGE_CACHE_SIZE)
805 offset = 0; 805 offset = 0;
806 806
807 if (!fc->big_writes)
808 break;
807 } while (iov_iter_count(ii) && count < fc->max_write && 809 } while (iov_iter_count(ii) && count < fc->max_write &&
808 req->num_pages < FUSE_MAX_PAGES_PER_REQ && offset == 0); 810 req->num_pages < FUSE_MAX_PAGES_PER_REQ && offset == 0);
809 811
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index dadffa21a206..bae948657c4f 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -404,6 +404,9 @@ struct fuse_conn {
404 /** Is bmap not implemented by fs? */ 404 /** Is bmap not implemented by fs? */
405 unsigned no_bmap : 1; 405 unsigned no_bmap : 1;
406 406
407 /** Do multi-page cached writes */
408 unsigned big_writes : 1;
409
407 /** The number of requests waiting for completion */ 410 /** The number of requests waiting for completion */
408 atomic_t num_waiting; 411 atomic_t num_waiting;
409 412
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 79b615873838..fb77e0962132 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -576,6 +576,8 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
576 fc->no_lock = 1; 576 fc->no_lock = 1;
577 if (arg->flags & FUSE_ATOMIC_O_TRUNC) 577 if (arg->flags & FUSE_ATOMIC_O_TRUNC)
578 fc->atomic_o_trunc = 1; 578 fc->atomic_o_trunc = 1;
579 if (arg->flags & FUSE_BIG_WRITES)
580 fc->big_writes = 1;
579 } else { 581 } else {
580 ra_pages = fc->max_read / PAGE_CACHE_SIZE; 582 ra_pages = fc->max_read / PAGE_CACHE_SIZE;
581 fc->no_lock = 1; 583 fc->no_lock = 1;
@@ -599,7 +601,8 @@ static void fuse_send_init(struct fuse_conn *fc, struct fuse_req *req)
599 arg->major = FUSE_KERNEL_VERSION; 601 arg->major = FUSE_KERNEL_VERSION;
600 arg->minor = FUSE_KERNEL_MINOR_VERSION; 602 arg->minor = FUSE_KERNEL_MINOR_VERSION;
601 arg->max_readahead = fc->bdi.ra_pages * PAGE_CACHE_SIZE; 603 arg->max_readahead = fc->bdi.ra_pages * PAGE_CACHE_SIZE;
602 arg->flags |= FUSE_ASYNC_READ | FUSE_POSIX_LOCKS | FUSE_ATOMIC_O_TRUNC; 604 arg->flags |= FUSE_ASYNC_READ | FUSE_POSIX_LOCKS | FUSE_ATOMIC_O_TRUNC |
605 FUSE_BIG_WRITES;
603 req->in.h.opcode = FUSE_INIT; 606 req->in.h.opcode = FUSE_INIT;
604 req->in.numargs = 1; 607 req->in.numargs = 1;
605 req->in.args[0].size = sizeof(*arg); 608 req->in.args[0].size = sizeof(*arg);