aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/page-flags.h
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2007-07-19 04:49:17 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-19 13:04:52 -0400
commitd688abf50bd5a30d2c44dea2a72dd59052cd3cce (patch)
tree2f572d18af05969b2c882970cda4860be345bdfc /include/linux/page-flags.h
parent6819457d2cb7fe4fdb0fc3655b6b6dc71a86bee9 (diff)
move page writeback acounting out of macros
page-writeback accounting is presently performed in the page-flags macros. This is inconsistent and a bit ugly and makes it awkward to implement per-backing_dev under-writeback page accounting. So move this accounting down to the callsite(s). Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/page-flags.h')
-rw-r--r--include/linux/page-flags.h38
1 files changed, 8 insertions, 30 deletions
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index a454176c3e30..209d3a47f50f 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -189,37 +189,15 @@ static inline void SetPageUptodate(struct page *page)
189#define __SetPagePrivate(page) __set_bit(PG_private, &(page)->flags) 189#define __SetPagePrivate(page) __set_bit(PG_private, &(page)->flags)
190#define __ClearPagePrivate(page) __clear_bit(PG_private, &(page)->flags) 190#define __ClearPagePrivate(page) __clear_bit(PG_private, &(page)->flags)
191 191
192/*
193 * Only test-and-set exist for PG_writeback. The unconditional operators are
194 * risky: they bypass page accounting.
195 */
192#define PageWriteback(page) test_bit(PG_writeback, &(page)->flags) 196#define PageWriteback(page) test_bit(PG_writeback, &(page)->flags)
193#define SetPageWriteback(page) \ 197#define TestSetPageWriteback(page) test_and_set_bit(PG_writeback, \
194 do { \ 198 &(page)->flags)
195 if (!test_and_set_bit(PG_writeback, \ 199#define TestClearPageWriteback(page) test_and_clear_bit(PG_writeback, \
196 &(page)->flags)) \ 200 &(page)->flags)
197 inc_zone_page_state(page, NR_WRITEBACK); \
198 } while (0)
199#define TestSetPageWriteback(page) \
200 ({ \
201 int ret; \
202 ret = test_and_set_bit(PG_writeback, \
203 &(page)->flags); \
204 if (!ret) \
205 inc_zone_page_state(page, NR_WRITEBACK); \
206 ret; \
207 })
208#define ClearPageWriteback(page) \
209 do { \
210 if (test_and_clear_bit(PG_writeback, \
211 &(page)->flags)) \
212 dec_zone_page_state(page, NR_WRITEBACK); \
213 } while (0)
214#define TestClearPageWriteback(page) \
215 ({ \
216 int ret; \
217 ret = test_and_clear_bit(PG_writeback, \
218 &(page)->flags); \
219 if (ret) \
220 dec_zone_page_state(page, NR_WRITEBACK); \
221 ret; \
222 })
223 201
224#define PageBuddy(page) test_bit(PG_buddy, &(page)->flags) 202#define PageBuddy(page) test_bit(PG_buddy, &(page)->flags)
225#define __SetPageBuddy(page) __set_bit(PG_buddy, &(page)->flags) 203#define __SetPageBuddy(page) __set_bit(PG_buddy, &(page)->flags)