ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / linux / writeback.h
1 /*
2  * include/linux/writeback.h.
3  */
4 #ifndef WRITEBACK_H
5 #define WRITEBACK_H
6
7 struct backing_dev_info;
8
9 extern spinlock_t inode_lock;
10 extern struct list_head inode_in_use;
11 extern struct list_head inode_unused;
12
13 /*
14  * Yes, writeback.h requires sched.h
15  * No, sched.h is not included from here.
16  */
17 static inline int current_is_pdflush(void)
18 {
19         return current->flags & PF_FLUSHER;
20 }
21
22 /*
23  * fs/fs-writeback.c
24  */
25 enum writeback_sync_modes {
26         WB_SYNC_NONE,   /* Don't wait on anything */
27         WB_SYNC_ALL,    /* Wait on every mapping */
28         WB_SYNC_HOLD,   /* Hold the inode on sb_dirty for sys_sync() */
29 };
30
31 /*
32  * A control structure which tells the writeback code what to do
33  */
34 struct writeback_control {
35         struct backing_dev_info *bdi;   /* If !NULL, only write back this
36                                            queue */
37         enum writeback_sync_modes sync_mode;
38         unsigned long *older_than_this; /* If !NULL, only write back inodes
39                                            older than this */
40         long nr_to_write;               /* Write this many pages, and decrement
41                                            this for each page written */
42         long pages_skipped;             /* Pages which were not written */
43         int nonblocking;                /* Don't get stuck on request queues */
44         int encountered_congestion;     /* An output: a queue is full */
45         int for_kupdate;                /* A kupdate writeback */
46         int for_reclaim;                /* Invoked from the page allocator */
47 };
48
49 /*
50  * ->writepage() return values (make these much larger than a pagesize, in
51  * case some fs is returning number-of-bytes-written from writepage)
52  */
53 #define WRITEPAGE_ACTIVATE      0x80000 /* IO was not started: activate page */
54
55 /*
56  * fs/fs-writeback.c
57  */     
58 void writeback_inodes(struct writeback_control *wbc);
59 void wake_up_inode(struct inode *inode);
60 void __wait_on_inode(struct inode * inode);
61 void sync_inodes_sb(struct super_block *, int wait);
62 void sync_inodes(int wait);
63
64 /* writeback.h requires fs.h; it, too, is not included from here. */
65 static inline void wait_on_inode(struct inode *inode)
66 {
67         if (inode->i_state & I_LOCK)
68                 __wait_on_inode(inode);
69 }
70
71 /*
72  * mm/page-writeback.c
73  */
74 int wakeup_bdflush(long nr_pages);
75 void laptop_io_completion(void);
76 void laptop_sync_completion(void);
77
78 /* These are exported to sysctl. */
79 extern int dirty_background_ratio;
80 extern int vm_dirty_ratio;
81 extern int dirty_writeback_centisecs;
82 extern int dirty_expire_centisecs;
83 extern int block_dump;
84 extern int laptop_mode;
85
86 struct ctl_table;
87 struct file;
88 int dirty_writeback_centisecs_handler(struct ctl_table *, int, struct file *,
89                                       void __user *, size_t *);
90
91 void page_writeback_init(void);
92 void balance_dirty_pages_ratelimited(struct address_space *mapping);
93 int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0);
94 int do_writepages(struct address_space *mapping, struct writeback_control *wbc);
95
96 /* pdflush.c */
97 extern int nr_pdflush_threads;  /* Global so it can be exported to sysctl
98                                    read-only. */
99
100
101 #endif          /* WRITEBACK_H */