revert-mm-fix-blkdev-size-calculation-in-generic_write_checks
[linux-2.6/linux-trees-mm.git] / fs / reiser4 / entd.h
blob4f79a578fba38f79e860b94f8cff73fc17a160e8
1 /* Copyright 2003 by Hans Reiser, licensing governed by reiser4/README */
3 /* Ent daemon. */
5 #ifndef __ENTD_H__
6 #define __ENTD_H__
8 #include "context.h"
10 #include <linux/fs.h>
11 #include <linux/completion.h>
12 #include <linux/wait.h>
13 #include <linux/spinlock.h>
14 #include <linux/sched.h> /* for struct task_struct */
16 #define WBQ_MAGIC 0x7876dc76
18 /* write-back request. */
19 struct wbq {
20 int magic;
21 struct list_head link; /* list head of this list is in entd context */
22 struct writeback_control *wbc;
23 struct page *page;
24 struct address_space *mapping;
25 struct completion completion;
26 jnode *node; /* set if ent thread captured requested page */
27 int written; /* set if ent thread wrote requested page */
30 /* ent-thread context. This is used to synchronize starting/stopping ent
31 * threads. */
32 typedef struct entd_context {
33 /* wait queue that ent thread waits on for more work. It's
34 * signaled by write_page_by_ent(). */
35 wait_queue_head_t wait;
36 /* spinlock protecting other fields */
37 spinlock_t guard;
38 /* ent thread */
39 struct task_struct *tsk;
40 /* set to indicate that ent thread should leave. */
41 int done;
42 /* counter of active flushers */
43 int flushers;
45 * when reiser4_writepage asks entd to write a page - it adds struct
46 * wbq to this list
48 struct list_head todo_list;
49 /* number of elements on the above list */
50 int nr_todo_reqs;
52 struct wbq *cur_request;
54 * when entd writes a page it moves write-back request from todo_list
55 * to done_list. This list is used at the end of entd iteration to
56 * wakeup requestors and iput inodes.
58 struct list_head done_list;
59 /* number of elements on the above list */
60 int nr_done_reqs;
62 #if REISER4_DEBUG
63 /* list of all active flushers */
64 struct list_head flushers_list;
65 #endif
66 } entd_context;
68 extern int reiser4_init_entd(struct super_block *);
69 extern void reiser4_done_entd(struct super_block *);
71 extern void reiser4_enter_flush(struct super_block *);
72 extern void reiser4_leave_flush(struct super_block *);
74 extern int write_page_by_ent(struct page *, struct writeback_control *);
75 extern int wbq_available(void);
76 extern void ent_writes_page(struct super_block *, struct page *);
78 extern jnode *get_jnode_by_wbq(struct super_block *, struct wbq *);
79 /* __ENTD_H__ */
80 #endif
82 /* Make Linus happy.
83 Local variables:
84 c-indentation-style: "K&R"
85 mode-name: "LC"
86 c-basic-offset: 8
87 tab-width: 8
88 fill-column: 120
89 End: