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/util.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/util.h') diff --git a/lib/util.h b/lib/util.h index 0a01711..74ce748 100644 --- a/lib/util.h +++ b/lib/util.h @@ -1 +1,3 @@ +#define ROUND_UP(val, round_to) (((val) + (round_to - 1)) & ~(round_to - 1)) + int libfuse_strtol(const char *str, long *res); -- cgit v1.2.3