29 off_t const pgoff = key;
61 for (
size_t i = 0; i < npages; i++)
111 size_t bytes_read = 0;
112 size_t bytes_left =
size;
113 while (bytes_left > 0)
123 return PTR_ERR(page);
126 memcpy((
char *) buf + bytes_read, (
void *) (
phyframe_va(page) + inpage_offset), inpage_size);
128 bytes_read += inpage_size;
129 bytes_left -= inpage_size;
130 offset += inpage_size;
144 size_t bytes_written = 0;
145 size_t bytes_left = total_size;
146 while (bytes_left > 0)
157 pr_warn(
"page_write_begin failed");
162 memcpy((
char *) (
phyframe_va(page) + inpage_offset), (
char *) buf + bytes_written, inpage_size);
165 bytes_written += inpage_size;
166 bytes_left -= inpage_size;
167 offset += inpage_size;
171 return bytes_written;
#define MOS_ASSERT_X(cond, msg,...)
MOSAPI void * hashmap_get(hashmap_t *map, uintn key)
MOSAPI void * hashmap_put(hashmap_t *map, uintn key, void *value)
MOSAPI void * hashmap_remove(hashmap_t *map, uintn key)
MOSAPI void hashmap_foreach(hashmap_t *map, hashmap_foreach_func_t func, void *data)
#define phyframe_va(frame)
#define pmm_unref_one(thing)
#define mmstat_dec1(type)
#define mmstat_inc1(type)
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.
ssize_t vfs_write_pagecache(inode_cache_t *icache, const void *buf, size_t total_size, off_t offset)
long pagecache_flush_or_drop_all(inode_cache_t *icache, bool drop_page)
Flush or drop all pages in the page cache.
phyframe_t * pagecache_get_page_for_read(inode_cache_t *cache, off_t pgoff)
Get a page from the page cache.
phyframe_t * pagecache_get_page_for_write(inode_cache_t *cache, off_t pgoff)
Get a page from the page cache for writing.
static bool do_flush_and_drop_cached_page(const uintn key, void *value, void *data)
ssize_t vfs_read_pagecache(inode_cache_t *icache, void *buf, size_t size, off_t offset)
static void * memcpy(void *s1, const void *s2, size_t n)
#define mutex_acquire(mutex)
#define mutex_release(mutex)
long(* flush_page)(inode_cache_t *cache, off_t pgoff, phyframe_t *page)
Flush a page to the underlying storage.
phyframe_t *(* fill_cache)(inode_cache_t *cache, off_t pgoff)
Read a page from the underlying storage, at file offset pgoff * MOS_PAGE_SIZE.
bool(* page_write_begin)(inode_cache_t *cache, off_t file_offset, size_t inpage_size, phyframe_t **page_out, void **data)
void(* page_write_end)(inode_cache_t *cache, off_t file_offset, size_t inpage_size, phyframe_t *page, void *data)
const inode_cache_ops_t * ops
long simple_flush_page_discard_data(inode_cache_t *icache, off_t pgoff, phyframe_t *page)