From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: Li Yiyan <mail.sjtu.edu.cn@proxy188.sjtu.edu.cn>,
linux-erofs@lists.ozlabs.org
Subject: Re: [PATCH v1] erofs-utils: fuse: support FUSE 2/3 multi-threading
Date: Tue, 12 Dec 2023 19:08:04 +0800 [thread overview]
Message-ID: <6d4a8db8-0930-4792-862f-e7fc59093387@linux.alibaba.com> (raw)
In-Reply-To: <20231212073828.2623270-1-user@lee-WorkStation>
On 2023/12/12 15:38, Li Yiyan wrote:
> From: Li Yiyan <lyy0627@sjtu.edu.cn>
>
> Introduce multi-threading support for FUSE and adjust the configure.ac
> to allow users of FUSE 3(> 3.2) to use API version 32, while maintaining
> compatibility with API version 30 for FUSE 3 (3.0/3.1) and API version
> 26 for FUSE 2.
>
> Signed-off-by: Li Yiyan <lyy0627@sjtu.edu.cn>> ---
> configure.ac | 8 +++++++-
> fuse/main.c | 19 +++++++++++++++++--
> 2 files changed, 24 insertions(+), 3 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 9294e0c..bf6e99f 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -343,7 +343,13 @@ AS_IF([test "x$enable_fuse" != "xno"], [
> saved_LIBS="$LIBS"
> saved_CPPFLAGS=${CPPFLAGS}
> PKG_CHECK_MODULES([libfuse3], [fuse3 >= 3.0], [
> - AC_DEFINE([FUSE_USE_VERSION], [30], [used FUSE API version])
> + PKG_CHECK_MODULES([libfuse3_0], [fuse3 >= 3.0 fuse3 < 3.2], [
> + AC_DEFINE([FUSE_USE_VERSION], [30], [used FUSE API version])
> + ], [
> + PKG_CHECK_MODULES([libfuse3_2], [fuse3 >= 3.2], [
> + AC_DEFINE([FUSE_USE_VERSION], [32], [used FUSE API version])
> + ])
> + ])
> CPPFLAGS="${libfuse3_CFLAGS} ${CPPFLAGS}"
> LIBS="${libfuse3_LIBS} $LIBS"
> AC_CHECK_LIB(fuse3, fuse_session_new, [], [
> diff --git a/fuse/main.c b/fuse/main.c
> index f07165c..77b2d50 100644
> --- a/fuse/main.c
> +++ b/fuse/main.c
> @@ -699,7 +699,19 @@ int main(int argc, char *argv[])
> EROFSFUSE_MOUNT_MSG
> if (fuse_daemonize(opts.foreground) >= 0) {
> if (fuse_set_signal_handlers(se) >= 0) {
> - ret = fuse_session_loop(se);
> + if (opts.singlethread) {
> + ret = fuse_session_loop(se);
> + } else {
> +#if FUSE_MINOR_VERSION < 2
Can we check FUSE_USE_VERSION directly?
if FUSE_USE_VERSION is neither 30 or 32, let's raise a build error with
#error unsupported FUSE_USE_VERSION
instead.
Thanks,
Gao Xiang
> + ret = fuse_session_loop_mt(se, opts.clone_fd);
> +#else
> + struct fuse_loop_config config = {
> + .clone_fd = opts.clone_fd,
> + .max_idle_threads = opts.max_idle_threads
> + };
> + ret = fuse_session_loop_mt(se, &config);
> +#endif
> + }
> fuse_remove_signal_handlers(se);
> }
> fuse_session_unmount(se);
> @@ -717,7 +729,10 @@ int main(int argc, char *argv[])
> if (fuse_daemonize(opts.foreground) != -1) {
> if (fuse_set_signal_handlers(se) != -1) {
> fuse_session_add_chan(se, ch);
> - ret = fuse_session_loop(se);
> + if (opts.mt)
> + ret = fuse_session_loop_mt(se);
> + else
> + ret = fuse_session_loop(se);
> fuse_remove_signal_handlers(se);
> fuse_session_remove_chan(ch);
> }
prev parent reply other threads:[~2023-12-12 11:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-12 7:38 [PATCH v1] erofs-utils: fuse: support FUSE 2/3 multi-threading Li Yiyan
2023-12-12 11:08 ` Gao Xiang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6d4a8db8-0930-4792-862f-e7fc59093387@linux.alibaba.com \
--to=hsiangkao@linux.alibaba.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=mail.sjtu.edu.cn@proxy188.sjtu.edu.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.