From: Matthew Wilcox <willy@infradead.org>
To: linux-fsdevel@vger.kernel.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [RFC] Renaming page_offset() to page_pos()
Date: Fri, 3 Apr 2020 08:33:23 -0700 [thread overview]
Message-ID: <20200403153323.GQ21484@bombadil.infradead.org> (raw)
Without looking at the source, can you tell me what page_offset() does?
At least one regular contributor thought it meant the pgoff_t of this
page within the file. It's actually the byte offset of this page into
the file.
We have a perfectly good name for byte offset into the file --
file->f_pos. So I propose renaming it to page_pos(). To minimise
disruption to other development, I'm going to send Linus a pull request
at the end of the merge window with the results of this coccinelle script:
@@ expression a; @@
- page_offset(a)
+ page_pos(a)
I've reviewed the output and the only slight weirdness is an extra space
in casts:
btrfs_warn(BTRFS_I(page->mapping->host)->root->fs_info,
"page private not zero on page %llu",
- (unsigned long long)page_offset(page));
+ (unsigned long long) page_pos(page));
Sometimes Coccinelle fixes the surrounding whitespace to be better
than it currently is:
- ow->bv[i].bv_len = min(page_offset(ow->pages[i]) + PAGE_SIZE,
- ow->off + ow->len) -
- max(ow->off, page_offset(ow->pages[i]));
+ ow->bv[i].bv_len = min(page_pos(ow->pages[i]) + PAGE_SIZE,
+ ow->off + ow->len) -
+ max(ow->off, page_pos(ow->pages[i]));
(it's still bad, but it's an improvement)
Any objections? Anyone got a better name than page_pos()?
next reply other threads:[~2020-04-03 15:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-03 15:33 Matthew Wilcox [this message]
2020-04-07 19:09 ` [RFC] Renaming page_offset() to page_pos() William Kucharski
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=20200403153323.GQ21484@bombadil.infradead.org \
--to=willy@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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;
as well as URLs for NNTP newsgroup(s).