From: Al Viro <viro@ZenIV.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [git pull] vfs fix
Date: Sun, 27 Nov 2016 02:25:09 +0000 [thread overview]
Message-ID: <20161127022506.GW1555@ZenIV.linux.org.uk> (raw)
In-Reply-To: <CA+55aFxnB+VMEcAfPA5H17LxOZCHBACD7kUQkY7tCAmVLkq5DQ@mail.gmail.com>
On Sat, Nov 26, 2016 at 05:48:54PM -0800, Linus Torvalds wrote:
> That's what all the other users do, and that's what should be the
> "right usage pattern", afaik. The number of pages really *is*
> calculated as
>
> int n = DIV_ROUND_UP(result + offs, PAGE_SIZE);
>
> in other iov_iter_get_pages_alloc() callers, although tghe nfs code
> open-codes it as
>
> npages = (result + pgbase + PAGE_SIZE - 1) / PAGE_SIZE;
>
> so it's not a very strong pattern.
Two issues here. One is that iov_iter_get_pages{,_alloc}() calling
conventions are fucking ugly. I'm guilty of that atrocity; my only
excuse is that this thing has congealed from many open-coded instances,
quite a few of those appearing only after considerable massage of the
code. I _hate_ the boilerplate we have in the functions implementing
those for various iov_iter flavours and boilerplate in the callers.
I am going to try and come up with something less atrocious. As it
is, renaming that variable and adding it to the return value of
iov_iter_get_pages_alloc() is certainly not a problem and would be
prettier, but TBH I just went "yet another place to go into that cleanup".
Shouldn't have.
Another thing is that it was a leftover from "Alexei, could you see if
that thing fixes your reproducer?" - just in case the things _really_ went
insane and it was not a wrong rounding but somehow completely buggered
pipe_get_pages_alloc(). They hadn't.
Anyway, leaving that BUG_ON() had been wrong; I can send a followup
massaging that thing as you've suggested, if you are interested in
that. But keep in mind that the whole iov_iter_get_pages...() calling
conventions are going to be changed, hopefully soon.
next prev parent reply other threads:[~2016-11-27 2:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-27 1:13 [git pull] vfs fix Al Viro
2016-11-27 1:48 ` Linus Torvalds
2016-11-27 2:25 ` Al Viro [this message]
2016-11-27 2:51 ` Al Viro
2016-11-27 3:04 ` Al Viro
2016-11-28 8:54 ` Yan, Zheng
2016-11-27 2:53 ` Linus Torvalds
-- strict thread matches above, loose matches on Subject: below --
2016-03-31 4:27 Al Viro
2015-05-31 21:37 Al Viro
2011-11-22 17:44 Al Viro
2011-11-22 17:48 ` Linus Torvalds
2011-11-22 21:09 ` Al Viro
2011-11-22 21:24 ` Linus Torvalds
2011-08-07 8:54 Al Viro
2011-02-24 7:20 Al Viro
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=20161127022506.GW1555@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/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