From: Matthew Wilcox <willy@infradead.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Linux-MM <linux-mm@kvack.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [GIT PULL] Rename page_offset() to page_pos()
Date: Sat, 11 Apr 2020 14:48:18 -0700 [thread overview]
Message-ID: <20200411214818.GH21484@bombadil.infradead.org> (raw)
In-Reply-To: <CAHk-=wgCAGVwAVTuaoJu4bF99JEG66iN7_vzih=Z33GMmOTC_Q@mail.gmail.com>
On Sat, Apr 11, 2020 at 01:57:56PM -0700, Linus Torvalds wrote:
> So honestly, i the confusion is that we have "pgoff_t", which is the
> offset of the page counted in _pages_, then my reaction is that
>
> (a) I think the truly confusing name is "pgoff_t" (and any
> "page_offset" variable of that type). Calling that "pgindex_t" and
> "page_index" would be a real clarification.
I think you're right. I have a patch series queued for 5.8 which
renames a lot of 'pgoff_t offset' to 'pgoff_t index'. I wouldn't mind
at all renaming pgoff_t to pgindex_t. If you're amenable, pgidx_t would
be shorter.
> (b) if we really do want to rename page_offset() because of confusion
> with the page index "offset", then the logical thing would be to
> clarify that it's a byte offset, not the page index.
I wasn't entirely forthcoming ... I actually want to introduce a new
#define page_offset(page, x) ((unsigned long)(x) & (page_size(page) - 1))
to simplify handling huge pages. So I always want to see offset be a
byte count. offset_in_page() is already taken, and I have no idea what
else to call the function to get the offset of this address within a
particular page.
> If we'd want a _descriptive_ name, then "byte_offset_of_page()" would
> probably be that. That's hard to mis-understand.
>
> Yes that's also more of a mouthful, and it still has the "two
> different names for the same thing" issue wrt
> stable/old/rebased/whatever patches.
That was one of the options we discussed, along with file_offset_of_page().
> Which is why I'd much rather change "pgoff_t" to "pgindex_t" and
> related "page_offset" variables to "page_index" variables.
There's only about 20 of those out of the 938 pgoff_t users. But there's
over a hundred called 'pgoff'. I need to get smarter about using
Coccinelle; I'm sure it can do this.
next prev parent reply other threads:[~2020-04-11 21:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-11 20:32 Matthew Wilcox
2020-04-11 20:57 ` Linus Torvalds
2020-04-11 21:48 ` Matthew Wilcox [this message]
2020-04-11 22:02 ` Linus Torvalds
2020-04-11 22:06 ` Matthew Wilcox
2020-04-11 22:09 ` Linus Torvalds
2020-04-11 23:22 ` Matthew Wilcox
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=20200411214818.GH21484@bombadil.infradead.org \
--to=willy@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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