diff options
author | yangyun50 <149988609+yangyun50@users.noreply.github.com> | 2024-06-04 19:50:48 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-04 13:50:48 +0200 |
commit | cef8c8b249023fb8129ae791e0998cbca771f96a (patch) | |
tree | f7e335bb6fe30feadaef0cac05c23fcb957f79ab /example/hello_ll_uds.c | |
parent | 949944ff3bde50d62f98b0cab15cef2959d40a2d (diff) | |
download | libfuse-cef8c8b249023fb8129ae791e0998cbca771f96a.tar.gz |
Add support for no_interrupt (#956)
The function fuse_session_process_buf_int() would do much things
for FUSE_INTERRUPT requests, even there are no FUSE_INTERRUPT requests:
1. check every non-FUSE_INTERRUPT request and add these requests to the
linked list(se->list) under a big lock(se->lock).
2. the function fuse_free_req() frees every request and remove them from
the linked list(se->list) under a bing lock(se->lock).
These operations are not meaningful when there are no FUSE_INTERRUPT requests,
and have a great impact on the performance of fuse filesystem because the big
lock for each request.
In some cases, FUSE_INTERRUPT requests are infrequent, even none at all.
Besides, the user-defined filesystem may do nothing for FUSE_INTERRUPT requests.
And the kernel side has the option "no_interrupt" in struct fuse_conn. This kernel option
can be enabled by return ENOSYS in libfuse for the reply of FUSE_INTERRUPT request.
But I don't find the code to enable the "no_interrupt" kernel option in libfuse.
So add the no_interrupt support, and when this operaion is enabled:
1. remove the useless locking operaions and list operations.
2. return ENOSYS for the reply of FUSE_INTERRUPT request to inform the kernel to disable
FUSE_INTERRUPT request.
Diffstat (limited to 'example/hello_ll_uds.c')
-rw-r--r-- | example/hello_ll_uds.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/example/hello_ll_uds.c b/example/hello_ll_uds.c index f291fed..a566155 100644 --- a/example/hello_ll_uds.c +++ b/example/hello_ll_uds.c @@ -77,6 +77,14 @@ static void hello_ll_getattr(fuse_req_t req, fuse_ino_t ino, fuse_reply_attr(req, &stbuf, 1.0); } +static void hello_ll_init(void *userdata, struct fuse_conn_info *conn) +{ + (void)userdata; + + /* Disable the receiving and processing of FUSE_INTERRUPT requests */ + conn->no_interrupt = 1; +} + static void hello_ll_lookup(fuse_req_t req, fuse_ino_t parent, const char *name) { struct fuse_entry_param e; @@ -164,6 +172,7 @@ static void hello_ll_read(fuse_req_t req, fuse_ino_t ino, size_t size, } static const struct fuse_lowlevel_ops hello_ll_oper = { + .init = hello_ll_init, .lookup = hello_ll_lookup, .getattr = hello_ll_getattr, .readdir = hello_ll_readdir, |