From: Jens Axboe <axboe@kernel.dk>
To: leroy christophe <christophe.leroy@c-s.fr>,
Linus Torvalds <torvalds@linux-foundation.org>,
Herbert Xu <herbert@gondor.apana.org.au>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Linux Crypto Mailing List <linux-crypto@vger.kernel.org>
Subject: Re: [PATCH v2] splice: sendfile() at once fails for big files
Date: Wed, 06 May 2015 09:07:11 -0600 [thread overview]
Message-ID: <554A2E1F.7010102@kernel.dk> (raw)
In-Reply-To: <554A27F6.10800@kernel.dk>
On 05/06/2015 08:40 AM, Jens Axboe wrote:
> On 05/06/2015 08:38 AM, leroy christophe wrote:
>>
>> Le 06/05/2015 16:23, Jens Axboe a écrit :
>>> On 05/05/2015 09:41 PM, Linus Torvalds wrote:
>>>> Jens, ping?
>>>>
>>>> The test results should make this a no-brainer, but I hate how random
>>>> these flag ops.
>>>
>>> Missed the original, apparently. I too am confused how this is a
>>> correctness fix and not just an optimization.
>>>
>>> + if (read_len < len)
>>> + sd->flags |= SPLICE_F_MORE;
>>> + else if (!more)
>>> + sd->flags &= ~SPLICE_F_MORE;
>>>
>>> Should that check be for 'more', not '!more'?
>>>
>>>
>> @@ -1204,6 +1204,7 @@ ssize_t splice_direct_to_actor(struct file *in,
>> struct splice_desc *sd,
>> * Don't block on output, we have to drain the direct pipe.
>> */
>> sd->flags &= ~SPLICE_F_NONBLOCK;
>> + more = sd->flags & SPLICE_F_MORE;
>>
>> while (len) {
>> size_t read_len;
>> @@ -1216,6 +1217,10 @@ ssize_t splice_direct_to_actor(struct file *in,
>> struct splice_desc *sd,
>> read_len = ret;
>> sd->total_len = read_len;
>>
>> + if (read_len < len)
>> + sd->flags |= SPLICE_F_MORE;
>> + else if (!more)
>> + sd->flags &= ~SPLICE_F_MORE;
>>
>>
>>
>> 'more' contains whether sendfile() has been called with SPLICE_F_MORE or
>> not.
>> Until all bytes are processed, we have to force SPLICE_F_MORE regardless
>> of how sendfile() was called.
>> Once all bytes have been read, we have to reset the flags according to
>> how sendfile() was called, so if 'more' is NOT set, we have to clear
>> SPLICE_F_MORE from sd->flags (which was unconditionaly set for
>> processing the first bytes)
>
> Ah gotcha, that looks correct. Patch is fine with me then.
Needs a comment added to that effect, imho.
--
Jens Axboe
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2015-05-06 15:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-23 15:03 [PATCH v2] splice: sendfile() at once fails for big files Christophe Leroy
2015-04-27 7:01 ` Herbert Xu
2015-05-06 3:41 ` Linus Torvalds
2015-05-06 4:34 ` Christoph Hellwig
2015-05-06 14:23 ` Jens Axboe
2015-05-06 14:38 ` leroy christophe
2015-05-06 14:40 ` Jens Axboe
2015-05-06 15:07 ` Jens Axboe [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=554A2E1F.7010102@kernel.dk \
--to=axboe@kernel.dk \
--cc=christophe.leroy@c-s.fr \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).