diff options
author | Bernd Schubert <bschubert@ddn.com> | 2024-09-27 00:57:21 +0200 |
---|---|---|
committer | Bernd Schubert <bernd.schubert@fastmail.fm> | 2024-09-28 16:24:22 +0200 |
commit | ba7d362d14757f937a05026a612759f487ffc168 (patch) | |
tree | a9db235a74c0bea522107ab5db8416f57e0a2628 /lib | |
parent | 9069ad9eb6ba908de9cbbdd8ba411cac963101ff (diff) | |
download | libfuse-ba7d362d14757f937a05026a612759f487ffc168.tar.gz |
fuse_lowlevel FUSE_INIT: group bufsize and max_write adjustments
The further these lines are separated from each other the harder
it is to read the code.
There shouldn't be any code change behavior here.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fuse_lowlevel.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index 819e435..84185d5 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -2114,20 +2114,10 @@ void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) se->conn.time_gran = 1; - if (bufsize < FUSE_MIN_READ_BUFFER) { - fuse_log(FUSE_LOG_ERR, "fuse: warning: buffer size too small: %zu\n", - bufsize); - bufsize = FUSE_MIN_READ_BUFFER; - } - se->bufsize = bufsize; - se->got_init = 1; if (se->op.init) se->op.init(se->userdata, &se->conn); - if (se->conn.max_write > bufsize - FUSE_BUFFER_HEADER_SIZE) - se->conn.max_write = bufsize - FUSE_BUFFER_HEADER_SIZE; - if (se->conn.want & (~se->conn.capable)) { fuse_log(FUSE_LOG_ERR, "fuse: error: filesystem requested capabilities " "0x%x that are not supported by kernel, aborting.\n", @@ -2149,9 +2139,19 @@ void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) return; } - if (se->conn.max_write < bufsize - FUSE_BUFFER_HEADER_SIZE) { - se->bufsize = se->conn.max_write + FUSE_BUFFER_HEADER_SIZE; + if (bufsize < FUSE_MIN_READ_BUFFER) { + fuse_log(FUSE_LOG_ERR, + "fuse: warning: buffer size too small: %zu\n", + bufsize); + bufsize = FUSE_MIN_READ_BUFFER; } + + if (se->conn.max_write > bufsize - FUSE_BUFFER_HEADER_SIZE) + se->conn.max_write = bufsize - FUSE_BUFFER_HEADER_SIZE; + if (se->conn.max_write < bufsize - FUSE_BUFFER_HEADER_SIZE) + bufsize = se->conn.max_write + FUSE_BUFFER_HEADER_SIZE; + se->bufsize = bufsize; + if (arg->flags & FUSE_MAX_PAGES) { outarg.flags |= FUSE_MAX_PAGES; outarg.max_pages = (se->conn.max_write - 1) / getpagesize() + 1; |