summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Rettberg2020-07-31 13:34:02 +0200
committerSimon Rettberg2020-07-31 13:34:02 +0200
commit22648d16cc2eda61b4eb1d1543b04f4ce59a0be0 (patch)
tree253384b5991d96ad9cba6a635f18ae7e2d47ce34 /src
parent[SERVER] FUSE: Fix arguments to fuse (diff)
downloaddnbd3-22648d16cc2eda61b4eb1d1543b04f4ce59a0be0.tar.gz
dnbd3-22648d16cc2eda61b4eb1d1543b04f4ce59a0be0.tar.xz
dnbd3-22648d16cc2eda61b4eb1d1543b04f4ce59a0be0.zip
[SERVER] FUSE: Use splice with move for local reads
Greatly improves performance when reading from the local disk cache, and additionally avoids having everything in the fs cache twice (disk view and fuse view).
Diffstat (limited to 'src')
-rw-r--r--src/server/fuse.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/server/fuse.c b/src/server/fuse.c
index 48e3e5e..1496972 100644
--- a/src/server/fuse.c
+++ b/src/server/fuse.c
@@ -319,7 +319,7 @@ static void ll_read( fuse_req_t req, fuse_ino_t ino UNUSED, size_t size, off_t o
.fd = -1,
};
}
- fuse_reply_data( req, vec, 0 );
+ fuse_reply_data( req, vec, FUSE_BUF_SPLICE_MOVE );
free( vec );
}
@@ -517,6 +517,20 @@ static void uplinkCallback(void *data, uint64_t handle UNUSED, uint64_t start UN
}
}
+#define DUMP(key,type) logadd( LOG_DEBUG1, "FUSE: " #key ": " type, conn->key )
+void ll_init(void *userdata, struct fuse_conn_info *conn)
+{
+ DUMP( capable, "%u" );
+ DUMP( congestion_threshold, "%u" );
+ DUMP( max_background, "%u" );
+ //DUMP( max_read, "%u" );
+ DUMP( max_readahead, "%u" );
+ DUMP( max_write, "%u" );
+ DUMP( want, "%u" );
+ conn->want |= FUSE_CAP_SPLICE_READ | FUSE_CAP_SPLICE_WRITE | FUSE_CAP_SPLICE_MOVE;
+}
+#undef DUMP
+
/* map the implemented fuse operations */
static struct fuse_lowlevel_ops fuseOps = {
.lookup = ll_lookup,
@@ -527,7 +541,7 @@ static struct fuse_lowlevel_ops fuseOps = {
.release = ll_release,
.read = ll_read,
.write = ll_write,
- //.init = ll_init,
+ .init = ll_init,
//.destroy = ll_destroy,
};