aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Fleischer <fleiben@gmail.com>2017-07-07 23:30:14 +0200
committerBenjamin Fleischer <fleiben@gmail.com>2017-07-07 23:30:14 +0200
commit5c0dbfe3eb40100f9277e863926f2e7d7c9a5a4c (patch)
tree02aa6a83c507ddbfb804657259fa63d3509030eb
parenteb1b7b1b6f742baac5ef8218d8a9471fd6a17c3c (diff)
downloadsshfs-5c0dbfe3eb40100f9277e863926f2e7d7c9a5a4c.tar
sshfs-5c0dbfe3eb40100f9277e863926f2e7d7c9a5a4c.tar.gz
sshfs-5c0dbfe3eb40100f9277e863926f2e7d7c9a5a4c.tar.bz2
sshfs-5c0dbfe3eb40100f9277e863926f2e7d7c9a5a4c.zip
Fall back to global I/O size on macOS
The st_blksize value of struct stat represents the optimal block size for file I/O operations. FUSE for macOS will use this value when preforming read or write operations on the file. The smaller st_blksize is the more context switches are required to complete the operation. Setting st_blksize to 0 results in FUSE for macOS falling back to the global I/O size, that can be specified through the "-o iosize=..." mount-time option. Fixes osxfuse/osxfuse#389 and osxfuse/sshfs#33
-rw-r--r--sshfs.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sshfs.c b/sshfs.c
index 8cde971..2ef45d5 100644
--- a/sshfs.c
+++ b/sshfs.c
@@ -2000,6 +2000,9 @@ static int sshfs_getattr(const char *path, struct stat *stbuf)
&buf, SSH_FXP_ATTRS, &outbuf);
if (!err) {
err = buf_get_attrs(&outbuf, stbuf, NULL);
+#ifdef __APPLE__
+ stbuf->st_blksize = 0;
+#endif
buf_free(&outbuf);
}
buf_free(&buf);
@@ -3203,6 +3206,9 @@ static int sshfs_fgetattr(const char *path, struct stat *stbuf,
err = sftp_request(SSH_FXP_FSTAT, &buf, SSH_FXP_ATTRS, &outbuf);
if (!err) {
err = buf_get_attrs(&outbuf, stbuf, NULL);
+#ifdef __APPLE__
+ stbuf->st_blksize = 0;
+#endif
buf_free(&outbuf);
}
buf_free(&buf);