pm: Add pm_writeback_pages()
[akaros.git] / kern / include / pagemap.h
index 460ccbc..140ffbb 100644 (file)
 
 /* Need to be careful, due to some ghetto circular references */
 struct page;
-struct inode;
-struct block_device;
 struct chan;
 struct page_map_operations;
 
-/* Every object that has pages, like an inode or the swap (or even direct block
- * devices) has a page_map, tracking which of its pages are currently in memory.
- * It is a map, per object, from index to physical page frame. */
+/* Every object that has pages has a page_map, tracking which of its pages are
+ * currently in memory.  It is a map, per object, from index to physical page
+ * frame. */
 struct page_map {
-       union {
-               struct inode                            *pm_host;       /* inode of the owner, if any */
-               struct block_device                     *pm_bdev;       /* bdev of the owner, if any */
-               struct chan                                     *pm_chan;
-       };
+       qlock_t                                         pm_qlock;               /* for the radix tree nr_pgs */
+       struct fs_file                          *pm_file;
        struct radix_tree                       pm_tree;                /* tracks present pages */
        unsigned long                           pm_num_pages;   /* how many pages are present */
        struct page_map_operations      *pm_op;
-       spinlock_t                                      pm_lock;
+       spinlock_t                                      pm_lock;                /* for the VMR list */
        struct vmr_tailq                        pm_vmrs;
-       atomic_t                                        pm_removal;
 };
 
 /* Operations performed on a page_map.  These are usually FS specific, which
@@ -66,6 +60,9 @@ void pm_add_vmr(struct page_map *pm, struct vm_region *vmr);
 void pm_remove_vmr(struct page_map *pm, struct vm_region *vmr);
 int pm_remove_contig(struct page_map *pm, unsigned long index,
                      unsigned long nr_pgs);
+void pm_remove_or_zero_pages(struct page_map *pm, unsigned long start_idx,
+                             unsigned long nr_pgs);
+void pm_writeback_pages(struct page_map *pm);
 void pm_destroy(struct page_map *pm);
 void pm_page_asserter(struct page *page, char *str);
 void print_page_map_info(struct page_map *pm);