1 /* Public domain. */
2 
3 #ifndef	_LINUXKPI_LINUX_PAGEVEC_H_
4 #define	_LINUXKPI_LINUX_PAGEVEC_H_
5 
6 #include <sys/types.h>
7 #include <sys/systm.h>
8 #include <sys/errno.h>
9 
10 #include <linux/pagemap.h>
11 
12 #define PAGEVEC_SIZE 15
13 
14 struct pagevec {
15 	uint8_t	nr;
16 	struct page *pages[PAGEVEC_SIZE];
17 };
18 
19 static inline unsigned int
20 pagevec_space(struct pagevec *pvec)
21 {
22 	return PAGEVEC_SIZE - pvec->nr;
23 }
24 
25 static inline void
26 pagevec_init(struct pagevec *pvec)
27 {
28 	pvec->nr = 0;
29 }
30 
31 static inline void
32 pagevec_reinit(struct pagevec *pvec)
33 {
34 	pvec->nr = 0;
35 }
36 
37 static inline unsigned int
38 pagevec_count(struct pagevec *pvec)
39 {
40 	return pvec->nr;
41 }
42 
43 static inline unsigned int
44 pagevec_add(struct pagevec *pvec, struct page *page)
45 {
46 	pvec->pages[pvec->nr++] = page;
47 	return PAGEVEC_SIZE - pvec->nr;
48 }
49 
50 static inline void
51 __pagevec_release(struct pagevec *pvec)
52 {
53 	release_pages(pvec->pages, pagevec_count(pvec));
54 	pagevec_reinit(pvec);
55 }
56 
57 static inline void
58 pagevec_release(struct pagevec *pvec)
59 {
60 	if (pagevec_count(pvec))
61 		__pagevec_release(pvec);
62 }
63 
64 static inline void
65 check_move_unevictable_pages(struct pagevec *pvec)
66 {
67 }
68 
69 #endif	/* _LINUXKPI_LINUX_PAGEVEC_H_ */
70