@@ -5154,6 +5154,15 @@ fuse_init(xlator_t *this, fuse_in_header_t *finh, void *msg,
51545154 fino .max_readahead = 1 << 17 ;
51555155 fino .max_write = 1 << 17 ;
51565156 fino .flags = FUSE_ASYNC_READ | FUSE_POSIX_LOCKS ;
5157+ #if FUSE_KERNEL_MINOR_VERSION >= 28
5158+ if (fini -> minor >= 28 ) {
5159+ fino .max_readahead = priv -> fuse_max_read ;
5160+ fino .max_write = priv -> fuse_max_write ;
5161+ fino .max_pages = max (priv -> fuse_max_write , priv -> fuse_max_read ) / sysconf (_SC_PAGESIZE );
5162+ if (fino .max_pages == FUSE_MAX_MAX_PAGES )
5163+ fino .flags |= FUSE_MAX_PAGES ;
5164+ }
5165+ #endif
51575166#if FUSE_KERNEL_MINOR_VERSION >= 17
51585167 if (fini -> minor >= 17 )
51595168 fino .flags |= FUSE_FLOCK_LOCKS ;
@@ -6090,14 +6099,12 @@ fuse_thread_proc(void *data)
60906099 struct pollfd pfd [2 ] = {{
60916100 0 ,
60926101 }};
6093- uint32_t psize ;
60946102
60956103 this = data ;
60966104 priv = this -> private ;
60976105
60986106 THIS = this ;
60996107
6100- psize = ((struct iobuf_pool * )this -> ctx -> iobuf_pool )-> default_page_size ;
61016108 priv -> msg0_len_p = & msg0_size ;
61026109
61036110 for (;;) {
@@ -6153,7 +6160,8 @@ fuse_thread_proc(void *data)
61536160 size from 'fuse', which is as of today 128KB. If we bring in
61546161 support for higher block sizes support, then we should be
61556162 changing this one too */
6156- iobuf = iobuf_get (this -> ctx -> iobuf_pool );
6163+ iobuf = iobuf_get2 (this -> ctx -> iobuf_pool ,
6164+ max (priv -> fuse_max_write , priv -> fuse_max_read ));
61576165
61586166 /* Add extra 512 byte to the first iov so that it can
61596167 * accommodate "ordinary" non-write requests. It's not
@@ -6177,7 +6185,7 @@ fuse_thread_proc(void *data)
61776185 iov_in [1 ].iov_base = iobuf -> ptr ;
61786186
61796187 iov_in [0 ].iov_len = msg0_size ;
6180- iov_in [1 ].iov_len = psize ;
6188+ iov_in [1 ].iov_len = max ( priv -> fuse_max_write , priv -> fuse_max_read ) ;
61816189
61826190 res = sys_readv (priv -> fd , iov_in , 2 );
61836191
@@ -6910,6 +6918,12 @@ init(xlator_t *this_xl)
69106918 GF_OPTION_INIT ("fuse-dev-eperm-ratelimit-ns" ,
69116919 priv -> fuse_dev_eperm_ratelimit_ns , uint32 , cleanup_exit );
69126920
6921+ GF_OPTION_INIT ("fuse-max-write" , priv -> fuse_max_write , uint32 ,
6922+ cleanup_exit );
6923+
6924+ GF_OPTION_INIT ("fuse-max-read" , priv -> fuse_max_read , uint32 ,
6925+ cleanup_exit );
6926+
69136927 /* user has set only background-qlen, not congestion-threshold,
69146928 use the fuse kernel driver formula to set congestion. ie, 75% */
69156929 if (dict_get (this_xl -> options , "background-qlen" ) &&
@@ -6954,11 +6968,11 @@ init(xlator_t *this_xl)
69546968 goto cleanup_exit ;
69556969 }
69566970
6957- gf_asprintf (& mnt_args , "%s%s%s%sallow_other,max_read=131072 " ,
6971+ gf_asprintf (& mnt_args , "%s%s%s%sallow_other,max_read=%lu " ,
69586972 priv -> acl ? "" : "default_permissions," ,
69596973 priv -> read_only ? "ro," : "" ,
69606974 priv -> fuse_mountopts ? priv -> fuse_mountopts : "" ,
6961- priv -> fuse_mountopts ? "," : "" );
6975+ priv -> fuse_mountopts ? "," : "" , priv -> fuse_max_read );
69626976 if (!mnt_args )
69636977 goto cleanup_exit ;
69646978
@@ -7198,6 +7212,22 @@ struct volume_options options[] = {
71987212 .max = 64 ,
71997213 .description = "Sets fuse reader thread count." ,
72007214 },
7215+ {
7216+ .key = {"fuse-max-write" },
7217+ .type = GF_OPTION_TYPE_INT ,
7218+ .default_value = "131072" ,
7219+ .min = 4096 ,
7220+ .max = 1048576 ,
7221+ .description = "Sets fuse max-write bytes." ,
7222+ },
7223+ {
7224+ .key = {"fuse-max-read" },
7225+ .type = GF_OPTION_TYPE_INT ,
7226+ .default_value = "131072" ,
7227+ .min = 4096 ,
7228+ .max = 1048576 ,
7229+ .description = "Sets fuse max-read bytes." ,
7230+ },
72017231 {
72027232 .key = {"kernel-writeback-cache" },
72037233 .type = GF_OPTION_TYPE_BOOL ,
0 commit comments