* splice blocks indefinitely when len > 64k? @ 2006-10-30 16:39 Daniel Drake 2006-10-30 19:11 ` Phillip Susi 2006-10-30 19:54 ` Jens Axboe 0 siblings, 2 replies; 7+ messages in thread From: Daniel Drake @ 2006-10-30 16:39 UTC (permalink / raw) To: axboe; +Cc: linux-kernel Hi, I'm experimenting with splice and have run into some unusual behaviour. I am using the utilities in git://brick.kernel.dk/data/git/splice.git In splice.h, when changing SPLICE_SIZE from: #define SPLICE_SIZE (64*1024) to #define SPLICE_SIZE ((64*1024)+1) splice-cp hangs indefinitely when copying files sized 65537 bytes or more. It hangs on the first splice() call. Is this a bug? I'd like to be able to copy much more than 64kb on a single splice call. Thanks! Daniel ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: splice blocks indefinitely when len > 64k? 2006-10-30 16:39 splice blocks indefinitely when len > 64k? Daniel Drake @ 2006-10-30 19:11 ` Phillip Susi 2006-10-30 19:32 ` Daniel Drake 2006-10-30 19:55 ` Jens Axboe 2006-10-30 19:54 ` Jens Axboe 1 sibling, 2 replies; 7+ messages in thread From: Phillip Susi @ 2006-10-30 19:11 UTC (permalink / raw) To: Daniel Drake; +Cc: axboe, linux-kernel While it should not simply hang, the splice size needs to be an even multiple of the page size. Daniel Drake wrote: > Hi, > > I'm experimenting with splice and have run into some unusual behaviour. > > I am using the utilities in git://brick.kernel.dk/data/git/splice.git > > In splice.h, when changing SPLICE_SIZE from: > > #define SPLICE_SIZE (64*1024) > > to > > #define SPLICE_SIZE ((64*1024)+1) > > splice-cp hangs indefinitely when copying files sized 65537 bytes or > more. It hangs on the first splice() call. > > Is this a bug? I'd like to be able to copy much more than 64kb on a > single splice call. > > Thanks! > Daniel ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: splice blocks indefinitely when len > 64k? 2006-10-30 19:11 ` Phillip Susi @ 2006-10-30 19:32 ` Daniel Drake 2006-10-30 19:55 ` Jens Axboe 1 sibling, 0 replies; 7+ messages in thread From: Daniel Drake @ 2006-10-30 19:32 UTC (permalink / raw) To: Phillip Susi; +Cc: jens.axboe, linux-kernel On Mon, 2006-10-30 at 14:11 -0500, Phillip Susi wrote: > While it should not simply hang, the splice size needs to be an even > multiple of the page size. I don't think that is true, at least on this level. Firstly, splice-cp does this: #define BS SPLICE_SIZE int this_len = min((off_t) BS, sb.st_size); int ret = splice(in_fd, NULL, pfds[1], NULL, this_len, 0); No considerations are made regarding page size. Secondly, the problem still exists when I increase SPLICE_SIZE to (128*1024) Daniel > Daniel Drake wrote: > > Hi, > > > > I'm experimenting with splice and have run into some unusual behaviour. > > > > I am using the utilities in git://brick.kernel.dk/data/git/splice.git > > > > In splice.h, when changing SPLICE_SIZE from: > > > > #define SPLICE_SIZE (64*1024) > > > > to > > > > #define SPLICE_SIZE ((64*1024)+1) > > > > splice-cp hangs indefinitely when copying files sized 65537 bytes or > > more. It hangs on the first splice() call. > > > > Is this a bug? I'd like to be able to copy much more than 64kb on a > > single splice call. > > > > Thanks! > > Daniel > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: splice blocks indefinitely when len > 64k? 2006-10-30 19:11 ` Phillip Susi 2006-10-30 19:32 ` Daniel Drake @ 2006-10-30 19:55 ` Jens Axboe 1 sibling, 0 replies; 7+ messages in thread From: Jens Axboe @ 2006-10-30 19:55 UTC (permalink / raw) To: Phillip Susi; +Cc: Daniel Drake, axboe, linux-kernel Don't top post, please. On Mon, Oct 30 2006, Phillip Susi wrote: > While it should not simply hang, the splice size needs to be an even > multiple of the page size. No, that is incorrect. -- Jens Axboe ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: splice blocks indefinitely when len > 64k? 2006-10-30 16:39 splice blocks indefinitely when len > 64k? Daniel Drake 2006-10-30 19:11 ` Phillip Susi @ 2006-10-30 19:54 ` Jens Axboe 2006-10-30 21:08 ` Stephen Hemminger 1 sibling, 1 reply; 7+ messages in thread From: Jens Axboe @ 2006-10-30 19:54 UTC (permalink / raw) To: Daniel Drake; +Cc: linux-kernel On Mon, Oct 30 2006, Daniel Drake wrote: > Hi, > > I'm experimenting with splice and have run into some unusual behaviour. > > I am using the utilities in git://brick.kernel.dk/data/git/splice.git > > In splice.h, when changing SPLICE_SIZE from: > > #define SPLICE_SIZE (64*1024) > > to > > #define SPLICE_SIZE ((64*1024)+1) > > splice-cp hangs indefinitely when copying files sized 65537 bytes or > more. It hangs on the first splice() call. > > Is this a bug? I'd like to be able to copy much more than 64kb on a > single splice call. You can't, internally splice is using a pipe which is currently confined to 16 pages. The SPLICE_SIZE define isn't a suggestion in the code, it reflects that. You could fix splice-cp to not stall on changing that, however that still doesn't change the fact that you can only move chunks of 64kb (on your arch) right now. -- Jens Axboe ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: splice blocks indefinitely when len > 64k? 2006-10-30 19:54 ` Jens Axboe @ 2006-10-30 21:08 ` Stephen Hemminger 2006-10-31 7:27 ` Jens Axboe 0 siblings, 1 reply; 7+ messages in thread From: Stephen Hemminger @ 2006-10-30 21:08 UTC (permalink / raw) To: linux-kernel On Mon, 30 Oct 2006 20:54:27 +0100 Jens Axboe <jens.axboe@oracle.com> wrote: > On Mon, Oct 30 2006, Daniel Drake wrote: > > Hi, > > > > I'm experimenting with splice and have run into some unusual behaviour. > > > > I am using the utilities in git://brick.kernel.dk/data/git/splice.git > > > > In splice.h, when changing SPLICE_SIZE from: > > > > #define SPLICE_SIZE (64*1024) > > > > to > > > > #define SPLICE_SIZE ((64*1024)+1) > > > > splice-cp hangs indefinitely when copying files sized 65537 bytes or > > more. It hangs on the first splice() call. > > > > Is this a bug? I'd like to be able to copy much more than 64kb on a > > single splice call. > > You can't, internally splice is using a pipe which is currently confined > to 16 pages. The SPLICE_SIZE define isn't a suggestion in the code, it > reflects that. You could fix splice-cp to not stall on changing that, > however that still doesn't change the fact that you can only move chunks > of 64kb (on your arch) right now. > It could accept larger values but only move SPLICE_SIZE, assuming caller checked for partial completions. -- Stephen Hemminger <shemminger@osdl.org> ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: splice blocks indefinitely when len > 64k? 2006-10-30 21:08 ` Stephen Hemminger @ 2006-10-31 7:27 ` Jens Axboe 0 siblings, 0 replies; 7+ messages in thread From: Jens Axboe @ 2006-10-31 7:27 UTC (permalink / raw) To: Stephen Hemminger; +Cc: linux-kernel On Mon, Oct 30 2006, Stephen Hemminger wrote: > On Mon, 30 Oct 2006 20:54:27 +0100 > Jens Axboe <jens.axboe@oracle.com> wrote: > > > On Mon, Oct 30 2006, Daniel Drake wrote: > > > Hi, > > > > > > I'm experimenting with splice and have run into some unusual behaviour. > > > > > > I am using the utilities in git://brick.kernel.dk/data/git/splice.git > > > > > > In splice.h, when changing SPLICE_SIZE from: > > > > > > #define SPLICE_SIZE (64*1024) > > > > > > to > > > > > > #define SPLICE_SIZE ((64*1024)+1) > > > > > > splice-cp hangs indefinitely when copying files sized 65537 bytes or > > > more. It hangs on the first splice() call. > > > > > > Is this a bug? I'd like to be able to copy much more than 64kb on a > > > single splice call. > > > > You can't, internally splice is using a pipe which is currently confined > > to 16 pages. The SPLICE_SIZE define isn't a suggestion in the code, it > > reflects that. You could fix splice-cp to not stall on changing that, > > however that still doesn't change the fact that you can only move chunks > > of 64kb (on your arch) right now. > > > > It could accept larger values but only move SPLICE_SIZE, assuming > caller checked for partial completions. (one more time, for the list) The caller has to check for partial completions, it would be like calling read(2) or write(2) and not checking the return value if you didn't. SPLICE_SIZE is the _maximum_ amount of data that current fits in a pipe, there's no way to ensure that you will actually be able to write that amount - the pipe may not be empty when you begin writing, or someone else could be filling it as well. The initial mail said that splice-cp doesn't work when you change the SPLICE_SIZE define, and I'm not at all surprised that this is the case. That would be like saying program foo doesn't work when you randomly change some define or variable in the source. -- Jens Axboe ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-10-31 7:25 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2006-10-30 16:39 splice blocks indefinitely when len > 64k? Daniel Drake 2006-10-30 19:11 ` Phillip Susi 2006-10-30 19:32 ` Daniel Drake 2006-10-30 19:55 ` Jens Axboe 2006-10-30 19:54 ` Jens Axboe 2006-10-30 21:08 ` Stephen Hemminger 2006-10-31 7:27 ` Jens Axboe
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox