mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-01-13 19:50:25 +03:00
libzfs_core: lzc_send_wraper: maximise pipe buffer for existing pipes
This reduces scheduler overhead by letting the reader consume bigger chunks (64k => 128k at full throttle) Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Paul Dagnelie <pcd@delphix.com> Reviewed-by: Rich Ercolani <rincebrain@gmail.com> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #13133
This commit is contained in:
parent
7eb179be18
commit
a86e089415
@ -652,8 +652,9 @@ send_worker(void *arg)
|
|||||||
* Returns the error from func(), if nonzero,
|
* Returns the error from func(), if nonzero,
|
||||||
* otherwise the error from the thread.
|
* otherwise the error from the thread.
|
||||||
*
|
*
|
||||||
* No-op if orig_fd is -1, already a pipe, and on not-Linux;
|
* No-op if orig_fd is -1, already a pipe (but the buffer size is bumped),
|
||||||
* as such, it is safe to wrap/call wrapped functions in a wrapped context.
|
* and on not-Linux; as such, it is safe to wrap/call wrapped functions
|
||||||
|
* in a wrapped context.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
lzc_send_wrapper(int (*func)(int, void *), int orig_fd, void *data)
|
lzc_send_wrapper(int (*func)(int, void *), int orig_fd, void *data)
|
||||||
@ -662,8 +663,11 @@ lzc_send_wrapper(int (*func)(int, void *), int orig_fd, void *data)
|
|||||||
struct stat sb;
|
struct stat sb;
|
||||||
if (orig_fd != -1 && fstat(orig_fd, &sb) == -1)
|
if (orig_fd != -1 && fstat(orig_fd, &sb) == -1)
|
||||||
return (errno);
|
return (errno);
|
||||||
if (orig_fd == -1 || S_ISFIFO(sb.st_mode))
|
if (orig_fd == -1 || S_ISFIFO(sb.st_mode)) {
|
||||||
|
if (orig_fd != -1)
|
||||||
|
(void) max_pipe_buffer(orig_fd);
|
||||||
return (func(orig_fd, data));
|
return (func(orig_fd, data));
|
||||||
|
}
|
||||||
if ((fcntl(orig_fd, F_GETFL) & O_ACCMODE) == O_RDONLY)
|
if ((fcntl(orig_fd, F_GETFL) & O_ACCMODE) == O_RDONLY)
|
||||||
return (errno = EBADF);
|
return (errno = EBADF);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user