@@ -5154,6 +5154,15 @@ fuse_init(xlator_t *this, fuse_in_header_t *finh, void *msg,
5154
5154
fino .max_readahead = 1 << 17 ;
5155
5155
fino .max_write = 1 << 17 ;
5156
5156
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
5157
5166
#if FUSE_KERNEL_MINOR_VERSION >= 17
5158
5167
if (fini -> minor >= 17 )
5159
5168
fino .flags |= FUSE_FLOCK_LOCKS ;
@@ -6090,14 +6099,12 @@ fuse_thread_proc(void *data)
6090
6099
struct pollfd pfd [2 ] = {{
6091
6100
0 ,
6092
6101
}};
6093
- uint32_t psize ;
6094
6102
6095
6103
this = data ;
6096
6104
priv = this -> private ;
6097
6105
6098
6106
THIS = this ;
6099
6107
6100
- psize = ((struct iobuf_pool * )this -> ctx -> iobuf_pool )-> default_page_size ;
6101
6108
priv -> msg0_len_p = & msg0_size ;
6102
6109
6103
6110
for (;;) {
@@ -6153,7 +6160,8 @@ fuse_thread_proc(void *data)
6153
6160
size from 'fuse', which is as of today 128KB. If we bring in
6154
6161
support for higher block sizes support, then we should be
6155
6162
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 ));
6157
6165
6158
6166
/* Add extra 512 byte to the first iov so that it can
6159
6167
* accommodate "ordinary" non-write requests. It's not
@@ -6177,7 +6185,7 @@ fuse_thread_proc(void *data)
6177
6185
iov_in [1 ].iov_base = iobuf -> ptr ;
6178
6186
6179
6187
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 ) ;
6181
6189
6182
6190
res = sys_readv (priv -> fd , iov_in , 2 );
6183
6191
@@ -6910,6 +6918,12 @@ init(xlator_t *this_xl)
6910
6918
GF_OPTION_INIT ("fuse-dev-eperm-ratelimit-ns" ,
6911
6919
priv -> fuse_dev_eperm_ratelimit_ns , uint32 , cleanup_exit );
6912
6920
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
+
6913
6927
/* user has set only background-qlen, not congestion-threshold,
6914
6928
use the fuse kernel driver formula to set congestion. ie, 75% */
6915
6929
if (dict_get (this_xl -> options , "background-qlen" ) &&
@@ -6954,11 +6968,11 @@ init(xlator_t *this_xl)
6954
6968
goto cleanup_exit ;
6955
6969
}
6956
6970
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 " ,
6958
6972
priv -> acl ? "" : "default_permissions," ,
6959
6973
priv -> read_only ? "ro," : "" ,
6960
6974
priv -> fuse_mountopts ? priv -> fuse_mountopts : "" ,
6961
- priv -> fuse_mountopts ? "," : "" );
6975
+ priv -> fuse_mountopts ? "," : "" , priv -> fuse_max_read );
6962
6976
if (!mnt_args )
6963
6977
goto cleanup_exit ;
6964
6978
@@ -7198,6 +7212,22 @@ struct volume_options options[] = {
7198
7212
.max = 64 ,
7199
7213
.description = "Sets fuse reader thread count." ,
7200
7214
},
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
+ },
7201
7231
{
7202
7232
.key = {"kernel-writeback-cache" },
7203
7233
.type = GF_OPTION_TYPE_BOOL ,
0 commit comments