From 4b88fc47316c0d56ba29e64ca0cd5e36f427b507 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Tue, 22 Apr 2008 13:36:26 +0000 Subject: Limit write requests to 64kB --- ChangeLog | 2 ++ sshfs.c | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index a8da448..b66b416 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,8 @@ * Allow the '-ossh_command=CMD' command to contain parameters. Escape charater is backslash. + * Limit write requests to 64kB. + 2008-04-21 Miklos Szeredi * Fix incorrect disk usage reported by 'du' for files of size 4GB diff --git a/sshfs.c b/sshfs.c index d0b6f1b..d3d9ddc 100644 --- a/sshfs.c +++ b/sshfs.c @@ -172,6 +172,7 @@ struct sshfs { int no_check_root; int detect_uid; unsigned max_read; + unsigned max_write; unsigned ssh_ver; int sync_write; int sync_read; @@ -280,6 +281,7 @@ static struct fuse_opt sshfs_opts[] = { SSHFS_OPT("ssh_command=%s", ssh_command, 0), SSHFS_OPT("sftp_server=%s", sftp_server, 0), SSHFS_OPT("max_read=%u", max_read, 0), + SSHFS_OPT("max_write=%u", max_write, 0), SSHFS_OPT("ssh_protocol=%u", ssh_ver, 0), SSHFS_OPT("-1", ssh_ver, 1), SSHFS_OPT("workaround=%s", workarounds, 0), @@ -2995,6 +2997,7 @@ int main(int argc, char *argv[]) sshfs.blksize = 4096; sshfs.max_read = 65536; + sshfs.max_write = 65536; sshfs.nodelay_workaround = 1; sshfs.nodelaysrv_workaround = 0; sshfs.rename_workaround = 0; @@ -3087,11 +3090,15 @@ int main(int argc, char *argv[]) if (sshfs.max_read > 65536) sshfs.max_read = 65536; + if (sshfs.max_write > 65536) + sshfs.max_write = 65536; if (fuse_is_lib_option("ac_attr_timeout=")) fuse_opt_insert_arg(&args, 1, "-oauto_cache,ac_attr_timeout=0"); tmp = g_strdup_printf("-omax_read=%u", sshfs.max_read); fuse_opt_insert_arg(&args, 1, tmp); + tmp = g_strdup_printf("-omax_write=%u", sshfs.max_write); + fuse_opt_insert_arg(&args, 1, tmp); g_free(tmp); #if FUSE_VERSION >= 27 libver = fuse_version(); -- cgit v1.2.3