aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs/jfs_xtree.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /fs/jfs/jfs_xtree.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'fs/jfs/jfs_xtree.h')
-rw-r--r--fs/jfs/jfs_xtree.h140
1 files changed, 140 insertions, 0 deletions
diff --git a/fs/jfs/jfs_xtree.h b/fs/jfs/jfs_xtree.h
new file mode 100644
index 000000000000..a69784254fe7
--- /dev/null
+++ b/fs/jfs/jfs_xtree.h
@@ -0,0 +1,140 @@
1/*
2 * Copyright (c) International Business Machines Corp., 2000-2002
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
12 * the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18#ifndef _H_JFS_XTREE
19#define _H_JFS_XTREE
20
21/*
22 * jfs_xtree.h: extent allocation descriptor B+-tree manager
23 */
24
25#include "jfs_btree.h"
26
27
28/*
29 * extent allocation descriptor (xad)
30 */
31typedef struct xad {
32 unsigned flag:8; /* 1: flag */
33 unsigned rsvrd:16; /* 2: reserved */
34 unsigned off1:8; /* 1: offset in unit of fsblksize */
35 __le32 off2; /* 4: offset in unit of fsblksize */
36 unsigned len:24; /* 3: length in unit of fsblksize */
37 unsigned addr1:8; /* 1: address in unit of fsblksize */
38 __le32 addr2; /* 4: address in unit of fsblksize */
39} xad_t; /* (16) */
40
41#define MAXXLEN ((1 << 24) - 1)
42
43#define XTSLOTSIZE 16
44#define L2XTSLOTSIZE 4
45
46/* xad_t field construction */
47#define XADoffset(xad, offset64)\
48{\
49 (xad)->off1 = ((u64)offset64) >> 32;\
50 (xad)->off2 = __cpu_to_le32((offset64) & 0xffffffff);\
51}
52#define XADaddress(xad, address64)\
53{\
54 (xad)->addr1 = ((u64)address64) >> 32;\
55 (xad)->addr2 = __cpu_to_le32((address64) & 0xffffffff);\
56}
57#define XADlength(xad, length32) (xad)->len = __cpu_to_le24(length32)
58
59/* xad_t field extraction */
60#define offsetXAD(xad)\
61 ( ((s64)((xad)->off1)) << 32 | __le32_to_cpu((xad)->off2))
62#define addressXAD(xad)\
63 ( ((s64)((xad)->addr1)) << 32 | __le32_to_cpu((xad)->addr2))
64#define lengthXAD(xad) __le24_to_cpu((xad)->len)
65
66/* xad list */
67struct xadlist {
68 s16 maxnxad;
69 s16 nxad;
70 xad_t *xad;
71};
72
73/* xad_t flags */
74#define XAD_NEW 0x01 /* new */
75#define XAD_EXTENDED 0x02 /* extended */
76#define XAD_COMPRESSED 0x04 /* compressed with recorded length */
77#define XAD_NOTRECORDED 0x08 /* allocated but not recorded */
78#define XAD_COW 0x10 /* copy-on-write */
79
80
81/* possible values for maxentry */
82#define XTROOTINITSLOT_DIR 6
83#define XTROOTINITSLOT 10
84#define XTROOTMAXSLOT 18
85#define XTPAGEMAXSLOT 256
86#define XTENTRYSTART 2
87
88/*
89 * xtree page:
90 */
91typedef union {
92 struct xtheader {
93 __le64 next; /* 8: */
94 __le64 prev; /* 8: */
95
96 u8 flag; /* 1: */
97 u8 rsrvd1; /* 1: */
98 __le16 nextindex; /* 2: next index = number of entries */
99 __le16 maxentry; /* 2: max number of entries */
100 __le16 rsrvd2; /* 2: */
101
102 pxd_t self; /* 8: self */
103 } header; /* (32) */
104
105 xad_t xad[XTROOTMAXSLOT]; /* 16 * maxentry: xad array */
106} xtpage_t;
107
108/*
109 * external declaration
110 */
111extern int xtLookup(struct inode *ip, s64 lstart, s64 llen,
112 int *pflag, s64 * paddr, int *plen, int flag);
113extern int xtLookupList(struct inode *ip, struct lxdlist * lxdlist,
114 struct xadlist * xadlist, int flag);
115extern void xtInitRoot(tid_t tid, struct inode *ip);
116extern int xtInsert(tid_t tid, struct inode *ip,
117 int xflag, s64 xoff, int xlen, s64 * xaddrp, int flag);
118extern int xtExtend(tid_t tid, struct inode *ip, s64 xoff, int xlen,
119 int flag);
120#ifdef _NOTYET
121extern int xtTailgate(tid_t tid, struct inode *ip,
122 s64 xoff, int xlen, s64 xaddr, int flag);
123#endif
124extern int xtUpdate(tid_t tid, struct inode *ip, struct xad *nxad);
125extern int xtDelete(tid_t tid, struct inode *ip, s64 xoff, int xlen,
126 int flag);
127extern s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int type);
128extern s64 xtTruncate_pmap(tid_t tid, struct inode *ip, s64 committed_size);
129extern int xtRelocate(tid_t tid, struct inode *ip,
130 xad_t * oxad, s64 nxaddr, int xtype);
131extern int xtAppend(tid_t tid,
132 struct inode *ip, int xflag, s64 xoff, int maxblocks,
133 int *xlenp, s64 * xaddrp, int flag);
134
135#ifdef _JFS_DEBUG_XTREE
136extern int xtDisplayTree(struct inode *ip);
137extern int xtDisplayPage(struct inode *ip, s64 bn, xtpage_t * p);
138#endif /* _JFS_DEBUG_XTREE */
139
140#endif /* !_H_JFS_XTREE */