~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/frontswap.h

Version: ~ [ linux-5.14-rc1 ] ~ [ linux-5.13.1 ] ~ [ linux-5.12.16 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.49 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.131 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.197 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.239 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.275 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.275 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef _LINUX_FRONTSWAP_H
  2 #define _LINUX_FRONTSWAP_H
  3 
  4 #include <linux/swap.h>
  5 #include <linux/mm.h>
  6 #include <linux/bitops.h>
  7 
  8 struct frontswap_ops {
  9         void (*init)(unsigned); /* this swap type was just swapon'ed */
 10         int (*store)(unsigned, pgoff_t, struct page *); /* store a page */
 11         int (*load)(unsigned, pgoff_t, struct page *); /* load a page */
 12         void (*invalidate_page)(unsigned, pgoff_t); /* page no longer needed */
 13         void (*invalidate_area)(unsigned); /* swap type just swapoff'ed */
 14         struct frontswap_ops *next; /* private pointer to next ops */
 15 };
 16 
 17 extern bool frontswap_enabled;
 18 extern void frontswap_register_ops(struct frontswap_ops *ops);
 19 extern void frontswap_shrink(unsigned long);
 20 extern unsigned long frontswap_curr_pages(void);
 21 extern void frontswap_writethrough(bool);
 22 #define FRONTSWAP_HAS_EXCLUSIVE_GETS
 23 extern void frontswap_tmem_exclusive_gets(bool);
 24 
 25 extern bool __frontswap_test(struct swap_info_struct *, pgoff_t);
 26 extern void __frontswap_init(unsigned type, unsigned long *map);
 27 extern int __frontswap_store(struct page *page);
 28 extern int __frontswap_load(struct page *page);
 29 extern void __frontswap_invalidate_page(unsigned, pgoff_t);
 30 extern void __frontswap_invalidate_area(unsigned);
 31 
 32 #ifdef CONFIG_FRONTSWAP
 33 #define frontswap_enabled (1)
 34 
 35 static inline bool frontswap_test(struct swap_info_struct *sis, pgoff_t offset)
 36 {
 37         return __frontswap_test(sis, offset);
 38 }
 39 
 40 static inline void frontswap_map_set(struct swap_info_struct *p,
 41                                      unsigned long *map)
 42 {
 43         p->frontswap_map = map;
 44 }
 45 
 46 static inline unsigned long *frontswap_map_get(struct swap_info_struct *p)
 47 {
 48         return p->frontswap_map;
 49 }
 50 #else
 51 /* all inline routines become no-ops and all externs are ignored */
 52 
 53 #define frontswap_enabled (0)
 54 
 55 static inline bool frontswap_test(struct swap_info_struct *sis, pgoff_t offset)
 56 {
 57         return false;
 58 }
 59 
 60 static inline void frontswap_map_set(struct swap_info_struct *p,
 61                                      unsigned long *map)
 62 {
 63 }
 64 
 65 static inline unsigned long *frontswap_map_get(struct swap_info_struct *p)
 66 {
 67         return NULL;
 68 }
 69 #endif
 70 
 71 static inline int frontswap_store(struct page *page)
 72 {
 73         int ret = -1;
 74 
 75         if (frontswap_enabled)
 76                 ret = __frontswap_store(page);
 77         return ret;
 78 }
 79 
 80 static inline int frontswap_load(struct page *page)
 81 {
 82         int ret = -1;
 83 
 84         if (frontswap_enabled)
 85                 ret = __frontswap_load(page);
 86         return ret;
 87 }
 88 
 89 static inline void frontswap_invalidate_page(unsigned type, pgoff_t offset)
 90 {
 91         if (frontswap_enabled)
 92                 __frontswap_invalidate_page(type, offset);
 93 }
 94 
 95 static inline void frontswap_invalidate_area(unsigned type)
 96 {
 97         if (frontswap_enabled)
 98                 __frontswap_invalidate_area(type);
 99 }
100 
101 static inline void frontswap_init(unsigned type, unsigned long *map)
102 {
103         if (frontswap_enabled)
104                 __frontswap_init(type, map);
105 }
106 
107 #endif /* _LINUX_FRONTSWAP_H */
108 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp