lkml.org 
[lkml]   [2019]   [Oct]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 03/15] mm: Add file_offset_of_ helpers
On Thu, Sep 26, 2019 at 05:02:11PM +0300, Kirill A. Shutemov wrote:
> On Tue, Sep 24, 2019 at 05:52:02PM -0700, Matthew Wilcox wrote:
> > From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> >
> > The page_offset function is badly named for people reading the functions
> > which call it. The natural meaning of a function with this name would
> > be 'offset within a page', not 'page offset in bytes within a file'.
> > Dave Chinner suggests file_offset_of_page() as a replacement function
> > name and I'm also adding file_offset_of_next_page() as a helper for the
> > large page work. Also add kernel-doc for these functions so they show
> > up in the kernel API book.
> >
> > page_offset() is retained as a compatibility define for now.
>
> This should be trivial for coccinelle, right?

Yes, should be. I'd prefer not to do conversions for now to minimise
conflicts when rebasing.

> > +static inline loff_t file_offset_of_next_page(struct page *page)
> > +{
> > + return ((loff_t)page->index + compound_nr(page)) << PAGE_SHIFT;
>
> Wouldn't it be more readable as
>
> return file_offset_of_page(page) + page_size(page);
>
> ?

Good idea. I'll fix that up.

\
 
 \ /
  Last update: 2019-10-04 21:39    [W:0.051 / U:0.580 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site