mm/gup: Change the calling convention for compound_next()

Return the head page instead of storing it to a passed parameter.
Reorder the arguments to match the calling function's arguments.
Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarJohn Hubbard <jhubbard@nvidia.com>
Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Reviewed-by: default avatarWilliam Kucharski <william.kucharski@oracle.com>
parent 0b046e12
...@@ -268,9 +268,8 @@ static inline struct page *compound_range_next(struct page *start, ...@@ -268,9 +268,8 @@ static inline struct page *compound_range_next(struct page *start,
return page; return page;
} }
static inline void compound_next(unsigned long i, unsigned long npages, static inline struct page *compound_next(struct page **list,
struct page **list, struct page **head, unsigned long npages, unsigned long i, unsigned int *ntails)
unsigned int *ntails)
{ {
struct page *page; struct page *page;
unsigned int nr; unsigned int nr;
...@@ -281,8 +280,8 @@ static inline void compound_next(unsigned long i, unsigned long npages, ...@@ -281,8 +280,8 @@ static inline void compound_next(unsigned long i, unsigned long npages,
break; break;
} }
*head = page;
*ntails = nr - i; *ntails = nr - i;
return page;
} }
/** /**
...@@ -320,7 +319,7 @@ void unpin_user_pages_dirty_lock(struct page **pages, unsigned long npages, ...@@ -320,7 +319,7 @@ void unpin_user_pages_dirty_lock(struct page **pages, unsigned long npages,
} }
for (index = 0; index < npages; index += ntails) { for (index = 0; index < npages; index += ntails) {
compound_next(index, npages, pages, &head, &ntails); head = compound_next(pages, npages, index, &ntails);
/* /*
* Checking PageDirty at this point may race with * Checking PageDirty at this point may race with
* clear_page_dirty_for_io(), but that's OK. Two key * clear_page_dirty_for_io(), but that's OK. Two key
...@@ -409,7 +408,7 @@ void unpin_user_pages(struct page **pages, unsigned long npages) ...@@ -409,7 +408,7 @@ void unpin_user_pages(struct page **pages, unsigned long npages)
return; return;
for (index = 0; index < npages; index += ntails) { for (index = 0; index < npages; index += ntails) {
compound_next(index, npages, pages, &head, &ntails); head = compound_next(pages, npages, index, &ntails);
put_compound_head(head, ntails, FOLL_PIN); put_compound_head(head, ntails, FOLL_PIN);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment