mm/folio-compat.c
Source file repositories/reference/linux-study-clean/mm/folio-compat.c
File Facts
- System
- Linux kernel
- Corpus path
mm/folio-compat.c- Extension
.c- Size
- 2082 bytes
- Lines
- 88
- Domain
- Core OS
- Bucket
- Memory Management
- Inferred role
- Core OS: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/migrate.hlinux/pagemap.hlinux/rmap.hlinux/swap.hinternal.h
Detected Declarations
function unlock_pagefunction end_page_writebackfunction wait_on_page_writebackfunction mark_page_accessedfunction set_page_writebackfunction set_page_dirtyfunction set_page_dirty_lockfunction clear_page_dirty_for_iofunction redirty_page_for_writepagefunction add_to_page_cache_lruexport unlock_pageexport end_page_writebackexport wait_on_page_writebackexport mark_page_accessedexport set_page_writebackexport set_page_dirtyexport set_page_dirty_lockexport clear_page_dirty_for_ioexport redirty_page_for_writepageexport add_to_page_cache_lruexport pagecache_get_page
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Compatibility functions which bloat the callers too much to make inline.
* All of the callers of these functions should be converted to use folios
* eventually.
*/
#include <linux/migrate.h>
#include <linux/pagemap.h>
#include <linux/rmap.h>
#include <linux/swap.h>
#include "internal.h"
void unlock_page(struct page *page)
{
return folio_unlock(page_folio(page));
}
EXPORT_SYMBOL(unlock_page);
void end_page_writeback(struct page *page)
{
return folio_end_writeback(page_folio(page));
}
EXPORT_SYMBOL(end_page_writeback);
void wait_on_page_writeback(struct page *page)
{
return folio_wait_writeback(page_folio(page));
}
EXPORT_SYMBOL_GPL(wait_on_page_writeback);
void mark_page_accessed(struct page *page)
{
folio_mark_accessed(page_folio(page));
}
EXPORT_SYMBOL(mark_page_accessed);
void set_page_writeback(struct page *page)
{
folio_start_writeback(page_folio(page));
}
EXPORT_SYMBOL(set_page_writeback);
bool set_page_dirty(struct page *page)
{
return folio_mark_dirty(page_folio(page));
}
EXPORT_SYMBOL(set_page_dirty);
int set_page_dirty_lock(struct page *page)
{
return folio_mark_dirty_lock(page_folio(page));
}
EXPORT_SYMBOL(set_page_dirty_lock);
bool clear_page_dirty_for_io(struct page *page)
{
return folio_clear_dirty_for_io(page_folio(page));
}
EXPORT_SYMBOL(clear_page_dirty_for_io);
bool redirty_page_for_writepage(struct writeback_control *wbc,
struct page *page)
{
return folio_redirty_for_writepage(wbc, page_folio(page));
}
EXPORT_SYMBOL(redirty_page_for_writepage);
int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
pgoff_t index, gfp_t gfp)
{
return filemap_add_folio(mapping, page_folio(page), index, gfp);
}
EXPORT_SYMBOL(add_to_page_cache_lru);
noinline
struct page *pagecache_get_page(struct address_space *mapping, pgoff_t index,
fgf_t fgp_flags, gfp_t gfp)
{
struct folio *folio;
folio = __filemap_get_folio(mapping, index, fgp_flags, gfp);
if (IS_ERR(folio))
return NULL;
return folio_file_page(folio, index);
}
EXPORT_SYMBOL(pagecache_get_page);
Annotation
- Immediate include surface: `linux/migrate.h`, `linux/pagemap.h`, `linux/rmap.h`, `linux/swap.h`, `internal.h`.
- Detected declarations: `function unlock_page`, `function end_page_writeback`, `function wait_on_page_writeback`, `function mark_page_accessed`, `function set_page_writeback`, `function set_page_dirty`, `function set_page_dirty_lock`, `function clear_page_dirty_for_io`, `function redirty_page_for_writepage`, `function add_to_page_cache_lru`.
- Atlas domain: Core OS / Memory Management.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.