mirror of
https://github.com/libfuse/libfuse.git
synced 2026-07-07 14:47:41 +08:00
fuse: add FUSE_CONN_FLAG_NO_INTERRUPT conn flag
fuse_set_conn_flag() collects the libfuse-side connection hints that are not negotiated with the kernel. no_interrupt was the one such hint still set only by direct field assignment. Define FUSE_CONN_FLAG_NO_INTERRUPT alongside FUSE_CONN_FLAG_SINGLE_ISSUER and map it onto conn->no_interrupt in the same switch, and convert the example init() handlers to set it through the setter. Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
This commit is contained in:
+1
-1
@@ -92,7 +92,7 @@ static void cusexmp_init(void *userdata, struct fuse_conn_info *conn)
|
||||
(void)userdata;
|
||||
|
||||
/* Disable the receiving and processing of FUSE_INTERRUPT requests */
|
||||
conn->no_interrupt = 1;
|
||||
fuse_set_conn_flag(conn, FUSE_CONN_FLAG_NO_INTERRUPT);
|
||||
}
|
||||
|
||||
static void cusexmp_open(fuse_req_t req, struct fuse_file_info *fi)
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ static void hello_ll_init(void *userdata, struct fuse_conn_info *conn)
|
||||
fuse_set_conn_flag(conn, FUSE_CONN_FLAG_SINGLE_ISSUER);
|
||||
|
||||
/* Disable the receiving and processing of FUSE_INTERRUPT requests */
|
||||
conn->no_interrupt = 1;
|
||||
fuse_set_conn_flag(conn, FUSE_CONN_FLAG_NO_INTERRUPT);
|
||||
|
||||
/* Test setting flags the old way */
|
||||
conn->want = FUSE_CAP_ASYNC_READ;
|
||||
|
||||
@@ -82,7 +82,7 @@ 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;
|
||||
fuse_set_conn_flag(conn, FUSE_CONN_FLAG_NO_INTERRUPT);
|
||||
}
|
||||
|
||||
static void hello_ll_lookup(fuse_req_t req, fuse_ino_t parent, const char *name)
|
||||
|
||||
@@ -155,7 +155,7 @@ static void tfs_init(void *userdata, struct fuse_conn_info *conn) {
|
||||
fuse_set_conn_flag(conn, FUSE_CONN_FLAG_SINGLE_ISSUER);
|
||||
|
||||
/* Disable the receiving and processing of FUSE_INTERRUPT requests */
|
||||
conn->no_interrupt = 1;
|
||||
fuse_set_conn_flag(conn, FUSE_CONN_FLAG_NO_INTERRUPT);
|
||||
}
|
||||
|
||||
static void tfs_lookup(fuse_req_t req, fuse_ino_t parent,
|
||||
|
||||
@@ -129,7 +129,7 @@ static void tfs_init(void *userdata, struct fuse_conn_info *conn) {
|
||||
fuse_set_conn_flag(conn, FUSE_CONN_FLAG_SINGLE_ISSUER);
|
||||
|
||||
/* Disable the receiving and processing of FUSE_INTERRUPT requests */
|
||||
conn->no_interrupt = 1;
|
||||
fuse_set_conn_flag(conn, FUSE_CONN_FLAG_NO_INTERRUPT);
|
||||
}
|
||||
|
||||
static void tfs_destroy(void *userarg)
|
||||
|
||||
@@ -140,7 +140,7 @@ static void tfs_init(void *userdata, struct fuse_conn_info *conn)
|
||||
fuse_set_conn_flag(conn, FUSE_CONN_FLAG_SINGLE_ISSUER);
|
||||
|
||||
/* Disable the receiving and processing of FUSE_INTERRUPT requests */
|
||||
conn->no_interrupt = 1;
|
||||
fuse_set_conn_flag(conn, FUSE_CONN_FLAG_NO_INTERRUPT);
|
||||
}
|
||||
|
||||
static void tfs_destroy(void *userarg)
|
||||
|
||||
@@ -138,7 +138,7 @@ static void tfs_init(void *userdata, struct fuse_conn_info *conn) {
|
||||
fuse_set_conn_flag(conn, FUSE_CONN_FLAG_SINGLE_ISSUER);
|
||||
|
||||
/* Disable the receiving and processing of FUSE_INTERRUPT requests */
|
||||
conn->no_interrupt = 1;
|
||||
fuse_set_conn_flag(conn, FUSE_CONN_FLAG_NO_INTERRUPT);
|
||||
}
|
||||
|
||||
static void tfs_lookup(fuse_req_t req, fuse_ino_t parent,
|
||||
|
||||
@@ -249,7 +249,7 @@ static void sfs_init(void *userdata, fuse_conn_info *conn)
|
||||
fuse_set_feature_flag(conn, FUSE_CAP_NO_EXPORT_SUPPORT);
|
||||
|
||||
/* Disable the receiving and processing of FUSE_INTERRUPT requests */
|
||||
conn->no_interrupt = 1;
|
||||
fuse_set_conn_flag(conn, FUSE_CONN_FLAG_NO_INTERRUPT);
|
||||
|
||||
/* Try a large IO by default */
|
||||
conn->max_write = 4 * 1024 * 1024;
|
||||
|
||||
@@ -184,7 +184,7 @@ static void lo_init(void *userdata,
|
||||
}
|
||||
|
||||
/* Disable the receiving and processing of FUSE_INTERRUPT requests */
|
||||
conn->no_interrupt = 1;
|
||||
fuse_set_conn_flag(conn, FUSE_CONN_FLAG_NO_INTERRUPT);
|
||||
}
|
||||
|
||||
static void lo_destroy(void *userdata)
|
||||
|
||||
@@ -1151,10 +1151,13 @@ void fuse_unset_feature_flag(struct fuse_conn_info *conn, uint64_t flag);
|
||||
*/
|
||||
bool fuse_get_feature_flag(const struct fuse_conn_info *conn, uint64_t flag);
|
||||
|
||||
/* The file system replies to requests from the same thread that received them,
|
||||
* allowing io-uring optimizations
|
||||
/**
|
||||
* FUSE_CONN_FLAG_SINGLE_ISSUER: Reply from the same thread that received
|
||||
* requests, which allows io-uring optimizations
|
||||
* FUSE_CONN_FLAG_NO_INTERRUPT: Disable fuse interrupt handling and (libfuse overhead)
|
||||
*/
|
||||
#define FUSE_CONN_FLAG_SINGLE_ISSUER (1u << 0)
|
||||
#define FUSE_CONN_FLAG_NO_INTERRUPT (1u << 1)
|
||||
|
||||
/**
|
||||
* Set a libfuse connection flag (a FUSE_CONN_FLAG_* value). Unlike
|
||||
|
||||
@@ -2706,6 +2706,9 @@ bool fuse_set_conn_flag(struct fuse_conn_info *conn, uint64_t flag)
|
||||
case FUSE_CONN_FLAG_SINGLE_ISSUER:
|
||||
conn->io_uring_single_issuer = 1;
|
||||
return true;
|
||||
case FUSE_CONN_FLAG_NO_INTERRUPT:
|
||||
conn->no_interrupt = 1;
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user