From: Michael Jeanson Date: Mon, 15 Jun 2020 14:51:41 +0000 (-0400) Subject: fix: pipe_buf_operations rework (v5.8) X-Git-Tag: v2.12.2~17 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=9f29d2129980e5b09425d069cd89b253054a9347;p=lttng-modules.git fix: pipe_buf_operations rework (v5.8) See upstream commits: commit c928f642c29a5ffb02e16f2430b42b876dde69de Author: Christoph Hellwig Date: Wed May 20 17:58:16 2020 +0200 fs: rename pipe_buf ->steal to ->try_steal And replace the arcane return value convention with a simple bool where true means success and false means failure. [AV: braino fix folded in] commit b8d9e7f2411b0744df2ec33e80d7698180fef21a Author: Christoph Hellwig Date: Wed May 20 17:58:15 2020 +0200 fs: make the pipe_buf_operations ->confirm operation optional Just return 0 for success if it is not present. commit 76887c256744740d6121af9bc4aa787712a1f694 Author: Christoph Hellwig Date: Wed May 20 17:58:14 2020 +0200 fs: make the pipe_buf_operations ->steal operation optional Just return 1 for failure if it is not present. Change-Id: Ic185632202470db1eb5b012e95e793ff2cb26be7 Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- diff --git a/lib/ringbuffer/ring_buffer_splice.c b/lib/ringbuffer/ring_buffer_splice.c index 52179a79..eca591d8 100644 --- a/lib/ringbuffer/ring_buffer_splice.c +++ b/lib/ringbuffer/ring_buffer_splice.c @@ -42,19 +42,38 @@ static void lib_ring_buffer_pipe_buf_release(struct pipe_inode_info *pipe, __free_page(pbuf->page); } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0)) +static const struct pipe_buf_operations ring_buffer_pipe_buf_ops = { + .release = lib_ring_buffer_pipe_buf_release, + .try_steal = generic_pipe_buf_try_steal, + .get = generic_pipe_buf_get +}; +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,1,0)) +static const struct pipe_buf_operations ring_buffer_pipe_buf_ops = { + .confirm = generic_pipe_buf_confirm, + .release = lib_ring_buffer_pipe_buf_release, + .steal = generic_pipe_buf_steal, + .get = generic_pipe_buf_get +}; +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) +static const struct pipe_buf_operations ring_buffer_pipe_buf_ops = { + .can_merge = 0, + .confirm = generic_pipe_buf_confirm, + .release = lib_ring_buffer_pipe_buf_release, + .steal = generic_pipe_buf_steal, + .get = generic_pipe_buf_get +}; +#else static const struct pipe_buf_operations ring_buffer_pipe_buf_ops = { -#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,1,0)) .can_merge = 0, -#endif -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)) .map = generic_pipe_buf_map, .unmap = generic_pipe_buf_unmap, -#endif .confirm = generic_pipe_buf_confirm, .release = lib_ring_buffer_pipe_buf_release, .steal = generic_pipe_buf_steal, - .get = generic_pipe_buf_get, + .get = generic_pipe_buf_get }; +#endif /* * Page release operation after splice pipe_to_file ends.