[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191004193912.GP32665@bombadil.infradead.org>
Date: Fri, 4 Oct 2019 12:39:12 -0700
From: Matthew Wilcox <willy@...radead.org>
To: "Kirill A. Shutemov" <kirill@...temov.name>
Cc: linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [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@...radead.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.
Powered by blists - more mailing lists