Commit b044f51e authored by Julius Athenstaedt's avatar Julius Athenstaedt Committed by Ramon Nou
Browse files

fuse option: max_read2 to not clash with internal max_read, this can probably...

fuse option: max_read2 to not clash with internal max_read, this can probably changed in later fuse versions
parent b2f86352
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -125,6 +125,7 @@ struct u_data {
    int writeback;
    int direct_io;
    int max_readahead;
    int max_read2;
    int fifo;
    int access;
    int xattr;
+7 −5
Original line number Diff line number Diff line
@@ -124,6 +124,7 @@ static const struct fuse_opt lo_opts[] = {
        {"direct_io", offsetof(struct u_data, direct_io), 1},
        {"no_direct_io", offsetof(struct u_data, direct_io), 0},
        {"max_readahead=%ui", offsetof(struct u_data, max_readahead), 0},
        {"max_read2=%ui", offsetof(struct u_data, max_read2), 0},
        {"fifo", offsetof(struct u_data, fifo), 1},
        {"no_fifo", offsetof(struct u_data, fifo), 0},
        {"access", offsetof(struct u_data, access), 1},
@@ -144,7 +145,8 @@ passthrough_ll_help(void) {
           "    -o no_writeback        Disable write back\n"
           "    -o direct_io           Enables direct io\n"
           "    -o no_direct_io        Disable direct io\n"
           "    -o max_readahead=1     Amount of allowed readaheads\n"
           "    -o max_readahead=0     Amount of allowed readaheads in bytes\n"
           "    -o max_read2=0         Preferred read buffer size, depends on kernel, default: 0 for unlimited. You have to set -o max_read to the same value. This is due to fuse internal logic\n"
           "    -o fifo                Enable fifo, disables GekkoFS access check\n"
           "    -o no_fifo             Disable fifo\n"
           "    -o access              Enable GekkoFS access check if fifo is deactivated\n"
@@ -161,8 +163,8 @@ passthrough_ll_help(void) {
static void
init_handler(void* userdata, struct fuse_conn_info* conn) {
    struct u_data* ud = (struct u_data*) userdata;
    DEBUG_INFO(ud, "init handler readahead %i direct_io %i", ud->max_readahead,
               ud->direct_io);
    DEBUG_INFO(ud, "init handler readahead %i direct_io %i max_read2 %i",
               ud->max_readahead, ud->direct_io, ud->max_read2);

    // TODO check other capabilities e.g. FUSE_CAP_READDIRPLUS
    if(ud->writeback) {
@@ -173,8 +175,7 @@ init_handler(void* userdata, struct fuse_conn_info* conn) {
        // for older fuse versions like on the ubuntu22
        conn->want |= FUSE_CAP_WRITEBACK_CACHE;
#endif
        DEBUG_INFO(ud, "init_handler: try to activate writeback",
                   ud->max_readahead, ud->direct_io);
        DEBUG_INFO(ud, "init_handler: try to activate writeback");
    }
    // if(lo->flock && conn->capable & FUSE_CAP_FLOCK_LOCKS) {
    //     has_flag = fuse_set_feature_flag(conn, FUSE_CAP_FLOCK_LOCKS);
@@ -186,6 +187,7 @@ init_handler(void* userdata, struct fuse_conn_info* conn) {
    /* Disable the receiving and processing of FUSE_INTERRUPT requests */
    // conn->no_interrupt = 1;
    conn->max_readahead = ud->max_readahead;
    conn->max_read = ud->max_read2;
}

static void