lkml.org 
[lkml]   [2014]   [Jul]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH -mm] mm: refactor page index/offset getters
On Wed, Jul 23, 2014 at 02:39:18PM -0700, Andrew Morton wrote:
> On Tue, 15 Jul 2014 12:41:12 -0400 Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> wrote:
>
> > There is a complaint about duplication around the fundamental routines
> > of page index/offset getters.
> >
> > page_(index|offset) and page_file_(index|offset) provide the same
> > functionality, so we can merge them as page_(index|offset), respectively.
> >
> > And this patch gives the clear meaning to the getters:
> > - page_index(): get page cache index (offset in relevant page size)
> > - page_pgoff(): get 4kB page offset
> > - page_offset(): get byte offset
> > All these functions are aware of regular pages, swapcaches, and hugepages.
> >
> > The definition of PageHuge is relocated to include/linux/mm.h, because
> > some users of page_pgoff() doesn't include include/linux/hugetlb.h.
> >
> > __page_file_index() is not well named, because it's only for swap cache.
> > So let's rename it with __page_swap_index().
>
> Thanks, I guess that's better. Could others please have a look-n-think?
>
> I did this:
>
> --- a/include/linux/pagemap.h~mm-refactor-page-index-offset-getters-fix
> +++ a/include/linux/pagemap.h
> @@ -412,7 +412,7 @@ static inline pgoff_t page_pgoff(struct
> }
>
> /*
> - * Return the byte offset of the given page.
> + * Return the file offset of the given pagecache page, in bytes.

Thanks, it's clearer.

> static inline loff_t page_offset(struct page *page)
> {
>
>
>
> You had a random xfs_aops.c whitespace fix which I'll pretend I didn't
> notice ;)

I just couldn't resist fixing it ;)


\
 
 \ /
  Last update: 2014-07-24 00:22    [W:0.070 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site