aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs/jfs_metapage.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jfs/jfs_metapage.h')
-rw-r--r--fs/jfs/jfs_metapage.h115
1 files changed, 115 insertions, 0 deletions
diff --git a/fs/jfs/jfs_metapage.h b/fs/jfs/jfs_metapage.h
new file mode 100644
index 000000000000..0e58aba58c37
--- /dev/null
+++ b/fs/jfs/jfs_metapage.h
@@ -0,0 +1,115 @@
1/*
2 * Copyright (c) International Business Machines Corp., 2000-2002
3 * Portions Copyright (c) Christoph Hellwig, 2001-2002
4 *
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.
14 *
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
18 */
19#ifndef _H_JFS_METAPAGE
20#define _H_JFS_METAPAGE
21
22#include <linux/pagemap.h>
23
24struct 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 */
32
33 unsigned long flag; /* See Below */
34 unsigned long count; /* Reference count */
35 void *data; /* Data pointer */
36
37 /* list management stuff */
38 struct metapage *hash_prev;
39 struct metapage *hash_next; /* Also used for free list */
40
41 /*
42 * mapping & index become redundant, but we need these here to
43 * add the metapage to the hash before we have the real page
44 */
45 struct address_space *mapping;
46 unsigned long index;
47 wait_queue_head_t wait;
48
49 /* implementation */
50 struct page *page;
51 unsigned long logical_size;
52
53 /* Journal management */
54 int clsn;
55 atomic_t nohomeok;
56 struct jfs_log *log;
57};
58
59/* metapage flag */
60#define META_locked 0
61#define META_absolute 1
62#define META_free 2
63#define META_dirty 3
64#define META_sync 4
65#define META_discard 5
66#define META_forced 6
67#define META_stale 7
68
69#define mark_metapage_dirty(mp) set_bit(META_dirty, &(mp)->flag)
70
71/* function prototypes */
72extern struct metapage *__get_metapage(struct inode *inode,
73 unsigned long lblock, unsigned int size,
74 int absolute, unsigned long new);
75
76#define read_metapage(inode, lblock, size, absolute)\
77 __get_metapage(inode, lblock, size, absolute, FALSE)
78
79#define get_metapage(inode, lblock, size, absolute)\
80 __get_metapage(inode, lblock, size, absolute, TRUE)
81
82extern void release_metapage(struct metapage *);
83extern void hold_metapage(struct metapage *, int);
84
85static inline void write_metapage(struct metapage *mp)
86{
87 set_bit(META_dirty, &mp->flag);
88 release_metapage(mp);
89}
90
91static inline void flush_metapage(struct metapage *mp)
92{
93 set_bit(META_sync, &mp->flag);
94 write_metapage(mp);
95}
96
97static inline void discard_metapage(struct metapage *mp)
98{
99 clear_bit(META_dirty, &mp->flag);
100 set_bit(META_discard, &mp->flag);
101 release_metapage(mp);
102}
103
104/*
105 * This routines invalidate all pages for an extent.
106 */
107extern 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)))
114
115#endif /* _H_JFS_METAPAGE */