diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 15:20:36 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 15:20:36 -0700 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/linux/pagevec.h | |
download | linux-1da177e4c3f41524e886b7f1b8a0c1fc7321cac2.tar.gz linux-1da177e4c3f41524e886b7f1b8a0c1fc7321cac2.tar.bz2 linux-1da177e4c3f41524e886b7f1b8a0c1fc7321cac2.zip |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'include/linux/pagevec.h')
-rw-r--r-- | include/linux/pagevec.h | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h new file mode 100644 index 000000000000..def32c5715be --- /dev/null +++ b/include/linux/pagevec.h @@ -0,0 +1,85 @@ +/* + * include/linux/pagevec.h + * + * In many places it is efficient to batch an operation up against multiple + * pages. A pagevec is a multipage container which is used for that. + */ + +/* 14 pointers + two long's align the pagevec structure to a power of two */ +#define PAGEVEC_SIZE 14 + +struct page; +struct address_space; + +struct pagevec { + unsigned long nr; + unsigned long cold; + struct page *pages[PAGEVEC_SIZE]; +}; + +void __pagevec_release(struct pagevec *pvec); +void __pagevec_release_nonlru(struct pagevec *pvec); +void __pagevec_free(struct pagevec *pvec); +void __pagevec_lru_add(struct pagevec *pvec); +void __pagevec_lru_add_active(struct pagevec *pvec); +void pagevec_strip(struct pagevec *pvec); +unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping, + pgoff_t start, unsigned nr_pages); +unsigned pagevec_lookup_tag(struct pagevec *pvec, + struct address_space *mapping, pgoff_t *index, int tag, + unsigned nr_pages); + +static inline void pagevec_init(struct pagevec *pvec, int cold) +{ + pvec->nr = 0; + pvec->cold = cold; +} + +static inline void pagevec_reinit(struct pagevec *pvec) +{ + pvec->nr = 0; +} + +static inline unsigned pagevec_count(struct pagevec *pvec) +{ + return pvec->nr; +} + +static inline unsigned pagevec_space(struct pagevec *pvec) +{ + return PAGEVEC_SIZE - pvec->nr; +} + +/* + * Add a page to a pagevec. Returns the number of slots still available. + */ +static inline unsigned pagevec_add(struct pagevec *pvec, struct page *page) +{ + pvec->pages[pvec->nr++] = page; + return pagevec_space(pvec); +} + + +static inline void pagevec_release(struct pagevec *pvec) +{ + if (pagevec_count(pvec)) + __pagevec_release(pvec); +} + +static inline void pagevec_release_nonlru(struct pagevec *pvec) +{ + if (pagevec_count(pvec)) + __pagevec_release_nonlru(pvec); +} + +static inline void pagevec_free(struct pagevec *pvec) +{ + if (pagevec_count(pvec)) + __pagevec_free(pvec); +} + +static inline void pagevec_lru_add(struct pagevec *pvec) +{ + if (pagevec_count(pvec)) + __pagevec_lru_add(pvec); +} |