From 752b59ac087658adb50d50a492d228d53081d195 Mon Sep 17 00:00:00 2001 From: Bernd Schubert Date: Mon, 16 Dec 2024 23:37:29 +0100 Subject: Allow to have page aligned writes Read/writes IOs should be page aligned as fuse server might need to copy data to another buffer otherwise in order to fulfill network or device storage requirements. Simple reproducer is example/passthrough* and opening a file with O_DIRECT - without this change writing to that file failed with -EINVAL if the underlying file system was using ext4 (for passthrough_hp the 'passthrough' feature has to be disabled). The mis-alignment from fuse kernel is not ideal, but we can handle it by allocation one page more than needed and then using a buffer that is set up to compensate for kernel misalignment. This also only set se->buf_reallocable to true when called by a libfuse internal caller - we do not know what external callers are doing with the buffer - update to commit 0e0f43b79b9b --- lib/fuse_i.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/fuse_i.h') diff --git a/lib/fuse_i.h b/lib/fuse_i.h index d4421f2..6713ab8 100644 --- a/lib/fuse_i.h +++ b/lib/fuse_i.h @@ -188,6 +188,8 @@ void cuse_lowlevel_init(fuse_req_t req, fuse_ino_t nodeide, const void *inarg); int fuse_start_thread(pthread_t *thread_id, void *(*func)(void *), void *arg); +void fuse_buf_free(struct fuse_buf *buf); + int fuse_session_receive_buf_int(struct fuse_session *se, struct fuse_buf *buf, struct fuse_chan *ch); void fuse_session_process_buf_int(struct fuse_session *se, -- cgit v1.2.3