MOS Source Code
Loading...
Searching...
No Matches
page_cache.cpp File Reference
#include "mos/filesystem/page_cache.hpp"
#include "mos/filesystem/vfs_types.hpp"
#include "mos/filesystem/vfs_utils.hpp"
#include "mos/mm/mm.hpp"
#include "mos/mm/mmstat.hpp"
#include "mos/mm/physical/pmm.hpp"
#include "mos/syslog/printk.hpp"
#include <algorithm>
#include <mos/mos_global.h>
#include <mos_stdlib.hpp>
#include <mos_string.hpp>
+ Include dependency graph for page_cache.cpp:

Go to the source code of this file.

Classes

struct  _flush_and_drop_data
 

Functions

static bool do_flush_and_drop_cached_page (const size_t pgoff, phyframe_t *page, _flush_and_drop_data *fdd)
 
long pagecache_flush_or_drop (inode_cache_t *icache, off_t pgoff, size_t npages, bool drop_page)
 Flush or drop a range of pages from the page cache.
 
long pagecache_flush_or_drop_all (inode_cache_t *icache, bool drop_page)
 Flush or drop all pages in the page cache.
 
PtrResult< phyframe_tpagecache_get_page_for_read (inode_cache_t *cache, off_t pgoff)
 Get a page from the page cache.
 
PtrResult< phyframe_tpagecache_get_page_for_write (inode_cache_t *cache, off_t pgoff)
 Get a page from the page cache for writing.
 
ssize_t vfs_read_pagecache (inode_cache_t *icache, void *buf, size_t size, off_t offset)
 
ssize_t vfs_write_pagecache (inode_cache_t *icache, const void *buf, size_t total_size, off_t offset)
 

Function Documentation

◆ do_flush_and_drop_cached_page()

static bool do_flush_and_drop_cached_page ( const size_t pgoff,
phyframe_t * page,
_flush_and_drop_data * fdd )
static

Definition at line 24 of file page_cache.cpp.

Referenced by pagecache_flush_or_drop(), and pagecache_flush_or_drop_all().

+ Here is the call graph for this function:

◆ pagecache_flush_or_drop()

long pagecache_flush_or_drop ( inode_cache_t * icache,
off_t pgoff,
size_t npages,
bool drop_page )

Flush or drop a range of pages from the page cache.

Parameters
icacheThe inode cache
pgoffThe starting page offset
npagesThe number of pages to flush or drop
drop_pageWhether to drop the pages, or just flush them
Returns
long

Definition at line 54 of file page_cache.cpp.

Referenced by do_pagecache_flush().

+ Here is the call graph for this function:

◆ pagecache_flush_or_drop_all()

long pagecache_flush_or_drop_all ( inode_cache_t * icache,
bool drop_page )

Flush or drop all pages in the page cache.

Parameters
icacheThe inode cache
drop_pageWhether to drop the pages, or just flush them
Returns
long

Definition at line 76 of file page_cache.cpp.

Referenced by do_pagecache_flush(), and inode_try_drop().

+ Here is the call graph for this function:

◆ pagecache_get_page_for_read()

PtrResult< phyframe_t > pagecache_get_page_for_read ( inode_cache_t * cache,
off_t pgoff )

Get a page from the page cache.

Parameters
cacheThe inode cache
pgoffThe page offset
Returns
phyframe_t* The page, or NULL if it doesn't exist
Note
Caller must hold the cache's lock

Definition at line 84 of file page_cache.cpp.

Referenced by pagecache_get_page_for_write(), vfs_fault_handler(), and vfs_read_pagecache().

+ Here is the call graph for this function:

◆ pagecache_get_page_for_write()

PtrResult< phyframe_t > pagecache_get_page_for_write ( inode_cache_t * cache,
off_t pgoff )

Get a page from the page cache for writing.

Parameters
cacheThe inode cache
pgoffThe page offset
Returns
phyframe_t* The page

Definition at line 106 of file page_cache.cpp.

Referenced by simple_page_write_begin().

+ Here is the call graph for this function:

◆ vfs_read_pagecache()

ssize_t vfs_read_pagecache ( inode_cache_t * icache,
void * buf,
size_t size,
off_t offset )

Definition at line 111 of file page_cache.cpp.

Referenced by vfs_generic_read().

+ Here is the call graph for this function:

◆ vfs_write_pagecache()

ssize_t vfs_write_pagecache ( inode_cache_t * icache,
const void * buf,
size_t total_size,
off_t offset )

Definition at line 140 of file page_cache.cpp.

Referenced by vfs_generic_write().

+ Here is the call graph for this function: