mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 12:57:53 +00:00
highmem: Add folio_release_kmap()
This is the folio equivalent of unmap_and_put_page(), which remains as a wrapper for it. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Jan Kara <jack@suse.cz> Message-Id: <20230921200746.3303942-1-willy@infradead.org>
This commit is contained in:
parent
bceef326bc
commit
3de6047f18
1 changed files with 16 additions and 2 deletions
|
@ -551,10 +551,24 @@ static inline void folio_zero_range(struct folio *folio,
|
|||
zero_user_segments(&folio->page, start, start + length, 0, 0);
|
||||
}
|
||||
|
||||
static inline void unmap_and_put_page(struct page *page, void *addr)
|
||||
/**
|
||||
* folio_release_kmap - Unmap a folio and drop a refcount.
|
||||
* @folio: The folio to release.
|
||||
* @addr: The address previously returned by a call to kmap_local_folio().
|
||||
*
|
||||
* It is common, eg in directory handling to kmap a folio. This function
|
||||
* unmaps the folio and drops the refcount that was being held to keep the
|
||||
* folio alive while we accessed it.
|
||||
*/
|
||||
static inline void folio_release_kmap(struct folio *folio, void *addr)
|
||||
{
|
||||
kunmap_local(addr);
|
||||
put_page(page);
|
||||
folio_put(folio);
|
||||
}
|
||||
|
||||
static inline void unmap_and_put_page(struct page *page, void *addr)
|
||||
{
|
||||
folio_release_kmap(page_folio(page), addr);
|
||||
}
|
||||
|
||||
#endif /* _LINUX_HIGHMEM_H */
|
||||
|
|
Loading…
Reference in a new issue