All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH next] fs/splice: iter_to_pipe -- Use PIPE_DEF_BUFFERS instead of hardcoded number
@ 2019-01-30 15:39 Cyrill Gorcunov
  2019-01-30 15:42 ` Al Viro
  0 siblings, 1 reply; 4+ messages in thread
From: Cyrill Gorcunov @ 2019-01-30 15:39 UTC (permalink / raw)
  To: LKML; +Cc: Al Viro

And use ARRAY_SIZE for easier code modification if we ever need in future.

CC: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 fs/splice.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-next.git/fs/splice.c
===================================================================
--- linux-next.git.orig/fs/splice.c
+++ linux-next.git/fs/splice.c
@@ -1203,12 +1203,12 @@ static int iter_to_pipe(struct iov_iter
 	bool failed = false;
 
 	while (iov_iter_count(from) && !failed) {
-		struct page *pages[16];
+		struct page *pages[PIPE_DEF_BUFFERS];
 		ssize_t copied;
 		size_t start;
 		int n;
 
-		copied = iov_iter_get_pages(from, pages, ~0UL, 16, &start);
+		copied = iov_iter_get_pages(from, pages, ~0UL, ARRAY_SIZE(pages), &start);
 		if (copied <= 0) {
 			ret = copied;
 			break;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH next] fs/splice: iter_to_pipe -- Use PIPE_DEF_BUFFERS instead of hardcoded number
  2019-01-30 15:39 [PATCH next] fs/splice: iter_to_pipe -- Use PIPE_DEF_BUFFERS instead of hardcoded number Cyrill Gorcunov
@ 2019-01-30 15:42 ` Al Viro
  2019-01-30 15:48   ` Cyrill Gorcunov
  0 siblings, 1 reply; 4+ messages in thread
From: Al Viro @ 2019-01-30 15:42 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: LKML

On Wed, Jan 30, 2019 at 06:39:11PM +0300, Cyrill Gorcunov wrote:
> And use ARRAY_SIZE for easier code modification if we ever need in future.

Umm...  Why PIPE_DEF_BUFFERS, though?  Because it's a constant from more or
less the same area that happens to be equal to the value we use here?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH next] fs/splice: iter_to_pipe -- Use PIPE_DEF_BUFFERS instead of hardcoded number
  2019-01-30 15:42 ` Al Viro
@ 2019-01-30 15:48   ` Cyrill Gorcunov
  2019-01-30 16:26     ` Cyrill Gorcunov
  0 siblings, 1 reply; 4+ messages in thread
From: Cyrill Gorcunov @ 2019-01-30 15:48 UTC (permalink / raw)
  To: Al Viro; +Cc: LKML

On Wed, Jan 30, 2019 at 03:42:45PM +0000, Al Viro wrote:
> On Wed, Jan 30, 2019 at 06:39:11PM +0300, Cyrill Gorcunov wrote:
> > And use ARRAY_SIZE for easier code modification if we ever need in future.
> 
> Umm...  Why PIPE_DEF_BUFFERS, though?  Because it's a constant from more or
> less the same area that happens to be equal to the value we use here?

Yes. Since plain 16 value completely unclear where it comes from. I looked
into your commit which made this change and seems previously we've had this
constant related (79fddc4efd5d4de5cf210fe5ecf4d2734140849a). Am I wrong?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH next] fs/splice: iter_to_pipe -- Use PIPE_DEF_BUFFERS instead of hardcoded number
  2019-01-30 15:48   ` Cyrill Gorcunov
@ 2019-01-30 16:26     ` Cyrill Gorcunov
  0 siblings, 0 replies; 4+ messages in thread
From: Cyrill Gorcunov @ 2019-01-30 16:26 UTC (permalink / raw)
  To: Al Viro; +Cc: LKML

On Wed, Jan 30, 2019 at 06:48:51PM +0300, Cyrill Gorcunov wrote:
> On Wed, Jan 30, 2019 at 03:42:45PM +0000, Al Viro wrote:
> > On Wed, Jan 30, 2019 at 06:39:11PM +0300, Cyrill Gorcunov wrote:
> > > And use ARRAY_SIZE for easier code modification if we ever need in future.
> > 
> > Umm...  Why PIPE_DEF_BUFFERS, though?  Because it's a constant from more or
> > less the same area that happens to be equal to the value we use here?
> 
> Yes. Since plain 16 value completely unclear where it comes from. I looked
> into your commit which made this change and seems previously we've had this
> constant related (79fddc4efd5d4de5cf210fe5ecf4d2734140849a). Am I wrong?

Thinking more I'm more convinced that i'm wrong. Also it is related to
this default size, the code can pretty well use (alsmost) any other
constant here. Al, drop it please.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-01-30 16:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-30 15:39 [PATCH next] fs/splice: iter_to_pipe -- Use PIPE_DEF_BUFFERS instead of hardcoded number Cyrill Gorcunov
2019-01-30 15:42 ` Al Viro
2019-01-30 15:48   ` Cyrill Gorcunov
2019-01-30 16:26     ` Cyrill Gorcunov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.