History

folio: Add a function to get the host inode for a folio

Add a convenience function, folio_inode() that will get the host inode from a folio's mapping. Changes: ver #3: - Fix mistake in function description[2]. ver #2: - Fix contradiction between doc and implementation by disallowing use with swap caches[1].

David Howells committed 5 years ago

Commit 452c4721 parent a19672f2 files · +15 −1Browse files

Showing the changes to include (1 of 2 files). Show all

Unified · Split

include/linux/pagemap.h+14−0
@@ -253,6 +253,20 @@ static inline struct address_space *page_mapping_file(struct page *page) · 252 unmodified lines
253253 return folio_mapping(folio);
254254 }
255255
256+/**
257+ * folio_inode - Get the host inode for this folio.
258+ * @folio: The folio.
259+ *
260+ * For folios which are in the page cache, return the inode that this folio
261+ * belongs to.
262+ *
263+ * Do not call this for folios which aren't in the page cache.
264+ */
265+static inline struct inode *folio_inode(struct folio *folio)
266+{
267+ return folio->mapping->host;
268+}
269+
256270 static inline bool page_cache_add_speculative(struct page *page, int count)
257271 {
258272 VM_BUG_ON_PAGE(PageTail(page), page);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t