@@ -5154,6 +5154,14 @@ 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_write  =  priv -> fuse_max_write ;
5160+         fino .max_pages  =  priv -> fuse_max_write  / sysconf (_SC_PAGESIZE );
5161+         if  (fino .max_pages  ==  FUSE_MAX_MAX_PAGES )
5162+             fino .flags  |= FUSE_MAX_PAGES ;
5163+     }
5164+ #endif 
51575165#if  FUSE_KERNEL_MINOR_VERSION  >= 17 
51585166    if  (fini -> minor  >= 17 )
51595167        fino .flags  |= FUSE_FLOCK_LOCKS ;
@@ -6090,14 +6098,12 @@ fuse_thread_proc(void *data)
60906098    struct  pollfd  pfd [2 ] =  {{
60916099        0 ,
60926100    }};
6093-     uint32_t  psize ;
60946101
60956102    this  =  data ;
60966103    priv  =  this -> private ;
60976104
60986105    THIS  =  this ;
60996106
6100-     psize  =  ((struct  iobuf_pool  * )this -> ctx -> iobuf_pool )-> default_page_size ;
61016107    priv -> msg0_len_p  =  & msg0_size ;
61026108
61036109    for  (;;) {
@@ -6153,7 +6159,7 @@ fuse_thread_proc(void *data)
61536159           size from 'fuse', which is as of today 128KB. If we bring in 
61546160           support for higher block sizes support, then we should be 
61556161           changing this one too */ 
6156-         iobuf  =  iobuf_get (this -> ctx -> iobuf_pool );
6162+         iobuf  =  iobuf_get2 (this -> ctx -> iobuf_pool ,  priv -> fuse_max_write );
61576163
61586164        /* Add extra 512 byte to the first iov so that it can 
61596165         * accommodate "ordinary" non-write requests. It's not 
@@ -6177,7 +6183,7 @@ fuse_thread_proc(void *data)
61776183        iov_in [1 ].iov_base  =  iobuf -> ptr ;
61786184
61796185        iov_in [0 ].iov_len  =  msg0_size ;
6180-         iov_in [1 ].iov_len  =  psize ;
6186+         iov_in [1 ].iov_len  =  priv -> fuse_max_write ;
61816187
61826188        res  =  sys_readv (priv -> fd , iov_in , 2 );
61836189
@@ -6910,6 +6916,9 @@ init(xlator_t *this_xl)
69106916    GF_OPTION_INIT ("fuse-dev-eperm-ratelimit-ns" ,
69116917                   priv -> fuse_dev_eperm_ratelimit_ns , uint32 , cleanup_exit );
69126918
6919+     GF_OPTION_INIT ("fuse-max-write" , priv -> fuse_max_write , uint32 ,
6920+                    cleanup_exit );
6921+ 
69136922    /* user has set only background-qlen, not congestion-threshold, 
69146923       use the fuse kernel driver formula to set congestion. ie, 75% */ 
69156924    if  (dict_get (this_xl -> options , "background-qlen" ) && 
@@ -7198,6 +7207,14 @@ struct volume_options options[] = {
71987207        .max  =  64 ,
71997208        .description  =  "Sets fuse reader thread count." ,
72007209    },
7210+     {
7211+         .key  =  {"fuse-max-write" },
7212+         .type  =  GF_OPTION_TYPE_INT ,
7213+         .default_value  =  "131072" ,
7214+         .min  =  4096 ,
7215+         .max  =  1048576 ,
7216+         .description  =  "Sets fuse max-write bytes." ,
7217+     },
72017218    {
72027219        .key  =  {"kernel-writeback-cache" },
72037220        .type  =  GF_OPTION_TYPE_BOOL ,
0 commit comments