6f06d221d440352b6a33ffc43893a458fe9b5691
[linux-2.6.git] / fs / relayfs / resize.h
1 #ifndef _RELAY_RESIZE_H
2 #define _RELAY_RESIZE_H
3
4 /* 
5  * If the channel usage has been below the low water mark for more than
6  * this amount of time, we can shrink the buffer if necessary.
7  */
8 #define SHRINK_TIMER_SECS       60
9
10 /* This inspired by rtai/shmem */
11 #define FIX_SIZE(x) (((x) - 1) & PAGE_MASK) + PAGE_SIZE
12
13 /* Don't attempt resizing again after this many failures */
14 #define MAX_RESIZE_FAILURES     1
15
16 /* Trigger resizing if a resizable channel is this full */
17 #define RESIZE_THRESHOLD        3 / 4
18
19 /*
20  * Used for deferring resized channel free
21  */
22 struct free_rchan_buf
23 {
24         char *unmap_buf;
25         struct 
26         {
27                 struct page **array;
28                 int count;
29         } page_array[3];
30         
31         int cur;
32         struct work_struct work;        /* resize de-allocation work struct */
33 };
34
35 extern void *
36 alloc_rchan_buf(unsigned long size,
37                 struct page ***page_array,
38                 int *page_count);
39
40 extern void
41 free_rchan_buf(void *buf,
42                struct page **page_array,
43                int page_count);
44
45 extern void
46 expand_check(struct rchan *rchan);
47
48 extern void
49 init_shrink_timer(struct rchan *rchan);
50
51 #endif/* _RELAY_RESIZE_H */