File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -24,16 +24,16 @@ pub(super) fn write_fast_using_splice<R: FdReadable, S: AsRawFd + AsFd>(
2424 write_fd : & S ,
2525) -> CatResult < bool > {
2626 use nix:: fcntl:: { FcntlArg , fcntl} ;
27- // improve performance
28- if fcntl (
29- write_fd ,
30- FcntlArg :: F_SETPIPE_SZ ( MAX_ROOTLESS_PIPE_SIZE as i32 ) ,
31- )
32- . is_ok ( )
33- {
27+ const FIRST_PIPE_SIZE : usize = 64 * 1024 ;
28+ if splice ( & handle . reader , & write_fd , FIRST_PIPE_SIZE ) . is_ok ( ) {
29+ // fcntl improves performance for large file which is large overhead for small files
30+ let _ = fcntl (
31+ write_fd ,
32+ FcntlArg :: F_SETPIPE_SZ ( MAX_ROOTLESS_PIPE_SIZE as i32 ) ,
33+ ) ;
3434 loop {
3535 match splice ( & handle. reader , & write_fd, MAX_ROOTLESS_PIPE_SIZE ) {
36- Ok ( 1 ..) => { } ,
36+ Ok ( 1 ..) => { }
3737 Ok ( 0 ) => return Ok ( false ) ,
3838 Err ( _) => return Ok ( true ) ,
3939 }
You can’t perform that action at this time.
0 commit comments