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.
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>
25 /* Common logsyncblk prefix (see jfs_logmgr.h) */
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 */
37 /* list management stuff */
38 struct metapage *hash_prev;
39 struct metapage *hash_next; /* Also used for free list */
42 * mapping & index become redundant, but we need these here to
43 * add the metapage to the hash before we have the real page
45 struct address_space *mapping;
47 wait_queue_head_t wait;
51 unsigned long logical_size;
53 /* Journal management */
61 #define META_absolute 1
65 #define META_discard 5
69 #define mark_metapage_dirty(mp) set_bit(META_dirty, &(mp)->flag)
71 /* function prototypes */
72 extern struct metapage *__get_metapage(struct inode *inode,
73 unsigned long lblock, unsigned int size,
74 int absolute, unsigned long new);
76 #define read_metapage(inode, lblock, size, absolute)\
77 __get_metapage(inode, lblock, size, absolute, FALSE)
79 #define get_metapage(inode, lblock, size, absolute)\
80 __get_metapage(inode, lblock, size, absolute, TRUE)
82 extern void release_metapage(struct metapage *);
83 extern void hold_metapage(struct metapage *, int);
85 static inline void write_metapage(struct metapage *mp)
87 set_bit(META_dirty, &mp->flag);
91 static inline void flush_metapage(struct metapage *mp)
93 set_bit(META_sync, &mp->flag);
97 static inline void discard_metapage(struct metapage *mp)
99 clear_bit(META_dirty, &mp->flag);
100 set_bit(META_discard, &mp->flag);
101 release_metapage(mp);
105 * This routines invalidate all pages for an extent.
107 extern void __invalidate_metapages(struct inode *, s64, int);
108 #define invalidate_pxd_metapages(ip, pxd) \
109 __invalidate_metapages((ip), addressPXD(&(pxd)), lengthPXD(&(pxd)))
110 #define invalidate_dxd_metapages(ip, dxd) \
111 __invalidate_metapages((ip), addressDXD(&(dxd)), lengthDXD(&(dxd)))
112 #define invalidate_xad_metapages(ip, xad) \
113 __invalidate_metapages((ip), addressXAD(&(xad)), lengthXAD(&(xad)))
115 #endif /* _H_JFS_METAPAGE */