[TG3]: Set minimal hw interrupt mitigation.
[linux-2.6/verdex.git] / fs / jfs / jfs_metapage.h
blob991e9fb84c75517cc6f73247081740dd97da76ec
1 /*
2 * Copyright (c) International Business Machines Corp., 2000-2002
3 * Portions Copyright (c) Christoph Hellwig, 2001-2002
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
13 * the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef _H_JFS_METAPAGE
20 #define _H_JFS_METAPAGE
22 #include <linux/pagemap.h>
24 struct metapage {
25 /* Common logsyncblk prefix (see jfs_logmgr.h) */
26 u16 xflag;
27 u16 unused;
28 lid_t lid;
29 int lsn;
30 struct list_head synclist;
31 /* End of logsyncblk prefix */
33 unsigned long flag; /* See Below */
34 unsigned long count; /* Reference count */
35 void *data; /* Data pointer */
36 sector_t index; /* block address of page */
37 wait_queue_head_t wait;
39 /* implementation */
40 struct page *page;
41 unsigned int logical_size;
43 /* Journal management */
44 int clsn;
45 int nohomeok;
46 struct jfs_log *log;
49 /* metapage flag */
50 #define META_locked 0
51 #define META_free 1
52 #define META_dirty 2
53 #define META_sync 3
54 #define META_discard 4
55 #define META_forcewrite 5
56 #define META_io 6
58 #define mark_metapage_dirty(mp) set_bit(META_dirty, &(mp)->flag)
60 /* function prototypes */
61 extern struct metapage *__get_metapage(struct inode *inode,
62 unsigned long lblock, unsigned int size,
63 int absolute, unsigned long new);
65 #define read_metapage(inode, lblock, size, absolute)\
66 __get_metapage(inode, lblock, size, absolute, FALSE)
68 #define get_metapage(inode, lblock, size, absolute)\
69 __get_metapage(inode, lblock, size, absolute, TRUE)
71 extern void release_metapage(struct metapage *);
72 extern void grab_metapage(struct metapage *);
73 extern void force_metapage(struct metapage *);
76 * hold_metapage and put_metapage are used in conjuction. The page lock
77 * is not dropped between the two, so no other threads can get or release
78 * the metapage
80 extern void hold_metapage(struct metapage *);
81 extern void put_metapage(struct metapage *);
83 static inline void write_metapage(struct metapage *mp)
85 set_bit(META_dirty, &mp->flag);
86 release_metapage(mp);
89 static inline void flush_metapage(struct metapage *mp)
91 set_bit(META_sync, &mp->flag);
92 write_metapage(mp);
95 static inline void discard_metapage(struct metapage *mp)
97 clear_bit(META_dirty, &mp->flag);
98 set_bit(META_discard, &mp->flag);
99 release_metapage(mp);
102 static inline void metapage_nohomeok(struct metapage *mp)
104 struct page *page = mp->page;
105 lock_page(page);
106 if (!mp->nohomeok++) {
107 mark_metapage_dirty(mp);
108 page_cache_get(page);
109 wait_on_page_writeback(page);
111 unlock_page(page);
115 * This serializes access to mp->lsn when metapages are added to logsynclist
116 * without setting nohomeok. i.e. updating imap & dmap
118 static inline void metapage_wait_for_io(struct metapage *mp)
120 if (test_bit(META_io, &mp->flag))
121 wait_on_page_writeback(mp->page);
125 * This is called when already holding the metapage
127 static inline void _metapage_homeok(struct metapage *mp)
129 if (!--mp->nohomeok)
130 page_cache_release(mp->page);
133 static inline void metapage_homeok(struct metapage *mp)
135 hold_metapage(mp);
136 _metapage_homeok(mp);
137 put_metapage(mp);
140 extern struct address_space_operations jfs_metapage_aops;
143 * This routines invalidate all pages for an extent.
145 extern void __invalidate_metapages(struct inode *, s64, int);
146 #define invalidate_pxd_metapages(ip, pxd) \
147 __invalidate_metapages((ip), addressPXD(&(pxd)), lengthPXD(&(pxd)))
148 #define invalidate_dxd_metapages(ip, dxd) \
149 __invalidate_metapages((ip), addressDXD(&(dxd)), lengthDXD(&(dxd)))
150 #define invalidate_xad_metapages(ip, xad) \
151 __invalidate_metapages((ip), addressXAD(&(xad)), lengthXAD(&(xad)))
153 #endif /* _H_JFS_METAPAGE */