diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/reiserfs_acl.h | 52 | ||||
-rw-r--r-- | include/linux/reiserfs_fs.h | 1595 | ||||
-rw-r--r-- | include/linux/reiserfs_fs_i.h | 59 | ||||
-rw-r--r-- | include/linux/reiserfs_fs_sb.h | 616 | ||||
-rw-r--r-- | include/linux/reiserfs_xattr.h | 126 |
5 files changed, 1207 insertions, 1241 deletions
diff --git a/include/linux/reiserfs_acl.h b/include/linux/reiserfs_acl.h index 0760507a545b..0a3605099c44 100644 --- a/include/linux/reiserfs_acl.h +++ b/include/linux/reiserfs_acl.h | |||
@@ -4,29 +4,29 @@ | |||
4 | #define REISERFS_ACL_VERSION 0x0001 | 4 | #define REISERFS_ACL_VERSION 0x0001 |
5 | 5 | ||
6 | typedef struct { | 6 | typedef struct { |
7 | __le16 e_tag; | 7 | __le16 e_tag; |
8 | __le16 e_perm; | 8 | __le16 e_perm; |
9 | __le32 e_id; | 9 | __le32 e_id; |
10 | } reiserfs_acl_entry; | 10 | } reiserfs_acl_entry; |
11 | 11 | ||
12 | typedef struct { | 12 | typedef struct { |
13 | __le16 e_tag; | 13 | __le16 e_tag; |
14 | __le16 e_perm; | 14 | __le16 e_perm; |
15 | } reiserfs_acl_entry_short; | 15 | } reiserfs_acl_entry_short; |
16 | 16 | ||
17 | typedef struct { | 17 | typedef struct { |
18 | __le32 a_version; | 18 | __le32 a_version; |
19 | } reiserfs_acl_header; | 19 | } reiserfs_acl_header; |
20 | 20 | ||
21 | static inline size_t reiserfs_acl_size(int count) | 21 | static inline size_t reiserfs_acl_size(int count) |
22 | { | 22 | { |
23 | if (count <= 4) { | 23 | if (count <= 4) { |
24 | return sizeof(reiserfs_acl_header) + | 24 | return sizeof(reiserfs_acl_header) + |
25 | count * sizeof(reiserfs_acl_entry_short); | 25 | count * sizeof(reiserfs_acl_entry_short); |
26 | } else { | 26 | } else { |
27 | return sizeof(reiserfs_acl_header) + | 27 | return sizeof(reiserfs_acl_header) + |
28 | 4 * sizeof(reiserfs_acl_entry_short) + | 28 | 4 * sizeof(reiserfs_acl_entry_short) + |
29 | (count - 4) * sizeof(reiserfs_acl_entry); | 29 | (count - 4) * sizeof(reiserfs_acl_entry); |
30 | } | 30 | } |
31 | } | 31 | } |
32 | 32 | ||
@@ -46,14 +46,14 @@ static inline int reiserfs_acl_count(size_t size) | |||
46 | } | 46 | } |
47 | } | 47 | } |
48 | 48 | ||
49 | |||
50 | #ifdef CONFIG_REISERFS_FS_POSIX_ACL | 49 | #ifdef CONFIG_REISERFS_FS_POSIX_ACL |
51 | struct posix_acl * reiserfs_get_acl(struct inode *inode, int type); | 50 | struct posix_acl *reiserfs_get_acl(struct inode *inode, int type); |
52 | int reiserfs_acl_chmod (struct inode *inode); | 51 | int reiserfs_acl_chmod(struct inode *inode); |
53 | int reiserfs_inherit_default_acl (struct inode *dir, struct dentry *dentry, struct inode *inode); | 52 | int reiserfs_inherit_default_acl(struct inode *dir, struct dentry *dentry, |
54 | int reiserfs_cache_default_acl (struct inode *dir); | 53 | struct inode *inode); |
55 | extern int reiserfs_xattr_posix_acl_init (void) __init; | 54 | int reiserfs_cache_default_acl(struct inode *dir); |
56 | extern int reiserfs_xattr_posix_acl_exit (void); | 55 | extern int reiserfs_xattr_posix_acl_init(void) __init; |
56 | extern int reiserfs_xattr_posix_acl_exit(void); | ||
57 | extern struct reiserfs_xattr_handler posix_acl_default_handler; | 57 | extern struct reiserfs_xattr_handler posix_acl_default_handler; |
58 | extern struct reiserfs_xattr_handler posix_acl_access_handler; | 58 | extern struct reiserfs_xattr_handler posix_acl_access_handler; |
59 | #else | 59 | #else |
@@ -61,28 +61,26 @@ extern struct reiserfs_xattr_handler posix_acl_access_handler; | |||
61 | #define reiserfs_get_acl NULL | 61 | #define reiserfs_get_acl NULL |
62 | #define reiserfs_cache_default_acl(inode) 0 | 62 | #define reiserfs_cache_default_acl(inode) 0 |
63 | 63 | ||
64 | static inline int | 64 | static inline int reiserfs_xattr_posix_acl_init(void) |
65 | reiserfs_xattr_posix_acl_init (void) | ||
66 | { | 65 | { |
67 | return 0; | 66 | return 0; |
68 | } | 67 | } |
69 | 68 | ||
70 | static inline int | 69 | static inline int reiserfs_xattr_posix_acl_exit(void) |
71 | reiserfs_xattr_posix_acl_exit (void) | ||
72 | { | 70 | { |
73 | return 0; | 71 | return 0; |
74 | } | 72 | } |
75 | 73 | ||
76 | static inline int | 74 | static inline int reiserfs_acl_chmod(struct inode *inode) |
77 | reiserfs_acl_chmod (struct inode *inode) | ||
78 | { | 75 | { |
79 | return 0; | 76 | return 0; |
80 | } | 77 | } |
81 | 78 | ||
82 | static inline int | 79 | static inline int |
83 | reiserfs_inherit_default_acl (const struct inode *dir, struct dentry *dentry, struct inode *inode) | 80 | reiserfs_inherit_default_acl(const struct inode *dir, struct dentry *dentry, |
81 | struct inode *inode) | ||
84 | { | 82 | { |
85 | return 0; | 83 | return 0; |
86 | } | 84 | } |
87 | 85 | ||
88 | #endif | 86 | #endif |
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index 4c7c5689ad93..17e458e17e2b 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h | |||
@@ -3,11 +3,10 @@ | |||
3 | */ | 3 | */ |
4 | 4 | ||
5 | /* this file has an amazingly stupid | 5 | /* this file has an amazingly stupid |
6 | name, yura please fix it to be | 6 | name, yura please fix it to be |
7 | reiserfs.h, and merge all the rest | 7 | reiserfs.h, and merge all the rest |
8 | of our .h files that are in this | 8 | of our .h files that are in this |
9 | directory into it. */ | 9 | directory into it. */ |
10 | |||
11 | 10 | ||
12 | #ifndef _LINUX_REISER_FS_H | 11 | #ifndef _LINUX_REISER_FS_H |
13 | #define _LINUX_REISER_FS_H | 12 | #define _LINUX_REISER_FS_H |
@@ -74,9 +73,9 @@ | |||
74 | /* debug levels. Right now, CONFIG_REISERFS_CHECK means print all debug | 73 | /* debug levels. Right now, CONFIG_REISERFS_CHECK means print all debug |
75 | ** messages. | 74 | ** messages. |
76 | */ | 75 | */ |
77 | #define REISERFS_DEBUG_CODE 5 /* extra messages to help find/debug errors */ | 76 | #define REISERFS_DEBUG_CODE 5 /* extra messages to help find/debug errors */ |
78 | 77 | ||
79 | void reiserfs_warning (struct super_block *s, const char * fmt, ...); | 78 | void reiserfs_warning(struct super_block *s, const char *fmt, ...); |
80 | /* assertions handling */ | 79 | /* assertions handling */ |
81 | 80 | ||
82 | /** always check a condition and panic if it's false. */ | 81 | /** always check a condition and panic if it's false. */ |
@@ -105,82 +104,78 @@ if( !( cond ) ) \ | |||
105 | * Structure of super block on disk, a version of which in RAM is often accessed as REISERFS_SB(s)->s_rs | 104 | * Structure of super block on disk, a version of which in RAM is often accessed as REISERFS_SB(s)->s_rs |
106 | * the version in RAM is part of a larger structure containing fields never written to disk. | 105 | * the version in RAM is part of a larger structure containing fields never written to disk. |
107 | */ | 106 | */ |
108 | #define UNSET_HASH 0 // read_super will guess about, what hash names | 107 | #define UNSET_HASH 0 // read_super will guess about, what hash names |
109 | // in directories were sorted with | 108 | // in directories were sorted with |
110 | #define TEA_HASH 1 | 109 | #define TEA_HASH 1 |
111 | #define YURA_HASH 2 | 110 | #define YURA_HASH 2 |
112 | #define R5_HASH 3 | 111 | #define R5_HASH 3 |
113 | #define DEFAULT_HASH R5_HASH | 112 | #define DEFAULT_HASH R5_HASH |
114 | 113 | ||
115 | |||
116 | struct journal_params { | 114 | struct journal_params { |
117 | __le32 jp_journal_1st_block; /* where does journal start from on its | 115 | __le32 jp_journal_1st_block; /* where does journal start from on its |
118 | * device */ | 116 | * device */ |
119 | __le32 jp_journal_dev; /* journal device st_rdev */ | 117 | __le32 jp_journal_dev; /* journal device st_rdev */ |
120 | __le32 jp_journal_size; /* size of the journal */ | 118 | __le32 jp_journal_size; /* size of the journal */ |
121 | __le32 jp_journal_trans_max; /* max number of blocks in a transaction. */ | 119 | __le32 jp_journal_trans_max; /* max number of blocks in a transaction. */ |
122 | __le32 jp_journal_magic; /* random value made on fs creation (this | 120 | __le32 jp_journal_magic; /* random value made on fs creation (this |
123 | * was sb_journal_block_count) */ | 121 | * was sb_journal_block_count) */ |
124 | __le32 jp_journal_max_batch; /* max number of blocks to batch into a | 122 | __le32 jp_journal_max_batch; /* max number of blocks to batch into a |
125 | * trans */ | 123 | * trans */ |
126 | __le32 jp_journal_max_commit_age; /* in seconds, how old can an async | 124 | __le32 jp_journal_max_commit_age; /* in seconds, how old can an async |
127 | * commit be */ | 125 | * commit be */ |
128 | __le32 jp_journal_max_trans_age; /* in seconds, how old can a transaction | 126 | __le32 jp_journal_max_trans_age; /* in seconds, how old can a transaction |
129 | * be */ | 127 | * be */ |
130 | }; | 128 | }; |
131 | 129 | ||
132 | /* this is the super from 3.5.X, where X >= 10 */ | 130 | /* this is the super from 3.5.X, where X >= 10 */ |
133 | struct reiserfs_super_block_v1 | 131 | struct reiserfs_super_block_v1 { |
134 | { | 132 | __le32 s_block_count; /* blocks count */ |
135 | __le32 s_block_count; /* blocks count */ | 133 | __le32 s_free_blocks; /* free blocks count */ |
136 | __le32 s_free_blocks; /* free blocks count */ | 134 | __le32 s_root_block; /* root block number */ |
137 | __le32 s_root_block; /* root block number */ | 135 | struct journal_params s_journal; |
138 | struct journal_params s_journal; | 136 | __le16 s_blocksize; /* block size */ |
139 | __le16 s_blocksize; /* block size */ | 137 | __le16 s_oid_maxsize; /* max size of object id array, see |
140 | __le16 s_oid_maxsize; /* max size of object id array, see | 138 | * get_objectid() commentary */ |
141 | * get_objectid() commentary */ | 139 | __le16 s_oid_cursize; /* current size of object id array */ |
142 | __le16 s_oid_cursize; /* current size of object id array */ | 140 | __le16 s_umount_state; /* this is set to 1 when filesystem was |
143 | __le16 s_umount_state; /* this is set to 1 when filesystem was | 141 | * umounted, to 2 - when not */ |
144 | * umounted, to 2 - when not */ | 142 | char s_magic[10]; /* reiserfs magic string indicates that |
145 | char s_magic[10]; /* reiserfs magic string indicates that | 143 | * file system is reiserfs: |
146 | * file system is reiserfs: | 144 | * "ReIsErFs" or "ReIsEr2Fs" or "ReIsEr3Fs" */ |
147 | * "ReIsErFs" or "ReIsEr2Fs" or "ReIsEr3Fs" */ | 145 | __le16 s_fs_state; /* it is set to used by fsck to mark which |
148 | __le16 s_fs_state; /* it is set to used by fsck to mark which | 146 | * phase of rebuilding is done */ |
149 | * phase of rebuilding is done */ | 147 | __le32 s_hash_function_code; /* indicate, what hash function is being use |
150 | __le32 s_hash_function_code; /* indicate, what hash function is being use | 148 | * to sort names in a directory*/ |
151 | * to sort names in a directory*/ | 149 | __le16 s_tree_height; /* height of disk tree */ |
152 | __le16 s_tree_height; /* height of disk tree */ | 150 | __le16 s_bmap_nr; /* amount of bitmap blocks needed to address |
153 | __le16 s_bmap_nr; /* amount of bitmap blocks needed to address | 151 | * each block of file system */ |
154 | * each block of file system */ | 152 | __le16 s_version; /* this field is only reliable on filesystem |
155 | __le16 s_version; /* this field is only reliable on filesystem | 153 | * with non-standard journal */ |
156 | * with non-standard journal */ | 154 | __le16 s_reserved_for_journal; /* size in blocks of journal area on main |
157 | __le16 s_reserved_for_journal; /* size in blocks of journal area on main | 155 | * device, we need to keep after |
158 | * device, we need to keep after | 156 | * making fs with non-standard journal */ |
159 | * making fs with non-standard journal */ | ||
160 | } __attribute__ ((__packed__)); | 157 | } __attribute__ ((__packed__)); |
161 | 158 | ||
162 | #define SB_SIZE_V1 (sizeof(struct reiserfs_super_block_v1)) | 159 | #define SB_SIZE_V1 (sizeof(struct reiserfs_super_block_v1)) |
163 | 160 | ||
164 | /* this is the on disk super block */ | 161 | /* this is the on disk super block */ |
165 | struct reiserfs_super_block | 162 | struct reiserfs_super_block { |
166 | { | 163 | struct reiserfs_super_block_v1 s_v1; |
167 | struct reiserfs_super_block_v1 s_v1; | 164 | __le32 s_inode_generation; |
168 | __le32 s_inode_generation; | 165 | __le32 s_flags; /* Right now used only by inode-attributes, if enabled */ |
169 | __le32 s_flags; /* Right now used only by inode-attributes, if enabled */ | 166 | unsigned char s_uuid[16]; /* filesystem unique identifier */ |
170 | unsigned char s_uuid[16]; /* filesystem unique identifier */ | 167 | unsigned char s_label[16]; /* filesystem volume label */ |
171 | unsigned char s_label[16]; /* filesystem volume label */ | 168 | char s_unused[88]; /* zero filled by mkreiserfs and |
172 | char s_unused[88] ; /* zero filled by mkreiserfs and | 169 | * reiserfs_convert_objectid_map_v1() |
173 | * reiserfs_convert_objectid_map_v1() | 170 | * so any additions must be updated |
174 | * so any additions must be updated | 171 | * there as well. */ |
175 | * there as well. */ | 172 | } __attribute__ ((__packed__)); |
176 | } __attribute__ ((__packed__)); | ||
177 | 173 | ||
178 | #define SB_SIZE (sizeof(struct reiserfs_super_block)) | 174 | #define SB_SIZE (sizeof(struct reiserfs_super_block)) |
179 | 175 | ||
180 | #define REISERFS_VERSION_1 0 | 176 | #define REISERFS_VERSION_1 0 |
181 | #define REISERFS_VERSION_2 2 | 177 | #define REISERFS_VERSION_2 2 |
182 | 178 | ||
183 | |||
184 | // on-disk super block fields converted to cpu form | 179 | // on-disk super block fields converted to cpu form |
185 | #define SB_DISK_SUPER_BLOCK(s) (REISERFS_SB(s)->s_rs) | 180 | #define SB_DISK_SUPER_BLOCK(s) (REISERFS_SB(s)->s_rs) |
186 | #define SB_V1_DISK_SUPER_BLOCK(s) (&(SB_DISK_SUPER_BLOCK(s)->s_v1)) | 181 | #define SB_V1_DISK_SUPER_BLOCK(s) (&(SB_DISK_SUPER_BLOCK(s)->s_v1)) |
@@ -210,13 +205,12 @@ struct reiserfs_super_block | |||
210 | #define PUT_SB_TREE_HEIGHT(s, val) \ | 205 | #define PUT_SB_TREE_HEIGHT(s, val) \ |
211 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_tree_height = cpu_to_le16(val); } while (0) | 206 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_tree_height = cpu_to_le16(val); } while (0) |
212 | #define PUT_SB_REISERFS_STATE(s, val) \ | 207 | #define PUT_SB_REISERFS_STATE(s, val) \ |
213 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_umount_state = cpu_to_le16(val); } while (0) | 208 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_umount_state = cpu_to_le16(val); } while (0) |
214 | #define PUT_SB_VERSION(s, val) \ | 209 | #define PUT_SB_VERSION(s, val) \ |
215 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_version = cpu_to_le16(val); } while (0) | 210 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_version = cpu_to_le16(val); } while (0) |
216 | #define PUT_SB_BMAP_NR(s, val) \ | 211 | #define PUT_SB_BMAP_NR(s, val) \ |
217 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_bmap_nr = cpu_to_le16 (val); } while (0) | 212 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_bmap_nr = cpu_to_le16 (val); } while (0) |
218 | 213 | ||
219 | |||
220 | #define SB_ONDISK_JP(s) (&SB_V1_DISK_SUPER_BLOCK(s)->s_journal) | 214 | #define SB_ONDISK_JP(s) (&SB_V1_DISK_SUPER_BLOCK(s)->s_journal) |
221 | #define SB_ONDISK_JOURNAL_SIZE(s) \ | 215 | #define SB_ONDISK_JOURNAL_SIZE(s) \ |
222 | le32_to_cpu ((SB_ONDISK_JP(s)->jp_journal_size)) | 216 | le32_to_cpu ((SB_ONDISK_JP(s)->jp_journal_size)) |
@@ -231,21 +225,19 @@ struct reiserfs_super_block | |||
231 | block >= SB_JOURNAL_1st_RESERVED_BLOCK(s) \ | 225 | block >= SB_JOURNAL_1st_RESERVED_BLOCK(s) \ |
232 | && block < SB_JOURNAL_1st_RESERVED_BLOCK(s) + \ | 226 | && block < SB_JOURNAL_1st_RESERVED_BLOCK(s) + \ |
233 | ((!is_reiserfs_jr(SB_DISK_SUPER_BLOCK(s)) ? \ | 227 | ((!is_reiserfs_jr(SB_DISK_SUPER_BLOCK(s)) ? \ |
234 | SB_ONDISK_JOURNAL_SIZE(s) + 1 : SB_ONDISK_RESERVED_FOR_JOURNAL(s))) | 228 | SB_ONDISK_JOURNAL_SIZE(s) + 1 : SB_ONDISK_RESERVED_FOR_JOURNAL(s))) |
235 | |||
236 | |||
237 | 229 | ||
238 | /* used by gcc */ | 230 | /* used by gcc */ |
239 | #define REISERFS_SUPER_MAGIC 0x52654973 | 231 | #define REISERFS_SUPER_MAGIC 0x52654973 |
240 | /* used by file system utilities that | 232 | /* used by file system utilities that |
241 | look at the superblock, etc. */ | 233 | look at the superblock, etc. */ |
242 | #define REISERFS_SUPER_MAGIC_STRING "ReIsErFs" | 234 | #define REISERFS_SUPER_MAGIC_STRING "ReIsErFs" |
243 | #define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" | 235 | #define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" |
244 | #define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" | 236 | #define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" |
245 | 237 | ||
246 | int is_reiserfs_3_5 (struct reiserfs_super_block * rs); | 238 | int is_reiserfs_3_5(struct reiserfs_super_block *rs); |
247 | int is_reiserfs_3_6 (struct reiserfs_super_block * rs); | 239 | int is_reiserfs_3_6(struct reiserfs_super_block *rs); |
248 | int is_reiserfs_jr (struct reiserfs_super_block * rs); | 240 | int is_reiserfs_jr(struct reiserfs_super_block *rs); |
249 | 241 | ||
250 | /* ReiserFS leaves the first 64k unused, so that partition labels have | 242 | /* ReiserFS leaves the first 64k unused, so that partition labels have |
251 | enough space. If someone wants to write a fancy bootloader that | 243 | enough space. If someone wants to write a fancy bootloader that |
@@ -272,8 +264,8 @@ typedef __u32 b_blocknr_t; | |||
272 | typedef __le32 unp_t; | 264 | typedef __le32 unp_t; |
273 | 265 | ||
274 | struct unfm_nodeinfo { | 266 | struct unfm_nodeinfo { |
275 | unp_t unfm_nodenum; | 267 | unp_t unfm_nodenum; |
276 | unsigned short unfm_freespace; | 268 | unsigned short unfm_freespace; |
277 | }; | 269 | }; |
278 | 270 | ||
279 | /* there are two formats of keys: 3.5 and 3.6 | 271 | /* there are two formats of keys: 3.5 and 3.6 |
@@ -285,7 +277,6 @@ struct unfm_nodeinfo { | |||
285 | #define STAT_DATA_V1 0 | 277 | #define STAT_DATA_V1 0 |
286 | #define STAT_DATA_V2 1 | 278 | #define STAT_DATA_V2 1 |
287 | 279 | ||
288 | |||
289 | static inline struct reiserfs_inode_info *REISERFS_I(const struct inode *inode) | 280 | static inline struct reiserfs_inode_info *REISERFS_I(const struct inode *inode) |
290 | { | 281 | { |
291 | return container_of(inode, struct reiserfs_inode_info, vfs_inode); | 282 | return container_of(inode, struct reiserfs_inode_info, vfs_inode); |
@@ -343,15 +334,13 @@ static inline struct reiserfs_sb_info *REISERFS_SB(const struct super_block *sb) | |||
343 | file would fit into one DIRECT item. | 334 | file would fit into one DIRECT item. |
344 | Primary intention for this one is to increase performance by decreasing | 335 | Primary intention for this one is to increase performance by decreasing |
345 | seeking. | 336 | seeking. |
346 | */ | 337 | */ |
347 | #define STORE_TAIL_IN_UNFM_S2(n_file_size,n_tail_size,n_block_size) \ | 338 | #define STORE_TAIL_IN_UNFM_S2(n_file_size,n_tail_size,n_block_size) \ |
348 | (\ | 339 | (\ |
349 | (!(n_tail_size)) || \ | 340 | (!(n_tail_size)) || \ |
350 | (((n_file_size) > MAX_DIRECT_ITEM_LEN(n_block_size)) ) \ | 341 | (((n_file_size) > MAX_DIRECT_ITEM_LEN(n_block_size)) ) \ |
351 | ) | 342 | ) |
352 | 343 | ||
353 | |||
354 | |||
355 | /* | 344 | /* |
356 | * values for s_umount_state field | 345 | * values for s_umount_state field |
357 | */ | 346 | */ |
@@ -364,9 +353,9 @@ static inline struct reiserfs_sb_info *REISERFS_SB(const struct super_block *sb) | |||
364 | #define TYPE_STAT_DATA 0 | 353 | #define TYPE_STAT_DATA 0 |
365 | #define TYPE_INDIRECT 1 | 354 | #define TYPE_INDIRECT 1 |
366 | #define TYPE_DIRECT 2 | 355 | #define TYPE_DIRECT 2 |
367 | #define TYPE_DIRENTRY 3 | 356 | #define TYPE_DIRENTRY 3 |
368 | #define TYPE_MAXTYPE 3 | 357 | #define TYPE_MAXTYPE 3 |
369 | #define TYPE_ANY 15 // FIXME: comment is required | 358 | #define TYPE_ANY 15 // FIXME: comment is required |
370 | 359 | ||
371 | /***************************************************************************/ | 360 | /***************************************************************************/ |
372 | /* KEY & ITEM HEAD */ | 361 | /* KEY & ITEM HEAD */ |
@@ -376,60 +365,62 @@ static inline struct reiserfs_sb_info *REISERFS_SB(const struct super_block *sb) | |||
376 | // directories use this key as well as old files | 365 | // directories use this key as well as old files |
377 | // | 366 | // |
378 | struct offset_v1 { | 367 | struct offset_v1 { |
379 | __le32 k_offset; | 368 | __le32 k_offset; |
380 | __le32 k_uniqueness; | 369 | __le32 k_uniqueness; |
381 | } __attribute__ ((__packed__)); | 370 | } __attribute__ ((__packed__)); |
382 | 371 | ||
383 | struct offset_v2 { | 372 | struct offset_v2 { |
384 | __le64 v; | 373 | __le64 v; |
385 | } __attribute__ ((__packed__)); | 374 | } __attribute__ ((__packed__)); |
386 | 375 | ||
387 | static inline __u16 offset_v2_k_type( const struct offset_v2 *v2 ) | 376 | static inline __u16 offset_v2_k_type(const struct offset_v2 *v2) |
388 | { | 377 | { |
389 | __u8 type = le64_to_cpu(v2->v) >> 60; | 378 | __u8 type = le64_to_cpu(v2->v) >> 60; |
390 | return (type <= TYPE_MAXTYPE)?type:TYPE_ANY; | 379 | return (type <= TYPE_MAXTYPE) ? type : TYPE_ANY; |
391 | } | 380 | } |
392 | 381 | ||
393 | static inline void set_offset_v2_k_type( struct offset_v2 *v2, int type ) | 382 | static inline void set_offset_v2_k_type(struct offset_v2 *v2, int type) |
394 | { | 383 | { |
395 | v2->v = (v2->v & cpu_to_le64(~0ULL>>4)) | cpu_to_le64((__u64)type<<60); | 384 | v2->v = |
385 | (v2->v & cpu_to_le64(~0ULL >> 4)) | cpu_to_le64((__u64) type << 60); | ||
396 | } | 386 | } |
397 | 387 | ||
398 | static inline loff_t offset_v2_k_offset( const struct offset_v2 *v2 ) | 388 | static inline loff_t offset_v2_k_offset(const struct offset_v2 *v2) |
399 | { | 389 | { |
400 | return le64_to_cpu(v2->v) & (~0ULL>>4); | 390 | return le64_to_cpu(v2->v) & (~0ULL >> 4); |
401 | } | 391 | } |
402 | 392 | ||
403 | static inline void set_offset_v2_k_offset( struct offset_v2 *v2, loff_t offset ){ | 393 | static inline void set_offset_v2_k_offset(struct offset_v2 *v2, loff_t offset) |
404 | offset &= (~0ULL>>4); | 394 | { |
405 | v2->v = (v2->v & cpu_to_le64(15ULL<<60)) | cpu_to_le64(offset); | 395 | offset &= (~0ULL >> 4); |
396 | v2->v = (v2->v & cpu_to_le64(15ULL << 60)) | cpu_to_le64(offset); | ||
406 | } | 397 | } |
407 | 398 | ||
408 | /* Key of an item determines its location in the S+tree, and | 399 | /* Key of an item determines its location in the S+tree, and |
409 | is composed of 4 components */ | 400 | is composed of 4 components */ |
410 | struct reiserfs_key { | 401 | struct reiserfs_key { |
411 | __le32 k_dir_id; /* packing locality: by default parent | 402 | __le32 k_dir_id; /* packing locality: by default parent |
412 | directory object id */ | 403 | directory object id */ |
413 | __le32 k_objectid; /* object identifier */ | 404 | __le32 k_objectid; /* object identifier */ |
414 | union { | 405 | union { |
415 | struct offset_v1 k_offset_v1; | 406 | struct offset_v1 k_offset_v1; |
416 | struct offset_v2 k_offset_v2; | 407 | struct offset_v2 k_offset_v2; |
417 | } __attribute__ ((__packed__)) u; | 408 | } __attribute__ ((__packed__)) u; |
418 | } __attribute__ ((__packed__)); | 409 | } __attribute__ ((__packed__)); |
419 | 410 | ||
420 | struct in_core_key { | 411 | struct in_core_key { |
421 | __u32 k_dir_id; /* packing locality: by default parent | 412 | __u32 k_dir_id; /* packing locality: by default parent |
422 | directory object id */ | 413 | directory object id */ |
423 | __u32 k_objectid; /* object identifier */ | 414 | __u32 k_objectid; /* object identifier */ |
424 | __u64 k_offset; | 415 | __u64 k_offset; |
425 | __u8 k_type; | 416 | __u8 k_type; |
426 | }; | 417 | }; |
427 | 418 | ||
428 | struct cpu_key { | 419 | struct cpu_key { |
429 | struct in_core_key on_disk_key; | 420 | struct in_core_key on_disk_key; |
430 | int version; | 421 | int version; |
431 | int key_length; /* 3 in all cases but direct2indirect and | 422 | int key_length; /* 3 in all cases but direct2indirect and |
432 | indirect2direct conversion */ | 423 | indirect2direct conversion */ |
433 | }; | 424 | }; |
434 | 425 | ||
435 | /* Our function for comparing keys can compare keys of different | 426 | /* Our function for comparing keys can compare keys of different |
@@ -475,8 +466,7 @@ struct cpu_key { | |||
475 | indirect items) and specifies the location of the item itself | 466 | indirect items) and specifies the location of the item itself |
476 | within the block. */ | 467 | within the block. */ |
477 | 468 | ||
478 | struct item_head | 469 | struct item_head { |
479 | { | ||
480 | /* Everything in the tree is found by searching for it based on | 470 | /* Everything in the tree is found by searching for it based on |
481 | * its key.*/ | 471 | * its key.*/ |
482 | struct reiserfs_key ih_key; | 472 | struct reiserfs_key ih_key; |
@@ -492,13 +482,13 @@ struct item_head | |||
492 | number of directory entries in the directory item. */ | 482 | number of directory entries in the directory item. */ |
493 | __le16 ih_entry_count; | 483 | __le16 ih_entry_count; |
494 | } __attribute__ ((__packed__)) u; | 484 | } __attribute__ ((__packed__)) u; |
495 | __le16 ih_item_len; /* total size of the item body */ | 485 | __le16 ih_item_len; /* total size of the item body */ |
496 | __le16 ih_item_location; /* an offset to the item body | 486 | __le16 ih_item_location; /* an offset to the item body |
497 | * within the block */ | 487 | * within the block */ |
498 | __le16 ih_version; /* 0 for all old items, 2 for new | 488 | __le16 ih_version; /* 0 for all old items, 2 for new |
499 | ones. Highest bit is set by fsck | 489 | ones. Highest bit is set by fsck |
500 | temporary, cleaned after all | 490 | temporary, cleaned after all |
501 | done */ | 491 | done */ |
502 | } __attribute__ ((__packed__)); | 492 | } __attribute__ ((__packed__)); |
503 | /* size of item header */ | 493 | /* size of item header */ |
504 | #define IH_SIZE (sizeof(struct item_head)) | 494 | #define IH_SIZE (sizeof(struct item_head)) |
@@ -515,7 +505,6 @@ struct item_head | |||
515 | #define put_ih_location(ih, val) do { (ih)->ih_item_location = cpu_to_le16(val); } while (0) | 505 | #define put_ih_location(ih, val) do { (ih)->ih_item_location = cpu_to_le16(val); } while (0) |
516 | #define put_ih_item_len(ih, val) do { (ih)->ih_item_len = cpu_to_le16(val); } while (0) | 506 | #define put_ih_item_len(ih, val) do { (ih)->ih_item_len = cpu_to_le16(val); } while (0) |
517 | 507 | ||
518 | |||
519 | #define unreachable_item(ih) (ih_version(ih) & (1 << 15)) | 508 | #define unreachable_item(ih) (ih_version(ih) & (1 << 15)) |
520 | 509 | ||
521 | #define get_ih_free_space(ih) (ih_version (ih) == KEY_FORMAT_3_6 ? 0 : ih_free_space (ih)) | 510 | #define get_ih_free_space(ih) (ih_version (ih) == KEY_FORMAT_3_6 ? 0 : ih_free_space (ih)) |
@@ -537,40 +526,48 @@ struct item_head | |||
537 | #define V1_INDIRECT_UNIQUENESS 0xfffffffe | 526 | #define V1_INDIRECT_UNIQUENESS 0xfffffffe |
538 | #define V1_DIRECT_UNIQUENESS 0xffffffff | 527 | #define V1_DIRECT_UNIQUENESS 0xffffffff |
539 | #define V1_DIRENTRY_UNIQUENESS 500 | 528 | #define V1_DIRENTRY_UNIQUENESS 500 |
540 | #define V1_ANY_UNIQUENESS 555 // FIXME: comment is required | 529 | #define V1_ANY_UNIQUENESS 555 // FIXME: comment is required |
541 | 530 | ||
542 | // | 531 | // |
543 | // here are conversion routines | 532 | // here are conversion routines |
544 | // | 533 | // |
545 | static inline int uniqueness2type (__u32 uniqueness) CONSTF; | 534 | static inline int uniqueness2type(__u32 uniqueness) CONSTF; |
546 | static inline int uniqueness2type (__u32 uniqueness) | 535 | static inline int uniqueness2type(__u32 uniqueness) |
547 | { | 536 | { |
548 | switch ((int)uniqueness) { | 537 | switch ((int)uniqueness) { |
549 | case V1_SD_UNIQUENESS: return TYPE_STAT_DATA; | 538 | case V1_SD_UNIQUENESS: |
550 | case V1_INDIRECT_UNIQUENESS: return TYPE_INDIRECT; | 539 | return TYPE_STAT_DATA; |
551 | case V1_DIRECT_UNIQUENESS: return TYPE_DIRECT; | 540 | case V1_INDIRECT_UNIQUENESS: |
552 | case V1_DIRENTRY_UNIQUENESS: return TYPE_DIRENTRY; | 541 | return TYPE_INDIRECT; |
553 | default: | 542 | case V1_DIRECT_UNIQUENESS: |
554 | reiserfs_warning (NULL, "vs-500: unknown uniqueness %d", | 543 | return TYPE_DIRECT; |
555 | uniqueness); | 544 | case V1_DIRENTRY_UNIQUENESS: |
545 | return TYPE_DIRENTRY; | ||
546 | default: | ||
547 | reiserfs_warning(NULL, "vs-500: unknown uniqueness %d", | ||
548 | uniqueness); | ||
556 | case V1_ANY_UNIQUENESS: | 549 | case V1_ANY_UNIQUENESS: |
557 | return TYPE_ANY; | 550 | return TYPE_ANY; |
558 | } | 551 | } |
559 | } | 552 | } |
560 | 553 | ||
561 | static inline __u32 type2uniqueness (int type) CONSTF; | 554 | static inline __u32 type2uniqueness(int type) CONSTF; |
562 | static inline __u32 type2uniqueness (int type) | 555 | static inline __u32 type2uniqueness(int type) |
563 | { | 556 | { |
564 | switch (type) { | 557 | switch (type) { |
565 | case TYPE_STAT_DATA: return V1_SD_UNIQUENESS; | 558 | case TYPE_STAT_DATA: |
566 | case TYPE_INDIRECT: return V1_INDIRECT_UNIQUENESS; | 559 | return V1_SD_UNIQUENESS; |
567 | case TYPE_DIRECT: return V1_DIRECT_UNIQUENESS; | 560 | case TYPE_INDIRECT: |
568 | case TYPE_DIRENTRY: return V1_DIRENTRY_UNIQUENESS; | 561 | return V1_INDIRECT_UNIQUENESS; |
569 | default: | 562 | case TYPE_DIRECT: |
570 | reiserfs_warning (NULL, "vs-501: unknown type %d", type); | 563 | return V1_DIRECT_UNIQUENESS; |
564 | case TYPE_DIRENTRY: | ||
565 | return V1_DIRENTRY_UNIQUENESS; | ||
566 | default: | ||
567 | reiserfs_warning(NULL, "vs-501: unknown type %d", type); | ||
571 | case TYPE_ANY: | 568 | case TYPE_ANY: |
572 | return V1_ANY_UNIQUENESS; | 569 | return V1_ANY_UNIQUENESS; |
573 | } | 570 | } |
574 | } | 571 | } |
575 | 572 | ||
576 | // | 573 | // |
@@ -578,57 +575,56 @@ static inline __u32 type2uniqueness (int type) | |||
578 | // there is no way to get version of object from key, so, provide | 575 | // there is no way to get version of object from key, so, provide |
579 | // version to these defines | 576 | // version to these defines |
580 | // | 577 | // |
581 | static inline loff_t le_key_k_offset (int version, const struct reiserfs_key * key) | 578 | static inline loff_t le_key_k_offset(int version, |
579 | const struct reiserfs_key *key) | ||
582 | { | 580 | { |
583 | return (version == KEY_FORMAT_3_5) ? | 581 | return (version == KEY_FORMAT_3_5) ? |
584 | le32_to_cpu( key->u.k_offset_v1.k_offset ) : | 582 | le32_to_cpu(key->u.k_offset_v1.k_offset) : |
585 | offset_v2_k_offset( &(key->u.k_offset_v2) ); | 583 | offset_v2_k_offset(&(key->u.k_offset_v2)); |
586 | } | 584 | } |
587 | 585 | ||
588 | static inline loff_t le_ih_k_offset (const struct item_head * ih) | 586 | static inline loff_t le_ih_k_offset(const struct item_head *ih) |
589 | { | 587 | { |
590 | return le_key_k_offset (ih_version (ih), &(ih->ih_key)); | 588 | return le_key_k_offset(ih_version(ih), &(ih->ih_key)); |
591 | } | 589 | } |
592 | 590 | ||
593 | static inline loff_t le_key_k_type (int version, const struct reiserfs_key * key) | 591 | static inline loff_t le_key_k_type(int version, const struct reiserfs_key *key) |
594 | { | 592 | { |
595 | return (version == KEY_FORMAT_3_5) ? | 593 | return (version == KEY_FORMAT_3_5) ? |
596 | uniqueness2type( le32_to_cpu( key->u.k_offset_v1.k_uniqueness)) : | 594 | uniqueness2type(le32_to_cpu(key->u.k_offset_v1.k_uniqueness)) : |
597 | offset_v2_k_type( &(key->u.k_offset_v2) ); | 595 | offset_v2_k_type(&(key->u.k_offset_v2)); |
598 | } | 596 | } |
599 | 597 | ||
600 | static inline loff_t le_ih_k_type (const struct item_head * ih) | 598 | static inline loff_t le_ih_k_type(const struct item_head *ih) |
601 | { | 599 | { |
602 | return le_key_k_type (ih_version (ih), &(ih->ih_key)); | 600 | return le_key_k_type(ih_version(ih), &(ih->ih_key)); |
603 | } | 601 | } |
604 | 602 | ||
605 | 603 | static inline void set_le_key_k_offset(int version, struct reiserfs_key *key, | |
606 | static inline void set_le_key_k_offset (int version, struct reiserfs_key * key, loff_t offset) | 604 | loff_t offset) |
607 | { | 605 | { |
608 | (version == KEY_FORMAT_3_5) ? | 606 | (version == KEY_FORMAT_3_5) ? (void)(key->u.k_offset_v1.k_offset = cpu_to_le32(offset)) : /* jdm check */ |
609 | (void)(key->u.k_offset_v1.k_offset = cpu_to_le32 (offset)) : /* jdm check */ | 607 | (void)(set_offset_v2_k_offset(&(key->u.k_offset_v2), offset)); |
610 | (void)(set_offset_v2_k_offset( &(key->u.k_offset_v2), offset )); | ||
611 | } | 608 | } |
612 | 609 | ||
613 | 610 | static inline void set_le_ih_k_offset(struct item_head *ih, loff_t offset) | |
614 | static inline void set_le_ih_k_offset (struct item_head * ih, loff_t offset) | ||
615 | { | 611 | { |
616 | set_le_key_k_offset (ih_version (ih), &(ih->ih_key), offset); | 612 | set_le_key_k_offset(ih_version(ih), &(ih->ih_key), offset); |
617 | } | 613 | } |
618 | 614 | ||
619 | 615 | static inline void set_le_key_k_type(int version, struct reiserfs_key *key, | |
620 | static inline void set_le_key_k_type (int version, struct reiserfs_key * key, int type) | 616 | int type) |
621 | { | 617 | { |
622 | (version == KEY_FORMAT_3_5) ? | 618 | (version == KEY_FORMAT_3_5) ? |
623 | (void)(key->u.k_offset_v1.k_uniqueness = cpu_to_le32(type2uniqueness(type))): | 619 | (void)(key->u.k_offset_v1.k_uniqueness = |
624 | (void)(set_offset_v2_k_type( &(key->u.k_offset_v2), type )); | 620 | cpu_to_le32(type2uniqueness(type))) |
621 | : (void)(set_offset_v2_k_type(&(key->u.k_offset_v2), type)); | ||
625 | } | 622 | } |
626 | static inline void set_le_ih_k_type (struct item_head * ih, int type) | 623 | static inline void set_le_ih_k_type(struct item_head *ih, int type) |
627 | { | 624 | { |
628 | set_le_key_k_type (ih_version (ih), &(ih->ih_key), type); | 625 | set_le_key_k_type(ih_version(ih), &(ih->ih_key), type); |
629 | } | 626 | } |
630 | 627 | ||
631 | |||
632 | #define is_direntry_le_key(version,key) (le_key_k_type (version, key) == TYPE_DIRENTRY) | 628 | #define is_direntry_le_key(version,key) (le_key_k_type (version, key) == TYPE_DIRENTRY) |
633 | #define is_direct_le_key(version,key) (le_key_k_type (version, key) == TYPE_DIRECT) | 629 | #define is_direct_le_key(version,key) (le_key_k_type (version, key) == TYPE_DIRECT) |
634 | #define is_indirect_le_key(version,key) (le_key_k_type (version, key) == TYPE_INDIRECT) | 630 | #define is_indirect_le_key(version,key) (le_key_k_type (version, key) == TYPE_INDIRECT) |
@@ -642,34 +638,32 @@ static inline void set_le_ih_k_type (struct item_head * ih, int type) | |||
642 | #define is_indirect_le_ih(ih) is_indirect_le_key (ih_version(ih), &((ih)->ih_key)) | 638 | #define is_indirect_le_ih(ih) is_indirect_le_key (ih_version(ih), &((ih)->ih_key)) |
643 | #define is_statdata_le_ih(ih) is_statdata_le_key (ih_version (ih), &((ih)->ih_key)) | 639 | #define is_statdata_le_ih(ih) is_statdata_le_key (ih_version (ih), &((ih)->ih_key)) |
644 | 640 | ||
645 | |||
646 | |||
647 | // | 641 | // |
648 | // key is pointer to cpu key, result is cpu | 642 | // key is pointer to cpu key, result is cpu |
649 | // | 643 | // |
650 | static inline loff_t cpu_key_k_offset (const struct cpu_key * key) | 644 | static inline loff_t cpu_key_k_offset(const struct cpu_key *key) |
651 | { | 645 | { |
652 | return key->on_disk_key.k_offset; | 646 | return key->on_disk_key.k_offset; |
653 | } | 647 | } |
654 | 648 | ||
655 | static inline loff_t cpu_key_k_type (const struct cpu_key * key) | 649 | static inline loff_t cpu_key_k_type(const struct cpu_key *key) |
656 | { | 650 | { |
657 | return key->on_disk_key.k_type; | 651 | return key->on_disk_key.k_type; |
658 | } | 652 | } |
659 | 653 | ||
660 | static inline void set_cpu_key_k_offset (struct cpu_key * key, loff_t offset) | 654 | static inline void set_cpu_key_k_offset(struct cpu_key *key, loff_t offset) |
661 | { | 655 | { |
662 | key->on_disk_key.k_offset = offset; | 656 | key->on_disk_key.k_offset = offset; |
663 | } | 657 | } |
664 | 658 | ||
665 | static inline void set_cpu_key_k_type (struct cpu_key * key, int type) | 659 | static inline void set_cpu_key_k_type(struct cpu_key *key, int type) |
666 | { | 660 | { |
667 | key->on_disk_key.k_type = type; | 661 | key->on_disk_key.k_type = type; |
668 | } | 662 | } |
669 | 663 | ||
670 | static inline void cpu_key_k_offset_dec (struct cpu_key * key) | 664 | static inline void cpu_key_k_offset_dec(struct cpu_key *key) |
671 | { | 665 | { |
672 | key->on_disk_key.k_offset --; | 666 | key->on_disk_key.k_offset--; |
673 | } | 667 | } |
674 | 668 | ||
675 | #define is_direntry_cpu_key(key) (cpu_key_k_type (key) == TYPE_DIRENTRY) | 669 | #define is_direntry_cpu_key(key) (cpu_key_k_type (key) == TYPE_DIRENTRY) |
@@ -677,34 +671,25 @@ static inline void cpu_key_k_offset_dec (struct cpu_key * key) | |||
677 | #define is_indirect_cpu_key(key) (cpu_key_k_type (key) == TYPE_INDIRECT) | 671 | #define is_indirect_cpu_key(key) (cpu_key_k_type (key) == TYPE_INDIRECT) |
678 | #define is_statdata_cpu_key(key) (cpu_key_k_type (key) == TYPE_STAT_DATA) | 672 | #define is_statdata_cpu_key(key) (cpu_key_k_type (key) == TYPE_STAT_DATA) |
679 | 673 | ||
680 | |||
681 | /* are these used ? */ | 674 | /* are these used ? */ |
682 | #define is_direntry_cpu_ih(ih) (is_direntry_cpu_key (&((ih)->ih_key))) | 675 | #define is_direntry_cpu_ih(ih) (is_direntry_cpu_key (&((ih)->ih_key))) |
683 | #define is_direct_cpu_ih(ih) (is_direct_cpu_key (&((ih)->ih_key))) | 676 | #define is_direct_cpu_ih(ih) (is_direct_cpu_key (&((ih)->ih_key))) |
684 | #define is_indirect_cpu_ih(ih) (is_indirect_cpu_key (&((ih)->ih_key))) | 677 | #define is_indirect_cpu_ih(ih) (is_indirect_cpu_key (&((ih)->ih_key))) |
685 | #define is_statdata_cpu_ih(ih) (is_statdata_cpu_key (&((ih)->ih_key))) | 678 | #define is_statdata_cpu_ih(ih) (is_statdata_cpu_key (&((ih)->ih_key))) |
686 | 679 | ||
687 | |||
688 | |||
689 | |||
690 | |||
691 | #define I_K_KEY_IN_ITEM(p_s_ih, p_s_key, n_blocksize) \ | 680 | #define I_K_KEY_IN_ITEM(p_s_ih, p_s_key, n_blocksize) \ |
692 | ( ! COMP_SHORT_KEYS(p_s_ih, p_s_key) && \ | 681 | ( ! COMP_SHORT_KEYS(p_s_ih, p_s_key) && \ |
693 | I_OFF_BYTE_IN_ITEM(p_s_ih, k_offset (p_s_key), n_blocksize) ) | 682 | I_OFF_BYTE_IN_ITEM(p_s_ih, k_offset (p_s_key), n_blocksize) ) |
694 | 683 | ||
695 | /* maximal length of item */ | 684 | /* maximal length of item */ |
696 | #define MAX_ITEM_LEN(block_size) (block_size - BLKH_SIZE - IH_SIZE) | 685 | #define MAX_ITEM_LEN(block_size) (block_size - BLKH_SIZE - IH_SIZE) |
697 | #define MIN_ITEM_LEN 1 | 686 | #define MIN_ITEM_LEN 1 |
698 | 687 | ||
699 | |||
700 | /* object identifier for root dir */ | 688 | /* object identifier for root dir */ |
701 | #define REISERFS_ROOT_OBJECTID 2 | 689 | #define REISERFS_ROOT_OBJECTID 2 |
702 | #define REISERFS_ROOT_PARENT_OBJECTID 1 | 690 | #define REISERFS_ROOT_PARENT_OBJECTID 1 |
703 | extern struct reiserfs_key root_key; | 691 | extern struct reiserfs_key root_key; |
704 | 692 | ||
705 | |||
706 | |||
707 | |||
708 | /* | 693 | /* |
709 | * Picture represents a leaf of the S+tree | 694 | * Picture represents a leaf of the S+tree |
710 | * ______________________________________________________ | 695 | * ______________________________________________________ |
@@ -716,13 +701,13 @@ extern struct reiserfs_key root_key; | |||
716 | 701 | ||
717 | /* Header of a disk block. More precisely, header of a formatted leaf | 702 | /* Header of a disk block. More precisely, header of a formatted leaf |
718 | or internal node, and not the header of an unformatted node. */ | 703 | or internal node, and not the header of an unformatted node. */ |
719 | struct block_head { | 704 | struct block_head { |
720 | __le16 blk_level; /* Level of a block in the tree. */ | 705 | __le16 blk_level; /* Level of a block in the tree. */ |
721 | __le16 blk_nr_item; /* Number of keys/items in a block. */ | 706 | __le16 blk_nr_item; /* Number of keys/items in a block. */ |
722 | __le16 blk_free_space; /* Block free space in bytes. */ | 707 | __le16 blk_free_space; /* Block free space in bytes. */ |
723 | __le16 blk_reserved; | 708 | __le16 blk_reserved; |
724 | /* dump this in v4/planA */ | 709 | /* dump this in v4/planA */ |
725 | struct reiserfs_key blk_right_delim_key; /* kept only for compatibility */ | 710 | struct reiserfs_key blk_right_delim_key; /* kept only for compatibility */ |
726 | }; | 711 | }; |
727 | 712 | ||
728 | #define BLKH_SIZE (sizeof(struct block_head)) | 713 | #define BLKH_SIZE (sizeof(struct block_head)) |
@@ -741,12 +726,12 @@ struct block_head { | |||
741 | * values for blk_level field of the struct block_head | 726 | * values for blk_level field of the struct block_head |
742 | */ | 727 | */ |
743 | 728 | ||
744 | #define FREE_LEVEL 0 /* when node gets removed from the tree its | 729 | #define FREE_LEVEL 0 /* when node gets removed from the tree its |
745 | blk_level is set to FREE_LEVEL. It is then | 730 | blk_level is set to FREE_LEVEL. It is then |
746 | used to see whether the node is still in the | 731 | used to see whether the node is still in the |
747 | tree */ | 732 | tree */ |
748 | 733 | ||
749 | #define DISK_LEAF_NODE_LEVEL 1 /* Leaf node level.*/ | 734 | #define DISK_LEAF_NODE_LEVEL 1 /* Leaf node level. */ |
750 | 735 | ||
751 | /* Given the buffer head of a formatted node, resolve to the block head of that node. */ | 736 | /* Given the buffer head of a formatted node, resolve to the block head of that node. */ |
752 | #define B_BLK_HEAD(p_s_bh) ((struct block_head *)((p_s_bh)->b_data)) | 737 | #define B_BLK_HEAD(p_s_bh) ((struct block_head *)((p_s_bh)->b_data)) |
@@ -759,7 +744,6 @@ struct block_head { | |||
759 | #define PUT_B_LEVEL(p_s_bh,val) do { set_blkh_level(B_BLK_HEAD(p_s_bh),val); } while (0) | 744 | #define PUT_B_LEVEL(p_s_bh,val) do { set_blkh_level(B_BLK_HEAD(p_s_bh),val); } while (0) |
760 | #define PUT_B_FREE_SPACE(p_s_bh,val) do { set_blkh_free_space(B_BLK_HEAD(p_s_bh),val); } while (0) | 745 | #define PUT_B_FREE_SPACE(p_s_bh,val) do { set_blkh_free_space(B_BLK_HEAD(p_s_bh),val); } while (0) |
761 | 746 | ||
762 | |||
763 | /* Get right delimiting key. -- little endian */ | 747 | /* Get right delimiting key. -- little endian */ |
764 | #define B_PRIGHT_DELIM_KEY(p_s_bh) (&(blk_right_delim_key(B_BLK_HEAD(p_s_bh)) | 748 | #define B_PRIGHT_DELIM_KEY(p_s_bh) (&(blk_right_delim_key(B_BLK_HEAD(p_s_bh)) |
765 | 749 | ||
@@ -770,41 +754,36 @@ struct block_head { | |||
770 | #define B_IS_KEYS_LEVEL(p_s_bh) (B_LEVEL(p_s_bh) > DISK_LEAF_NODE_LEVEL \ | 754 | #define B_IS_KEYS_LEVEL(p_s_bh) (B_LEVEL(p_s_bh) > DISK_LEAF_NODE_LEVEL \ |
771 | && B_LEVEL(p_s_bh) <= MAX_HEIGHT) | 755 | && B_LEVEL(p_s_bh) <= MAX_HEIGHT) |
772 | 756 | ||
773 | |||
774 | |||
775 | |||
776 | /***************************************************************************/ | 757 | /***************************************************************************/ |
777 | /* STAT DATA */ | 758 | /* STAT DATA */ |
778 | /***************************************************************************/ | 759 | /***************************************************************************/ |
779 | 760 | ||
780 | |||
781 | // | 761 | // |
782 | // old stat data is 32 bytes long. We are going to distinguish new one by | 762 | // old stat data is 32 bytes long. We are going to distinguish new one by |
783 | // different size | 763 | // different size |
784 | // | 764 | // |
785 | struct stat_data_v1 | 765 | struct stat_data_v1 { |
786 | { | 766 | __le16 sd_mode; /* file type, permissions */ |
787 | __le16 sd_mode; /* file type, permissions */ | 767 | __le16 sd_nlink; /* number of hard links */ |
788 | __le16 sd_nlink; /* number of hard links */ | 768 | __le16 sd_uid; /* owner */ |
789 | __le16 sd_uid; /* owner */ | 769 | __le16 sd_gid; /* group */ |
790 | __le16 sd_gid; /* group */ | 770 | __le32 sd_size; /* file size */ |
791 | __le32 sd_size; /* file size */ | 771 | __le32 sd_atime; /* time of last access */ |
792 | __le32 sd_atime; /* time of last access */ | 772 | __le32 sd_mtime; /* time file was last modified */ |
793 | __le32 sd_mtime; /* time file was last modified */ | 773 | __le32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */ |
794 | __le32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */ | 774 | union { |
795 | union { | 775 | __le32 sd_rdev; |
796 | __le32 sd_rdev; | 776 | __le32 sd_blocks; /* number of blocks file uses */ |
797 | __le32 sd_blocks; /* number of blocks file uses */ | 777 | } __attribute__ ((__packed__)) u; |
798 | } __attribute__ ((__packed__)) u; | 778 | __le32 sd_first_direct_byte; /* first byte of file which is stored |
799 | __le32 sd_first_direct_byte; /* first byte of file which is stored | 779 | in a direct item: except that if it |
800 | in a direct item: except that if it | 780 | equals 1 it is a symlink and if it |
801 | equals 1 it is a symlink and if it | 781 | equals ~(__u32)0 there is no |
802 | equals ~(__u32)0 there is no | 782 | direct item. The existence of this |
803 | direct item. The existence of this | 783 | field really grates on me. Let's |
804 | field really grates on me. Let's | 784 | replace it with a macro based on |
805 | replace it with a macro based on | 785 | sd_size and our tail suppression |
806 | sd_size and our tail suppression | 786 | policy. Someday. -Hans */ |
807 | policy. Someday. -Hans */ | ||
808 | } __attribute__ ((__packed__)); | 787 | } __attribute__ ((__packed__)); |
809 | 788 | ||
810 | #define SD_V1_SIZE (sizeof(struct stat_data_v1)) | 789 | #define SD_V1_SIZE (sizeof(struct stat_data_v1)) |
@@ -862,29 +841,29 @@ struct stat_data_v1 | |||
862 | /* Stat Data on disk (reiserfs version of UFS disk inode minus the | 841 | /* Stat Data on disk (reiserfs version of UFS disk inode minus the |
863 | address blocks) */ | 842 | address blocks) */ |
864 | struct stat_data { | 843 | struct stat_data { |
865 | __le16 sd_mode; /* file type, permissions */ | 844 | __le16 sd_mode; /* file type, permissions */ |
866 | __le16 sd_attrs; /* persistent inode flags */ | 845 | __le16 sd_attrs; /* persistent inode flags */ |
867 | __le32 sd_nlink; /* number of hard links */ | 846 | __le32 sd_nlink; /* number of hard links */ |
868 | __le64 sd_size; /* file size */ | 847 | __le64 sd_size; /* file size */ |
869 | __le32 sd_uid; /* owner */ | 848 | __le32 sd_uid; /* owner */ |
870 | __le32 sd_gid; /* group */ | 849 | __le32 sd_gid; /* group */ |
871 | __le32 sd_atime; /* time of last access */ | 850 | __le32 sd_atime; /* time of last access */ |
872 | __le32 sd_mtime; /* time file was last modified */ | 851 | __le32 sd_mtime; /* time file was last modified */ |
873 | __le32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */ | 852 | __le32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */ |
874 | __le32 sd_blocks; | 853 | __le32 sd_blocks; |
875 | union { | 854 | union { |
876 | __le32 sd_rdev; | 855 | __le32 sd_rdev; |
877 | __le32 sd_generation; | 856 | __le32 sd_generation; |
878 | //__le32 sd_first_direct_byte; | 857 | //__le32 sd_first_direct_byte; |
879 | /* first byte of file which is stored in a | 858 | /* first byte of file which is stored in a |
880 | direct item: except that if it equals 1 | 859 | direct item: except that if it equals 1 |
881 | it is a symlink and if it equals | 860 | it is a symlink and if it equals |
882 | ~(__u32)0 there is no direct item. The | 861 | ~(__u32)0 there is no direct item. The |
883 | existence of this field really grates | 862 | existence of this field really grates |
884 | on me. Let's replace it with a macro | 863 | on me. Let's replace it with a macro |
885 | based on sd_size and our tail | 864 | based on sd_size and our tail |
886 | suppression policy? */ | 865 | suppression policy? */ |
887 | } __attribute__ ((__packed__)) u; | 866 | } __attribute__ ((__packed__)) u; |
888 | } __attribute__ ((__packed__)); | 867 | } __attribute__ ((__packed__)); |
889 | // | 868 | // |
890 | // this is 44 bytes long | 869 | // this is 44 bytes long |
@@ -919,7 +898,6 @@ struct stat_data { | |||
919 | #define sd_v2_attrs(sdp) (le16_to_cpu((sdp)->sd_attrs)) | 898 | #define sd_v2_attrs(sdp) (le16_to_cpu((sdp)->sd_attrs)) |
920 | #define set_sd_v2_attrs(sdp,v) ((sdp)->sd_attrs = cpu_to_le16(v)) | 899 | #define set_sd_v2_attrs(sdp,v) ((sdp)->sd_attrs = cpu_to_le16(v)) |
921 | 900 | ||
922 | |||
923 | /***************************************************************************/ | 901 | /***************************************************************************/ |
924 | /* DIRECTORY STRUCTURE */ | 902 | /* DIRECTORY STRUCTURE */ |
925 | /***************************************************************************/ | 903 | /***************************************************************************/ |
@@ -954,17 +932,14 @@ struct stat_data { | |||
954 | /* NOT IMPLEMENTED: | 932 | /* NOT IMPLEMENTED: |
955 | Directory will someday contain stat data of object */ | 933 | Directory will someday contain stat data of object */ |
956 | 934 | ||
957 | 935 | struct reiserfs_de_head { | |
958 | 936 | __le32 deh_offset; /* third component of the directory entry key */ | |
959 | struct reiserfs_de_head | 937 | __le32 deh_dir_id; /* objectid of the parent directory of the object, that is referenced |
960 | { | 938 | by directory entry */ |
961 | __le32 deh_offset; /* third component of the directory entry key */ | 939 | __le32 deh_objectid; /* objectid of the object, that is referenced by directory entry */ |
962 | __le32 deh_dir_id; /* objectid of the parent directory of the object, that is referenced | 940 | __le16 deh_location; /* offset of name in the whole item */ |
963 | by directory entry */ | 941 | __le16 deh_state; /* whether 1) entry contains stat data (for future), and 2) whether |
964 | __le32 deh_objectid; /* objectid of the object, that is referenced by directory entry */ | 942 | entry is hidden (unlinked) */ |
965 | __le16 deh_location; /* offset of name in the whole item */ | ||
966 | __le16 deh_state; /* whether 1) entry contains stat data (for future), and 2) whether | ||
967 | entry is hidden (unlinked) */ | ||
968 | } __attribute__ ((__packed__)); | 943 | } __attribute__ ((__packed__)); |
969 | #define DEH_SIZE sizeof(struct reiserfs_de_head) | 944 | #define DEH_SIZE sizeof(struct reiserfs_de_head) |
970 | #define deh_offset(p_deh) (le32_to_cpu((p_deh)->deh_offset)) | 945 | #define deh_offset(p_deh) (le32_to_cpu((p_deh)->deh_offset)) |
@@ -986,7 +961,7 @@ struct reiserfs_de_head | |||
986 | /* old format directories have this size when empty */ | 961 | /* old format directories have this size when empty */ |
987 | #define EMPTY_DIR_SIZE_V1 (DEH_SIZE * 2 + 3) | 962 | #define EMPTY_DIR_SIZE_V1 (DEH_SIZE * 2 + 3) |
988 | 963 | ||
989 | #define DEH_Statdata 0 /* not used now */ | 964 | #define DEH_Statdata 0 /* not used now */ |
990 | #define DEH_Visible 2 | 965 | #define DEH_Visible 2 |
991 | 966 | ||
992 | /* 64 bit systems (and the S/390) need to be aligned explicitly -jdm */ | 967 | /* 64 bit systems (and the S/390) need to be aligned explicitly -jdm */ |
@@ -1023,10 +998,10 @@ struct reiserfs_de_head | |||
1023 | #define de_visible(deh) test_bit_unaligned (DEH_Visible, &((deh)->deh_state)) | 998 | #define de_visible(deh) test_bit_unaligned (DEH_Visible, &((deh)->deh_state)) |
1024 | #define de_hidden(deh) !test_bit_unaligned (DEH_Visible, &((deh)->deh_state)) | 999 | #define de_hidden(deh) !test_bit_unaligned (DEH_Visible, &((deh)->deh_state)) |
1025 | 1000 | ||
1026 | extern void make_empty_dir_item_v1 (char * body, __le32 dirid, __le32 objid, | 1001 | extern void make_empty_dir_item_v1(char *body, __le32 dirid, __le32 objid, |
1027 | __le32 par_dirid, __le32 par_objid); | 1002 | __le32 par_dirid, __le32 par_objid); |
1028 | extern void make_empty_dir_item (char * body, __le32 dirid, __le32 objid, | 1003 | extern void make_empty_dir_item(char *body, __le32 dirid, __le32 objid, |
1029 | __le32 par_dirid, __le32 par_objid); | 1004 | __le32 par_dirid, __le32 par_objid); |
1030 | 1005 | ||
1031 | /* array of the entry headers */ | 1006 | /* array of the entry headers */ |
1032 | /* get item body */ | 1007 | /* get item body */ |
@@ -1043,53 +1018,48 @@ extern void make_empty_dir_item (char * body, __le32 dirid, __le32 objid, | |||
1043 | #define I_DEH_N_ENTRY_LENGTH(ih,deh,i) \ | 1018 | #define I_DEH_N_ENTRY_LENGTH(ih,deh,i) \ |
1044 | ((i) ? (deh_location((deh)-1) - deh_location((deh))) : (ih_item_len((ih)) - deh_location((deh)))) | 1019 | ((i) ? (deh_location((deh)-1) - deh_location((deh))) : (ih_item_len((ih)) - deh_location((deh)))) |
1045 | */ | 1020 | */ |
1046 | static inline int entry_length (const struct buffer_head * bh, | 1021 | static inline int entry_length(const struct buffer_head *bh, |
1047 | const struct item_head * ih, int pos_in_item) | 1022 | const struct item_head *ih, int pos_in_item) |
1048 | { | 1023 | { |
1049 | struct reiserfs_de_head * deh; | 1024 | struct reiserfs_de_head *deh; |
1050 | 1025 | ||
1051 | deh = B_I_DEH (bh, ih) + pos_in_item; | 1026 | deh = B_I_DEH(bh, ih) + pos_in_item; |
1052 | if (pos_in_item) | 1027 | if (pos_in_item) |
1053 | return deh_location(deh-1) - deh_location(deh); | 1028 | return deh_location(deh - 1) - deh_location(deh); |
1054 | 1029 | ||
1055 | return ih_item_len(ih) - deh_location(deh); | 1030 | return ih_item_len(ih) - deh_location(deh); |
1056 | } | 1031 | } |
1057 | 1032 | ||
1058 | |||
1059 | |||
1060 | /* number of entries in the directory item, depends on ENTRY_COUNT being at the start of directory dynamic data. */ | 1033 | /* number of entries in the directory item, depends on ENTRY_COUNT being at the start of directory dynamic data. */ |
1061 | #define I_ENTRY_COUNT(ih) (ih_entry_count((ih))) | 1034 | #define I_ENTRY_COUNT(ih) (ih_entry_count((ih))) |
1062 | 1035 | ||
1063 | |||
1064 | /* name by bh, ih and entry_num */ | 1036 | /* name by bh, ih and entry_num */ |
1065 | #define B_I_E_NAME(bh,ih,entry_num) ((char *)(bh->b_data + ih_location(ih) + deh_location(B_I_DEH(bh,ih)+(entry_num)))) | 1037 | #define B_I_E_NAME(bh,ih,entry_num) ((char *)(bh->b_data + ih_location(ih) + deh_location(B_I_DEH(bh,ih)+(entry_num)))) |
1066 | 1038 | ||
1067 | // two entries per block (at least) | 1039 | // two entries per block (at least) |
1068 | #define REISERFS_MAX_NAME(block_size) 255 | 1040 | #define REISERFS_MAX_NAME(block_size) 255 |
1069 | 1041 | ||
1070 | |||
1071 | /* this structure is used for operations on directory entries. It is | 1042 | /* this structure is used for operations on directory entries. It is |
1072 | not a disk structure. */ | 1043 | not a disk structure. */ |
1073 | /* When reiserfs_find_entry or search_by_entry_key find directory | 1044 | /* When reiserfs_find_entry or search_by_entry_key find directory |
1074 | entry, they return filled reiserfs_dir_entry structure */ | 1045 | entry, they return filled reiserfs_dir_entry structure */ |
1075 | struct reiserfs_dir_entry | 1046 | struct reiserfs_dir_entry { |
1076 | { | 1047 | struct buffer_head *de_bh; |
1077 | struct buffer_head * de_bh; | 1048 | int de_item_num; |
1078 | int de_item_num; | 1049 | struct item_head *de_ih; |
1079 | struct item_head * de_ih; | 1050 | int de_entry_num; |
1080 | int de_entry_num; | 1051 | struct reiserfs_de_head *de_deh; |
1081 | struct reiserfs_de_head * de_deh; | 1052 | int de_entrylen; |
1082 | int de_entrylen; | 1053 | int de_namelen; |
1083 | int de_namelen; | 1054 | char *de_name; |
1084 | char * de_name; | 1055 | char *de_gen_number_bit_string; |
1085 | char * de_gen_number_bit_string; | 1056 | |
1086 | 1057 | __u32 de_dir_id; | |
1087 | __u32 de_dir_id; | 1058 | __u32 de_objectid; |
1088 | __u32 de_objectid; | 1059 | |
1089 | 1060 | struct cpu_key de_entry_key; | |
1090 | struct cpu_key de_entry_key; | ||
1091 | }; | 1061 | }; |
1092 | 1062 | ||
1093 | /* these defines are useful when a particular member of a reiserfs_dir_entry is needed */ | 1063 | /* these defines are useful when a particular member of a reiserfs_dir_entry is needed */ |
1094 | 1064 | ||
1095 | /* pointer to file name, stored in entry */ | 1065 | /* pointer to file name, stored in entry */ |
@@ -1099,8 +1069,6 @@ struct reiserfs_dir_entry | |||
1099 | #define I_DEH_N_ENTRY_FILE_NAME_LENGTH(ih,deh,entry_num) \ | 1069 | #define I_DEH_N_ENTRY_FILE_NAME_LENGTH(ih,deh,entry_num) \ |
1100 | (I_DEH_N_ENTRY_LENGTH (ih, deh, entry_num) - (de_with_sd (deh) ? SD_SIZE : 0)) | 1070 | (I_DEH_N_ENTRY_LENGTH (ih, deh, entry_num) - (de_with_sd (deh) ? SD_SIZE : 0)) |
1101 | 1071 | ||
1102 | |||
1103 | |||
1104 | /* hash value occupies bits from 7 up to 30 */ | 1072 | /* hash value occupies bits from 7 up to 30 */ |
1105 | #define GET_HASH_VALUE(offset) ((offset) & 0x7fffff80LL) | 1073 | #define GET_HASH_VALUE(offset) ((offset) & 0x7fffff80LL) |
1106 | /* generation number occupies 7 bits starting from 0 up to 6 */ | 1074 | /* generation number occupies 7 bits starting from 0 up to 6 */ |
@@ -1109,7 +1077,6 @@ struct reiserfs_dir_entry | |||
1109 | 1077 | ||
1110 | #define SET_GENERATION_NUMBER(offset,gen_number) (GET_HASH_VALUE(offset)|(gen_number)) | 1078 | #define SET_GENERATION_NUMBER(offset,gen_number) (GET_HASH_VALUE(offset)|(gen_number)) |
1111 | 1079 | ||
1112 | |||
1113 | /* | 1080 | /* |
1114 | * Picture represents an internal node of the reiserfs tree | 1081 | * Picture represents an internal node of the reiserfs tree |
1115 | * ______________________________________________________ | 1082 | * ______________________________________________________ |
@@ -1125,9 +1092,9 @@ struct reiserfs_dir_entry | |||
1125 | /* Disk child pointer: The pointer from an internal node of the tree | 1092 | /* Disk child pointer: The pointer from an internal node of the tree |
1126 | to a node that is on disk. */ | 1093 | to a node that is on disk. */ |
1127 | struct disk_child { | 1094 | struct disk_child { |
1128 | __le32 dc_block_number; /* Disk child's block number. */ | 1095 | __le32 dc_block_number; /* Disk child's block number. */ |
1129 | __le16 dc_size; /* Disk child's used space. */ | 1096 | __le16 dc_size; /* Disk child's used space. */ |
1130 | __le16 dc_reserved; | 1097 | __le16 dc_reserved; |
1131 | }; | 1098 | }; |
1132 | 1099 | ||
1133 | #define DC_SIZE (sizeof(struct disk_child)) | 1100 | #define DC_SIZE (sizeof(struct disk_child)) |
@@ -1144,7 +1111,7 @@ struct disk_child { | |||
1144 | #define B_N_CHILD_NUM(p_s_bh,n_pos) (dc_block_number(B_N_CHILD(p_s_bh,n_pos))) | 1111 | #define B_N_CHILD_NUM(p_s_bh,n_pos) (dc_block_number(B_N_CHILD(p_s_bh,n_pos))) |
1145 | #define PUT_B_N_CHILD_NUM(p_s_bh,n_pos, val) (put_dc_block_number(B_N_CHILD(p_s_bh,n_pos), val )) | 1112 | #define PUT_B_N_CHILD_NUM(p_s_bh,n_pos, val) (put_dc_block_number(B_N_CHILD(p_s_bh,n_pos), val )) |
1146 | 1113 | ||
1147 | /* maximal value of field child_size in structure disk_child */ | 1114 | /* maximal value of field child_size in structure disk_child */ |
1148 | /* child size is the combined size of all items and their headers */ | 1115 | /* child size is the combined size of all items and their headers */ |
1149 | #define MAX_CHILD_SIZE(bh) ((int)( (bh)->b_size - BLKH_SIZE )) | 1116 | #define MAX_CHILD_SIZE(bh) ((int)( (bh)->b_size - BLKH_SIZE )) |
1150 | 1117 | ||
@@ -1159,7 +1126,6 @@ struct disk_child { | |||
1159 | /* PATH STRUCTURES AND DEFINES */ | 1126 | /* PATH STRUCTURES AND DEFINES */ |
1160 | /***************************************************************************/ | 1127 | /***************************************************************************/ |
1161 | 1128 | ||
1162 | |||
1163 | /* Search_by_key fills up the path from the root to the leaf as it descends the tree looking for the | 1129 | /* Search_by_key fills up the path from the root to the leaf as it descends the tree looking for the |
1164 | key. It uses reiserfs_bread to try to find buffers in the cache given their block number. If it | 1130 | key. It uses reiserfs_bread to try to find buffers in the cache given their block number. If it |
1165 | does not find them in the cache it reads them from disk. For each node search_by_key finds using | 1131 | does not find them in the cache it reads them from disk. For each node search_by_key finds using |
@@ -1168,20 +1134,18 @@ struct disk_child { | |||
1168 | is looking through a leaf node bin_search will find the position of the item which has key either | 1134 | is looking through a leaf node bin_search will find the position of the item which has key either |
1169 | equal to given key, or which is the maximal key less than the given key. */ | 1135 | equal to given key, or which is the maximal key less than the given key. */ |
1170 | 1136 | ||
1171 | struct path_element { | 1137 | struct path_element { |
1172 | struct buffer_head * pe_buffer; /* Pointer to the buffer at the path in the tree. */ | 1138 | struct buffer_head *pe_buffer; /* Pointer to the buffer at the path in the tree. */ |
1173 | int pe_position; /* Position in the tree node which is placed in the */ | 1139 | int pe_position; /* Position in the tree node which is placed in the */ |
1174 | /* buffer above. */ | 1140 | /* buffer above. */ |
1175 | }; | 1141 | }; |
1176 | 1142 | ||
1177 | #define MAX_HEIGHT 5 /* maximal height of a tree. don't change this without changing JOURNAL_PER_BALANCE_CNT */ | 1143 | #define MAX_HEIGHT 5 /* maximal height of a tree. don't change this without changing JOURNAL_PER_BALANCE_CNT */ |
1178 | #define EXTENDED_MAX_HEIGHT 7 /* Must be equals MAX_HEIGHT + FIRST_PATH_ELEMENT_OFFSET */ | 1144 | #define EXTENDED_MAX_HEIGHT 7 /* Must be equals MAX_HEIGHT + FIRST_PATH_ELEMENT_OFFSET */ |
1179 | #define FIRST_PATH_ELEMENT_OFFSET 2 /* Must be equal to at least 2. */ | 1145 | #define FIRST_PATH_ELEMENT_OFFSET 2 /* Must be equal to at least 2. */ |
1180 | |||
1181 | #define ILLEGAL_PATH_ELEMENT_OFFSET 1 /* Must be equal to FIRST_PATH_ELEMENT_OFFSET - 1 */ | ||
1182 | #define MAX_FEB_SIZE 6 /* this MUST be MAX_HEIGHT + 1. See about FEB below */ | ||
1183 | |||
1184 | 1146 | ||
1147 | #define ILLEGAL_PATH_ELEMENT_OFFSET 1 /* Must be equal to FIRST_PATH_ELEMENT_OFFSET - 1 */ | ||
1148 | #define MAX_FEB_SIZE 6 /* this MUST be MAX_HEIGHT + 1. See about FEB below */ | ||
1185 | 1149 | ||
1186 | /* We need to keep track of who the ancestors of nodes are. When we | 1150 | /* We need to keep track of who the ancestors of nodes are. When we |
1187 | perform a search we record which nodes were visited while | 1151 | perform a search we record which nodes were visited while |
@@ -1200,14 +1164,14 @@ excessive effort to avoid disturbing the precious VFS code.:-( The | |||
1200 | gods only know how we are going to SMP the code that uses them. | 1164 | gods only know how we are going to SMP the code that uses them. |
1201 | znodes are the way! */ | 1165 | znodes are the way! */ |
1202 | 1166 | ||
1203 | #define PATH_READA 0x1 /* do read ahead */ | 1167 | #define PATH_READA 0x1 /* do read ahead */ |
1204 | #define PATH_READA_BACK 0x2 /* read backwards */ | 1168 | #define PATH_READA_BACK 0x2 /* read backwards */ |
1205 | 1169 | ||
1206 | struct path { | 1170 | struct path { |
1207 | int path_length; /* Length of the array above. */ | 1171 | int path_length; /* Length of the array above. */ |
1208 | int reada; | 1172 | int reada; |
1209 | struct path_element path_elements[EXTENDED_MAX_HEIGHT]; /* Array of the path elements. */ | 1173 | struct path_element path_elements[EXTENDED_MAX_HEIGHT]; /* Array of the path elements. */ |
1210 | int pos_in_item; | 1174 | int pos_in_item; |
1211 | }; | 1175 | }; |
1212 | 1176 | ||
1213 | #define pos_in_item(path) ((path)->pos_in_item) | 1177 | #define pos_in_item(path) ((path)->pos_in_item) |
@@ -1224,25 +1188,23 @@ struct path var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,} | |||
1224 | /* Get position in the element at the path by path and path position. */ | 1188 | /* Get position in the element at the path by path and path position. */ |
1225 | #define PATH_OFFSET_POSITION(p_s_path,n_offset) (PATH_OFFSET_PELEMENT(p_s_path,n_offset)->pe_position) | 1189 | #define PATH_OFFSET_POSITION(p_s_path,n_offset) (PATH_OFFSET_PELEMENT(p_s_path,n_offset)->pe_position) |
1226 | 1190 | ||
1227 | |||
1228 | #define PATH_PLAST_BUFFER(p_s_path) (PATH_OFFSET_PBUFFER((p_s_path), (p_s_path)->path_length)) | 1191 | #define PATH_PLAST_BUFFER(p_s_path) (PATH_OFFSET_PBUFFER((p_s_path), (p_s_path)->path_length)) |
1229 | /* you know, to the person who didn't | 1192 | /* you know, to the person who didn't |
1230 | write this the macro name does not | 1193 | write this the macro name does not |
1231 | at first suggest what it does. | 1194 | at first suggest what it does. |
1232 | Maybe POSITION_FROM_PATH_END? Or | 1195 | Maybe POSITION_FROM_PATH_END? Or |
1233 | maybe we should just focus on | 1196 | maybe we should just focus on |
1234 | dumping paths... -Hans */ | 1197 | dumping paths... -Hans */ |
1235 | #define PATH_LAST_POSITION(p_s_path) (PATH_OFFSET_POSITION((p_s_path), (p_s_path)->path_length)) | 1198 | #define PATH_LAST_POSITION(p_s_path) (PATH_OFFSET_POSITION((p_s_path), (p_s_path)->path_length)) |
1236 | 1199 | ||
1237 | |||
1238 | #define PATH_PITEM_HEAD(p_s_path) B_N_PITEM_HEAD(PATH_PLAST_BUFFER(p_s_path),PATH_LAST_POSITION(p_s_path)) | 1200 | #define PATH_PITEM_HEAD(p_s_path) B_N_PITEM_HEAD(PATH_PLAST_BUFFER(p_s_path),PATH_LAST_POSITION(p_s_path)) |
1239 | 1201 | ||
1240 | /* in do_balance leaf has h == 0 in contrast with path structure, | 1202 | /* in do_balance leaf has h == 0 in contrast with path structure, |
1241 | where root has level == 0. That is why we need these defines */ | 1203 | where root has level == 0. That is why we need these defines */ |
1242 | #define PATH_H_PBUFFER(p_s_path, h) PATH_OFFSET_PBUFFER (p_s_path, p_s_path->path_length - (h)) /* tb->S[h] */ | 1204 | #define PATH_H_PBUFFER(p_s_path, h) PATH_OFFSET_PBUFFER (p_s_path, p_s_path->path_length - (h)) /* tb->S[h] */ |
1243 | #define PATH_H_PPARENT(path, h) PATH_H_PBUFFER (path, (h) + 1) /* tb->F[h] or tb->S[0]->b_parent */ | 1205 | #define PATH_H_PPARENT(path, h) PATH_H_PBUFFER (path, (h) + 1) /* tb->F[h] or tb->S[0]->b_parent */ |
1244 | #define PATH_H_POSITION(path, h) PATH_OFFSET_POSITION (path, path->path_length - (h)) | 1206 | #define PATH_H_POSITION(path, h) PATH_OFFSET_POSITION (path, path->path_length - (h)) |
1245 | #define PATH_H_B_ITEM_ORDER(path, h) PATH_H_POSITION(path, h + 1) /* tb->S[h]->b_item_order */ | 1207 | #define PATH_H_B_ITEM_ORDER(path, h) PATH_H_POSITION(path, h + 1) /* tb->S[h]->b_item_order */ |
1246 | 1208 | ||
1247 | #define PATH_H_PATH_OFFSET(p_s_path, n_h) ((p_s_path)->path_length - (n_h)) | 1209 | #define PATH_H_PATH_OFFSET(p_s_path, n_h) ((p_s_path)->path_length - (n_h)) |
1248 | 1210 | ||
@@ -1253,7 +1215,6 @@ struct path var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,} | |||
1253 | #define item_moved(ih,path) comp_items(ih, path) | 1215 | #define item_moved(ih,path) comp_items(ih, path) |
1254 | #define path_changed(ih,path) comp_items (ih, path) | 1216 | #define path_changed(ih,path) comp_items (ih, path) |
1255 | 1217 | ||
1256 | |||
1257 | /***************************************************************************/ | 1218 | /***************************************************************************/ |
1258 | /* MISC */ | 1219 | /* MISC */ |
1259 | /***************************************************************************/ | 1220 | /***************************************************************************/ |
@@ -1272,30 +1233,26 @@ struct path var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,} | |||
1272 | // reiserfs version 2 has max offset 60 bits. Version 1 - 32 bit offset | 1233 | // reiserfs version 2 has max offset 60 bits. Version 1 - 32 bit offset |
1273 | #define U32_MAX (~(__u32)0) | 1234 | #define U32_MAX (~(__u32)0) |
1274 | 1235 | ||
1275 | static inline loff_t max_reiserfs_offset (struct inode * inode) | 1236 | static inline loff_t max_reiserfs_offset(struct inode *inode) |
1276 | { | 1237 | { |
1277 | if (get_inode_item_key_version(inode) == KEY_FORMAT_3_5) | 1238 | if (get_inode_item_key_version(inode) == KEY_FORMAT_3_5) |
1278 | return (loff_t)U32_MAX; | 1239 | return (loff_t) U32_MAX; |
1279 | 1240 | ||
1280 | return (loff_t)((~(__u64)0) >> 4); | 1241 | return (loff_t) ((~(__u64) 0) >> 4); |
1281 | } | 1242 | } |
1282 | 1243 | ||
1283 | |||
1284 | /*#define MAX_KEY_UNIQUENESS MAX_UL_INT*/ | 1244 | /*#define MAX_KEY_UNIQUENESS MAX_UL_INT*/ |
1285 | #define MAX_KEY_OBJECTID MAX_UL_INT | 1245 | #define MAX_KEY_OBJECTID MAX_UL_INT |
1286 | 1246 | ||
1287 | |||
1288 | #define MAX_B_NUM MAX_UL_INT | 1247 | #define MAX_B_NUM MAX_UL_INT |
1289 | #define MAX_FC_NUM MAX_US_INT | 1248 | #define MAX_FC_NUM MAX_US_INT |
1290 | 1249 | ||
1291 | |||
1292 | /* the purpose is to detect overflow of an unsigned short */ | 1250 | /* the purpose is to detect overflow of an unsigned short */ |
1293 | #define REISERFS_LINK_MAX (MAX_US_INT - 1000) | 1251 | #define REISERFS_LINK_MAX (MAX_US_INT - 1000) |
1294 | 1252 | ||
1295 | |||
1296 | /* The following defines are used in reiserfs_insert_item and reiserfs_append_item */ | 1253 | /* The following defines are used in reiserfs_insert_item and reiserfs_append_item */ |
1297 | #define REISERFS_KERNEL_MEM 0 /* reiserfs kernel memory mode */ | 1254 | #define REISERFS_KERNEL_MEM 0 /* reiserfs kernel memory mode */ |
1298 | #define REISERFS_USER_MEM 1 /* reiserfs user memory mode */ | 1255 | #define REISERFS_USER_MEM 1 /* reiserfs user memory mode */ |
1299 | 1256 | ||
1300 | #define fs_generation(s) (REISERFS_SB(s)->s_generation_counter) | 1257 | #define fs_generation(s) (REISERFS_SB(s)->s_generation_counter) |
1301 | #define get_generation(s) atomic_read (&fs_generation(s)) | 1258 | #define get_generation(s) atomic_read (&fs_generation(s)) |
@@ -1303,7 +1260,6 @@ static inline loff_t max_reiserfs_offset (struct inode * inode) | |||
1303 | #define __fs_changed(gen,s) (gen != get_generation (s)) | 1260 | #define __fs_changed(gen,s) (gen != get_generation (s)) |
1304 | #define fs_changed(gen,s) ({cond_resched(); __fs_changed(gen, s);}) | 1261 | #define fs_changed(gen,s) ({cond_resched(); __fs_changed(gen, s);}) |
1305 | 1262 | ||
1306 | |||
1307 | /***************************************************************************/ | 1263 | /***************************************************************************/ |
1308 | /* FIXATE NODES */ | 1264 | /* FIXATE NODES */ |
1309 | /***************************************************************************/ | 1265 | /***************************************************************************/ |
@@ -1324,38 +1280,34 @@ static inline loff_t max_reiserfs_offset (struct inode * inode) | |||
1324 | calculating what we can shift to neighbors and how many nodes we | 1280 | calculating what we can shift to neighbors and how many nodes we |
1325 | have to have if we do not any shiftings, if we shift to left/right | 1281 | have to have if we do not any shiftings, if we shift to left/right |
1326 | neighbor or to both. */ | 1282 | neighbor or to both. */ |
1327 | struct virtual_item | 1283 | struct virtual_item { |
1328 | { | 1284 | int vi_index; // index in the array of item operations |
1329 | int vi_index; // index in the array of item operations | 1285 | unsigned short vi_type; // left/right mergeability |
1330 | unsigned short vi_type; // left/right mergeability | 1286 | unsigned short vi_item_len; /* length of item that it will have after balancing */ |
1331 | unsigned short vi_item_len; /* length of item that it will have after balancing */ | 1287 | struct item_head *vi_ih; |
1332 | struct item_head * vi_ih; | 1288 | const char *vi_item; // body of item (old or new) |
1333 | const char * vi_item; // body of item (old or new) | 1289 | const void *vi_new_data; // 0 always but paste mode |
1334 | const void * vi_new_data; // 0 always but paste mode | 1290 | void *vi_uarea; // item specific area |
1335 | void * vi_uarea; // item specific area | ||
1336 | }; | 1291 | }; |
1337 | 1292 | ||
1338 | 1293 | struct virtual_node { | |
1339 | struct virtual_node | 1294 | char *vn_free_ptr; /* this is a pointer to the free space in the buffer */ |
1340 | { | 1295 | unsigned short vn_nr_item; /* number of items in virtual node */ |
1341 | char * vn_free_ptr; /* this is a pointer to the free space in the buffer */ | 1296 | short vn_size; /* size of node , that node would have if it has unlimited size and no balancing is performed */ |
1342 | unsigned short vn_nr_item; /* number of items in virtual node */ | 1297 | short vn_mode; /* mode of balancing (paste, insert, delete, cut) */ |
1343 | short vn_size; /* size of node , that node would have if it has unlimited size and no balancing is performed */ | 1298 | short vn_affected_item_num; |
1344 | short vn_mode; /* mode of balancing (paste, insert, delete, cut) */ | 1299 | short vn_pos_in_item; |
1345 | short vn_affected_item_num; | 1300 | struct item_head *vn_ins_ih; /* item header of inserted item, 0 for other modes */ |
1346 | short vn_pos_in_item; | 1301 | const void *vn_data; |
1347 | struct item_head * vn_ins_ih; /* item header of inserted item, 0 for other modes */ | 1302 | struct virtual_item *vn_vi; /* array of items (including a new one, excluding item to be deleted) */ |
1348 | const void * vn_data; | ||
1349 | struct virtual_item * vn_vi; /* array of items (including a new one, excluding item to be deleted) */ | ||
1350 | }; | 1303 | }; |
1351 | 1304 | ||
1352 | /* used by directory items when creating virtual nodes */ | 1305 | /* used by directory items when creating virtual nodes */ |
1353 | struct direntry_uarea { | 1306 | struct direntry_uarea { |
1354 | int flags; | 1307 | int flags; |
1355 | __u16 entry_count; | 1308 | __u16 entry_count; |
1356 | __u16 entry_sizes[1]; | 1309 | __u16 entry_sizes[1]; |
1357 | } __attribute__ ((__packed__)) ; | 1310 | } __attribute__ ((__packed__)); |
1358 | |||
1359 | 1311 | ||
1360 | /***************************************************************************/ | 1312 | /***************************************************************************/ |
1361 | /* TREE BALANCE */ | 1313 | /* TREE BALANCE */ |
@@ -1378,73 +1330,72 @@ struct direntry_uarea { | |||
1378 | #define MAX_AMOUNT_NEEDED 2 | 1330 | #define MAX_AMOUNT_NEEDED 2 |
1379 | 1331 | ||
1380 | /* someday somebody will prefix every field in this struct with tb_ */ | 1332 | /* someday somebody will prefix every field in this struct with tb_ */ |
1381 | struct tree_balance | 1333 | struct tree_balance { |
1382 | { | 1334 | int tb_mode; |
1383 | int tb_mode; | 1335 | int need_balance_dirty; |
1384 | int need_balance_dirty; | 1336 | struct super_block *tb_sb; |
1385 | struct super_block * tb_sb; | 1337 | struct reiserfs_transaction_handle *transaction_handle; |
1386 | struct reiserfs_transaction_handle *transaction_handle ; | 1338 | struct path *tb_path; |
1387 | struct path * tb_path; | 1339 | struct buffer_head *L[MAX_HEIGHT]; /* array of left neighbors of nodes in the path */ |
1388 | struct buffer_head * L[MAX_HEIGHT]; /* array of left neighbors of nodes in the path */ | 1340 | struct buffer_head *R[MAX_HEIGHT]; /* array of right neighbors of nodes in the path */ |
1389 | struct buffer_head * R[MAX_HEIGHT]; /* array of right neighbors of nodes in the path*/ | 1341 | struct buffer_head *FL[MAX_HEIGHT]; /* array of fathers of the left neighbors */ |
1390 | struct buffer_head * FL[MAX_HEIGHT]; /* array of fathers of the left neighbors */ | 1342 | struct buffer_head *FR[MAX_HEIGHT]; /* array of fathers of the right neighbors */ |
1391 | struct buffer_head * FR[MAX_HEIGHT]; /* array of fathers of the right neighbors */ | 1343 | struct buffer_head *CFL[MAX_HEIGHT]; /* array of common parents of center node and its left neighbor */ |
1392 | struct buffer_head * CFL[MAX_HEIGHT]; /* array of common parents of center node and its left neighbor */ | 1344 | struct buffer_head *CFR[MAX_HEIGHT]; /* array of common parents of center node and its right neighbor */ |
1393 | struct buffer_head * CFR[MAX_HEIGHT]; /* array of common parents of center node and its right neighbor */ | 1345 | |
1394 | 1346 | struct buffer_head *FEB[MAX_FEB_SIZE]; /* array of empty buffers. Number of buffers in array equals | |
1395 | struct buffer_head * FEB[MAX_FEB_SIZE]; /* array of empty buffers. Number of buffers in array equals | 1347 | cur_blknum. */ |
1396 | cur_blknum. */ | 1348 | struct buffer_head *used[MAX_FEB_SIZE]; |
1397 | struct buffer_head * used[MAX_FEB_SIZE]; | 1349 | struct buffer_head *thrown[MAX_FEB_SIZE]; |
1398 | struct buffer_head * thrown[MAX_FEB_SIZE]; | 1350 | int lnum[MAX_HEIGHT]; /* array of number of items which must be |
1399 | int lnum[MAX_HEIGHT]; /* array of number of items which must be | 1351 | shifted to the left in order to balance the |
1400 | shifted to the left in order to balance the | 1352 | current node; for leaves includes item that |
1401 | current node; for leaves includes item that | 1353 | will be partially shifted; for internal |
1402 | will be partially shifted; for internal | 1354 | nodes, it is the number of child pointers |
1403 | nodes, it is the number of child pointers | 1355 | rather than items. It includes the new item |
1404 | rather than items. It includes the new item | 1356 | being created. The code sometimes subtracts |
1405 | being created. The code sometimes subtracts | 1357 | one to get the number of wholly shifted |
1406 | one to get the number of wholly shifted | 1358 | items for other purposes. */ |
1407 | items for other purposes. */ | 1359 | int rnum[MAX_HEIGHT]; /* substitute right for left in comment above */ |
1408 | int rnum[MAX_HEIGHT]; /* substitute right for left in comment above */ | 1360 | int lkey[MAX_HEIGHT]; /* array indexed by height h mapping the key delimiting L[h] and |
1409 | int lkey[MAX_HEIGHT]; /* array indexed by height h mapping the key delimiting L[h] and | 1361 | S[h] to its item number within the node CFL[h] */ |
1410 | S[h] to its item number within the node CFL[h] */ | 1362 | int rkey[MAX_HEIGHT]; /* substitute r for l in comment above */ |
1411 | int rkey[MAX_HEIGHT]; /* substitute r for l in comment above */ | 1363 | int insert_size[MAX_HEIGHT]; /* the number of bytes by we are trying to add or remove from |
1412 | int insert_size[MAX_HEIGHT]; /* the number of bytes by we are trying to add or remove from | 1364 | S[h]. A negative value means removing. */ |
1413 | S[h]. A negative value means removing. */ | 1365 | int blknum[MAX_HEIGHT]; /* number of nodes that will replace node S[h] after |
1414 | int blknum[MAX_HEIGHT]; /* number of nodes that will replace node S[h] after | 1366 | balancing on the level h of the tree. If 0 then S is |
1415 | balancing on the level h of the tree. If 0 then S is | 1367 | being deleted, if 1 then S is remaining and no new nodes |
1416 | being deleted, if 1 then S is remaining and no new nodes | 1368 | are being created, if 2 or 3 then 1 or 2 new nodes is |
1417 | are being created, if 2 or 3 then 1 or 2 new nodes is | 1369 | being created */ |
1418 | being created */ | 1370 | |
1419 | 1371 | /* fields that are used only for balancing leaves of the tree */ | |
1420 | /* fields that are used only for balancing leaves of the tree */ | 1372 | int cur_blknum; /* number of empty blocks having been already allocated */ |
1421 | int cur_blknum; /* number of empty blocks having been already allocated */ | 1373 | int s0num; /* number of items that fall into left most node when S[0] splits */ |
1422 | int s0num; /* number of items that fall into left most node when S[0] splits */ | 1374 | int s1num; /* number of items that fall into first new node when S[0] splits */ |
1423 | int s1num; /* number of items that fall into first new node when S[0] splits */ | 1375 | int s2num; /* number of items that fall into second new node when S[0] splits */ |
1424 | int s2num; /* number of items that fall into second new node when S[0] splits */ | 1376 | int lbytes; /* number of bytes which can flow to the left neighbor from the left */ |
1425 | int lbytes; /* number of bytes which can flow to the left neighbor from the left */ | 1377 | /* most liquid item that cannot be shifted from S[0] entirely */ |
1426 | /* most liquid item that cannot be shifted from S[0] entirely */ | 1378 | /* if -1 then nothing will be partially shifted */ |
1427 | /* if -1 then nothing will be partially shifted */ | 1379 | int rbytes; /* number of bytes which will flow to the right neighbor from the right */ |
1428 | int rbytes; /* number of bytes which will flow to the right neighbor from the right */ | 1380 | /* most liquid item that cannot be shifted from S[0] entirely */ |
1429 | /* most liquid item that cannot be shifted from S[0] entirely */ | 1381 | /* if -1 then nothing will be partially shifted */ |
1430 | /* if -1 then nothing will be partially shifted */ | 1382 | int s1bytes; /* number of bytes which flow to the first new node when S[0] splits */ |
1431 | int s1bytes; /* number of bytes which flow to the first new node when S[0] splits */ | 1383 | /* note: if S[0] splits into 3 nodes, then items do not need to be cut */ |
1432 | /* note: if S[0] splits into 3 nodes, then items do not need to be cut */ | 1384 | int s2bytes; |
1433 | int s2bytes; | 1385 | struct buffer_head *buf_to_free[MAX_FREE_BLOCK]; /* buffers which are to be freed after do_balance finishes by unfix_nodes */ |
1434 | struct buffer_head * buf_to_free[MAX_FREE_BLOCK]; /* buffers which are to be freed after do_balance finishes by unfix_nodes */ | 1386 | char *vn_buf; /* kmalloced memory. Used to create |
1435 | char * vn_buf; /* kmalloced memory. Used to create | ||
1436 | virtual node and keep map of | 1387 | virtual node and keep map of |
1437 | dirtied bitmap blocks */ | 1388 | dirtied bitmap blocks */ |
1438 | int vn_buf_size; /* size of the vn_buf */ | 1389 | int vn_buf_size; /* size of the vn_buf */ |
1439 | struct virtual_node * tb_vn; /* VN starts after bitmap of bitmap blocks */ | 1390 | struct virtual_node *tb_vn; /* VN starts after bitmap of bitmap blocks */ |
1440 | 1391 | ||
1441 | int fs_gen; /* saved value of `reiserfs_generation' counter | 1392 | int fs_gen; /* saved value of `reiserfs_generation' counter |
1442 | see FILESYSTEM_CHANGED() macro in reiserfs_fs.h */ | 1393 | see FILESYSTEM_CHANGED() macro in reiserfs_fs.h */ |
1443 | #ifdef DISPLACE_NEW_PACKING_LOCALITIES | 1394 | #ifdef DISPLACE_NEW_PACKING_LOCALITIES |
1444 | struct in_core_key key; /* key pointer, to pass to block allocator or | 1395 | struct in_core_key key; /* key pointer, to pass to block allocator or |
1445 | another low-level subsystem */ | 1396 | another low-level subsystem */ |
1446 | #endif | 1397 | #endif |
1447 | } ; | 1398 | }; |
1448 | 1399 | ||
1449 | /* These are modes of balancing */ | 1400 | /* These are modes of balancing */ |
1450 | 1401 | ||
@@ -1479,13 +1430,12 @@ struct tree_balance | |||
1479 | /* used in do_balance for passing parent of node information that has | 1430 | /* used in do_balance for passing parent of node information that has |
1480 | been gotten from tb struct */ | 1431 | been gotten from tb struct */ |
1481 | struct buffer_info { | 1432 | struct buffer_info { |
1482 | struct tree_balance * tb; | 1433 | struct tree_balance *tb; |
1483 | struct buffer_head * bi_bh; | 1434 | struct buffer_head *bi_bh; |
1484 | struct buffer_head * bi_parent; | 1435 | struct buffer_head *bi_parent; |
1485 | int bi_position; | 1436 | int bi_position; |
1486 | }; | 1437 | }; |
1487 | 1438 | ||
1488 | |||
1489 | /* there are 4 types of items: stat data, directory item, indirect, direct. | 1439 | /* there are 4 types of items: stat data, directory item, indirect, direct. |
1490 | +-------------------+------------+--------------+------------+ | 1440 | +-------------------+------------+--------------+------------+ |
1491 | | | k_offset | k_uniqueness | mergeable? | | 1441 | | | k_offset | k_uniqueness | mergeable? | |
@@ -1503,24 +1453,24 @@ struct buffer_info { | |||
1503 | */ | 1453 | */ |
1504 | 1454 | ||
1505 | struct item_operations { | 1455 | struct item_operations { |
1506 | int (*bytes_number) (struct item_head * ih, int block_size); | 1456 | int (*bytes_number) (struct item_head * ih, int block_size); |
1507 | void (*decrement_key) (struct cpu_key *); | 1457 | void (*decrement_key) (struct cpu_key *); |
1508 | int (*is_left_mergeable) (struct reiserfs_key * ih, unsigned long bsize); | 1458 | int (*is_left_mergeable) (struct reiserfs_key * ih, |
1509 | void (*print_item) (struct item_head *, char * item); | 1459 | unsigned long bsize); |
1510 | void (*check_item) (struct item_head *, char * item); | 1460 | void (*print_item) (struct item_head *, char *item); |
1511 | 1461 | void (*check_item) (struct item_head *, char *item); | |
1512 | int (*create_vi) (struct virtual_node * vn, struct virtual_item * vi, | 1462 | |
1513 | int is_affected, int insert_size); | 1463 | int (*create_vi) (struct virtual_node * vn, struct virtual_item * vi, |
1514 | int (*check_left) (struct virtual_item * vi, int free, | 1464 | int is_affected, int insert_size); |
1515 | int start_skip, int end_skip); | 1465 | int (*check_left) (struct virtual_item * vi, int free, |
1516 | int (*check_right) (struct virtual_item * vi, int free); | 1466 | int start_skip, int end_skip); |
1517 | int (*part_size) (struct virtual_item * vi, int from, int to); | 1467 | int (*check_right) (struct virtual_item * vi, int free); |
1518 | int (*unit_num) (struct virtual_item * vi); | 1468 | int (*part_size) (struct virtual_item * vi, int from, int to); |
1519 | void (*print_vi) (struct virtual_item * vi); | 1469 | int (*unit_num) (struct virtual_item * vi); |
1470 | void (*print_vi) (struct virtual_item * vi); | ||
1520 | }; | 1471 | }; |
1521 | 1472 | ||
1522 | 1473 | extern struct item_operations *item_ops[TYPE_ANY + 1]; | |
1523 | extern struct item_operations * item_ops [TYPE_ANY + 1]; | ||
1524 | 1474 | ||
1525 | #define op_bytes_number(ih,bsize) item_ops[le_ih_k_type (ih)]->bytes_number (ih, bsize) | 1475 | #define op_bytes_number(ih,bsize) item_ops[le_ih_k_type (ih)]->bytes_number (ih, bsize) |
1526 | #define op_is_left_mergeable(key,bsize) item_ops[le_key_k_type (le_key_version (key), key)]->is_left_mergeable (key, bsize) | 1476 | #define op_is_left_mergeable(key,bsize) item_ops[le_key_k_type (le_key_version (key), key)]->is_left_mergeable (key, bsize) |
@@ -1533,8 +1483,6 @@ extern struct item_operations * item_ops [TYPE_ANY + 1]; | |||
1533 | #define op_unit_num(vi) item_ops[(vi)->vi_index]->unit_num (vi) | 1483 | #define op_unit_num(vi) item_ops[(vi)->vi_index]->unit_num (vi) |
1534 | #define op_print_vi(vi) item_ops[(vi)->vi_index]->print_vi (vi) | 1484 | #define op_print_vi(vi) item_ops[(vi)->vi_index]->print_vi (vi) |
1535 | 1485 | ||
1536 | |||
1537 | |||
1538 | #define COMP_SHORT_KEYS comp_short_keys | 1486 | #define COMP_SHORT_KEYS comp_short_keys |
1539 | 1487 | ||
1540 | /* number of blocks pointed to by the indirect item */ | 1488 | /* number of blocks pointed to by the indirect item */ |
@@ -1545,8 +1493,7 @@ extern struct item_operations * item_ops [TYPE_ANY + 1]; | |||
1545 | 1493 | ||
1546 | /* number of bytes contained by the direct item or the unformatted nodes the indirect item points to */ | 1494 | /* number of bytes contained by the direct item or the unformatted nodes the indirect item points to */ |
1547 | 1495 | ||
1548 | 1496 | /* get the item header */ | |
1549 | /* get the item header */ | ||
1550 | #define B_N_PITEM_HEAD(bh,item_num) ( (struct item_head * )((bh)->b_data + BLKH_SIZE) + (item_num) ) | 1497 | #define B_N_PITEM_HEAD(bh,item_num) ( (struct item_head * )((bh)->b_data + BLKH_SIZE) + (item_num) ) |
1551 | 1498 | ||
1552 | /* get key */ | 1499 | /* get key */ |
@@ -1577,9 +1524,9 @@ extern struct item_operations * item_ops [TYPE_ANY + 1]; | |||
1577 | #define PUT_B_I_POS_UNFM_POINTER(bh,ih,pos, val) do {*(((unp_t *)B_I_PITEM(bh,ih)) + (pos)) = cpu_to_le32(val); } while (0) | 1524 | #define PUT_B_I_POS_UNFM_POINTER(bh,ih,pos, val) do {*(((unp_t *)B_I_PITEM(bh,ih)) + (pos)) = cpu_to_le32(val); } while (0) |
1578 | 1525 | ||
1579 | struct reiserfs_iget_args { | 1526 | struct reiserfs_iget_args { |
1580 | __u32 objectid ; | 1527 | __u32 objectid; |
1581 | __u32 dirid ; | 1528 | __u32 dirid; |
1582 | } ; | 1529 | }; |
1583 | 1530 | ||
1584 | /***************************************************************************/ | 1531 | /***************************************************************************/ |
1585 | /* FUNCTION DECLARATIONS */ | 1532 | /* FUNCTION DECLARATIONS */ |
@@ -1595,11 +1542,11 @@ struct reiserfs_iget_args { | |||
1595 | 1542 | ||
1596 | /* first block written in a commit. */ | 1543 | /* first block written in a commit. */ |
1597 | struct reiserfs_journal_desc { | 1544 | struct reiserfs_journal_desc { |
1598 | __le32 j_trans_id ; /* id of commit */ | 1545 | __le32 j_trans_id; /* id of commit */ |
1599 | __le32 j_len ; /* length of commit. len +1 is the commit block */ | 1546 | __le32 j_len; /* length of commit. len +1 is the commit block */ |
1600 | __le32 j_mount_id ; /* mount id of this trans*/ | 1547 | __le32 j_mount_id; /* mount id of this trans */ |
1601 | __le32 j_realblock[1] ; /* real locations for each block */ | 1548 | __le32 j_realblock[1]; /* real locations for each block */ |
1602 | } ; | 1549 | }; |
1603 | 1550 | ||
1604 | #define get_desc_trans_id(d) le32_to_cpu((d)->j_trans_id) | 1551 | #define get_desc_trans_id(d) le32_to_cpu((d)->j_trans_id) |
1605 | #define get_desc_trans_len(d) le32_to_cpu((d)->j_len) | 1552 | #define get_desc_trans_len(d) le32_to_cpu((d)->j_len) |
@@ -1611,10 +1558,10 @@ struct reiserfs_journal_desc { | |||
1611 | 1558 | ||
1612 | /* last block written in a commit */ | 1559 | /* last block written in a commit */ |
1613 | struct reiserfs_journal_commit { | 1560 | struct reiserfs_journal_commit { |
1614 | __le32 j_trans_id ; /* must match j_trans_id from the desc block */ | 1561 | __le32 j_trans_id; /* must match j_trans_id from the desc block */ |
1615 | __le32 j_len ; /* ditto */ | 1562 | __le32 j_len; /* ditto */ |
1616 | __le32 j_realblock[1] ; /* real locations for each block */ | 1563 | __le32 j_realblock[1]; /* real locations for each block */ |
1617 | } ; | 1564 | }; |
1618 | 1565 | ||
1619 | #define get_commit_trans_id(c) le32_to_cpu((c)->j_trans_id) | 1566 | #define get_commit_trans_id(c) le32_to_cpu((c)->j_trans_id) |
1620 | #define get_commit_trans_len(c) le32_to_cpu((c)->j_len) | 1567 | #define get_commit_trans_len(c) le32_to_cpu((c)->j_len) |
@@ -1628,19 +1575,19 @@ struct reiserfs_journal_commit { | |||
1628 | ** and this transaction does not need to be replayed. | 1575 | ** and this transaction does not need to be replayed. |
1629 | */ | 1576 | */ |
1630 | struct reiserfs_journal_header { | 1577 | struct reiserfs_journal_header { |
1631 | __le32 j_last_flush_trans_id ; /* id of last fully flushed transaction */ | 1578 | __le32 j_last_flush_trans_id; /* id of last fully flushed transaction */ |
1632 | __le32 j_first_unflushed_offset ; /* offset in the log of where to start replay after a crash */ | 1579 | __le32 j_first_unflushed_offset; /* offset in the log of where to start replay after a crash */ |
1633 | __le32 j_mount_id ; | 1580 | __le32 j_mount_id; |
1634 | /* 12 */ struct journal_params jh_journal; | 1581 | /* 12 */ struct journal_params jh_journal; |
1635 | } ; | 1582 | }; |
1636 | 1583 | ||
1637 | /* biggest tunable defines are right here */ | 1584 | /* biggest tunable defines are right here */ |
1638 | #define JOURNAL_BLOCK_COUNT 8192 /* number of blocks in the journal */ | 1585 | #define JOURNAL_BLOCK_COUNT 8192 /* number of blocks in the journal */ |
1639 | #define JOURNAL_TRANS_MAX_DEFAULT 1024 /* biggest possible single transaction, don't change for now (8/3/99) */ | 1586 | #define JOURNAL_TRANS_MAX_DEFAULT 1024 /* biggest possible single transaction, don't change for now (8/3/99) */ |
1640 | #define JOURNAL_TRANS_MIN_DEFAULT 256 | 1587 | #define JOURNAL_TRANS_MIN_DEFAULT 256 |
1641 | #define JOURNAL_MAX_BATCH_DEFAULT 900 /* max blocks to batch into one transaction, don't make this any bigger than 900 */ | 1588 | #define JOURNAL_MAX_BATCH_DEFAULT 900 /* max blocks to batch into one transaction, don't make this any bigger than 900 */ |
1642 | #define JOURNAL_MIN_RATIO 2 | 1589 | #define JOURNAL_MIN_RATIO 2 |
1643 | #define JOURNAL_MAX_COMMIT_AGE 30 | 1590 | #define JOURNAL_MAX_COMMIT_AGE 30 |
1644 | #define JOURNAL_MAX_TRANS_AGE 30 | 1591 | #define JOURNAL_MAX_TRANS_AGE 30 |
1645 | #define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9) | 1592 | #define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9) |
1646 | #ifdef CONFIG_QUOTA | 1593 | #ifdef CONFIG_QUOTA |
@@ -1664,10 +1611,10 @@ struct reiserfs_journal_header { | |||
1664 | ** the current number of nodes is > max, the node is freed, otherwise, | 1611 | ** the current number of nodes is > max, the node is freed, otherwise, |
1665 | ** it is put on a free list for faster use later. | 1612 | ** it is put on a free list for faster use later. |
1666 | */ | 1613 | */ |
1667 | #define REISERFS_MIN_BITMAP_NODES 10 | 1614 | #define REISERFS_MIN_BITMAP_NODES 10 |
1668 | #define REISERFS_MAX_BITMAP_NODES 100 | 1615 | #define REISERFS_MAX_BITMAP_NODES 100 |
1669 | 1616 | ||
1670 | #define JBH_HASH_SHIFT 13 /* these are based on journal hash size of 8192 */ | 1617 | #define JBH_HASH_SHIFT 13 /* these are based on journal hash size of 8192 */ |
1671 | #define JBH_HASH_MASK 8191 | 1618 | #define JBH_HASH_MASK 8191 |
1672 | 1619 | ||
1673 | #define _jhashfn(sb,block) \ | 1620 | #define _jhashfn(sb,block) \ |
@@ -1681,14 +1628,14 @@ struct reiserfs_journal_header { | |||
1681 | #define journal_bread(s, block) __bread(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize) | 1628 | #define journal_bread(s, block) __bread(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize) |
1682 | 1629 | ||
1683 | enum reiserfs_bh_state_bits { | 1630 | enum reiserfs_bh_state_bits { |
1684 | BH_JDirty = BH_PrivateStart, /* buffer is in current transaction */ | 1631 | BH_JDirty = BH_PrivateStart, /* buffer is in current transaction */ |
1685 | BH_JDirty_wait, | 1632 | BH_JDirty_wait, |
1686 | BH_JNew, /* disk block was taken off free list before | 1633 | BH_JNew, /* disk block was taken off free list before |
1687 | * being in a finished transaction, or | 1634 | * being in a finished transaction, or |
1688 | * written to disk. Can be reused immed. */ | 1635 | * written to disk. Can be reused immed. */ |
1689 | BH_JPrepared, | 1636 | BH_JPrepared, |
1690 | BH_JRestore_dirty, | 1637 | BH_JRestore_dirty, |
1691 | BH_JTest, // debugging only will go away | 1638 | BH_JTest, // debugging only will go away |
1692 | }; | 1639 | }; |
1693 | 1640 | ||
1694 | BUFFER_FNS(JDirty, journaled); | 1641 | BUFFER_FNS(JDirty, journaled); |
@@ -1708,175 +1655,192 @@ TAS_BUFFER_FNS(JTest, journal_test); | |||
1708 | ** transaction handle which is passed around for all journal calls | 1655 | ** transaction handle which is passed around for all journal calls |
1709 | */ | 1656 | */ |
1710 | struct reiserfs_transaction_handle { | 1657 | struct reiserfs_transaction_handle { |
1711 | struct super_block *t_super ; /* super for this FS when journal_begin was | 1658 | struct super_block *t_super; /* super for this FS when journal_begin was |
1712 | called. saves calls to reiserfs_get_super | 1659 | called. saves calls to reiserfs_get_super |
1713 | also used by nested transactions to make | 1660 | also used by nested transactions to make |
1714 | sure they are nesting on the right FS | 1661 | sure they are nesting on the right FS |
1715 | _must_ be first in the handle | 1662 | _must_ be first in the handle |
1716 | */ | 1663 | */ |
1717 | int t_refcount; | 1664 | int t_refcount; |
1718 | int t_blocks_logged ; /* number of blocks this writer has logged */ | 1665 | int t_blocks_logged; /* number of blocks this writer has logged */ |
1719 | int t_blocks_allocated ; /* number of blocks this writer allocated */ | 1666 | int t_blocks_allocated; /* number of blocks this writer allocated */ |
1720 | unsigned long t_trans_id ; /* sanity check, equals the current trans id */ | 1667 | unsigned long t_trans_id; /* sanity check, equals the current trans id */ |
1721 | void *t_handle_save ; /* save existing current->journal_info */ | 1668 | void *t_handle_save; /* save existing current->journal_info */ |
1722 | unsigned displace_new_blocks:1; /* if new block allocation occurres, that block | 1669 | unsigned displace_new_blocks:1; /* if new block allocation occurres, that block |
1723 | should be displaced from others */ | 1670 | should be displaced from others */ |
1724 | struct list_head t_list; | 1671 | struct list_head t_list; |
1725 | } ; | 1672 | }; |
1726 | 1673 | ||
1727 | /* used to keep track of ordered and tail writes, attached to the buffer | 1674 | /* used to keep track of ordered and tail writes, attached to the buffer |
1728 | * head through b_journal_head. | 1675 | * head through b_journal_head. |
1729 | */ | 1676 | */ |
1730 | struct reiserfs_jh { | 1677 | struct reiserfs_jh { |
1731 | struct reiserfs_journal_list *jl; | 1678 | struct reiserfs_journal_list *jl; |
1732 | struct buffer_head *bh; | 1679 | struct buffer_head *bh; |
1733 | struct list_head list; | 1680 | struct list_head list; |
1734 | }; | 1681 | }; |
1735 | 1682 | ||
1736 | void reiserfs_free_jh(struct buffer_head *bh); | 1683 | void reiserfs_free_jh(struct buffer_head *bh); |
1737 | int reiserfs_add_tail_list(struct inode *inode, struct buffer_head *bh); | 1684 | int reiserfs_add_tail_list(struct inode *inode, struct buffer_head *bh); |
1738 | int reiserfs_add_ordered_list(struct inode *inode, struct buffer_head *bh); | 1685 | int reiserfs_add_ordered_list(struct inode *inode, struct buffer_head *bh); |
1739 | int journal_mark_dirty(struct reiserfs_transaction_handle *, struct super_block *, struct buffer_head *bh) ; | 1686 | int journal_mark_dirty(struct reiserfs_transaction_handle *, |
1740 | 1687 | struct super_block *, struct buffer_head *bh); | |
1741 | static inline int | 1688 | |
1742 | reiserfs_file_data_log(struct inode *inode) { | 1689 | static inline int reiserfs_file_data_log(struct inode *inode) |
1743 | if (reiserfs_data_log(inode->i_sb) || | 1690 | { |
1744 | (REISERFS_I(inode)->i_flags & i_data_log)) | 1691 | if (reiserfs_data_log(inode->i_sb) || |
1745 | return 1 ; | 1692 | (REISERFS_I(inode)->i_flags & i_data_log)) |
1746 | return 0 ; | 1693 | return 1; |
1694 | return 0; | ||
1747 | } | 1695 | } |
1748 | 1696 | ||
1749 | static inline int reiserfs_transaction_running(struct super_block *s) { | 1697 | static inline int reiserfs_transaction_running(struct super_block *s) |
1750 | struct reiserfs_transaction_handle *th = current->journal_info ; | 1698 | { |
1751 | if (th && th->t_super == s) | 1699 | struct reiserfs_transaction_handle *th = current->journal_info; |
1752 | return 1 ; | 1700 | if (th && th->t_super == s) |
1753 | if (th && th->t_super == NULL) | 1701 | return 1; |
1754 | BUG(); | 1702 | if (th && th->t_super == NULL) |
1755 | return 0 ; | 1703 | BUG(); |
1704 | return 0; | ||
1756 | } | 1705 | } |
1757 | 1706 | ||
1758 | int reiserfs_async_progress_wait(struct super_block *s); | 1707 | int reiserfs_async_progress_wait(struct super_block *s); |
1759 | 1708 | ||
1760 | struct reiserfs_transaction_handle * | 1709 | struct reiserfs_transaction_handle *reiserfs_persistent_transaction(struct |
1761 | reiserfs_persistent_transaction(struct super_block *, int count); | 1710 | super_block |
1711 | *, | ||
1712 | int count); | ||
1762 | int reiserfs_end_persistent_transaction(struct reiserfs_transaction_handle *); | 1713 | int reiserfs_end_persistent_transaction(struct reiserfs_transaction_handle *); |
1763 | int reiserfs_commit_page(struct inode *inode, struct page *page, | 1714 | int reiserfs_commit_page(struct inode *inode, struct page *page, |
1764 | unsigned from, unsigned to); | 1715 | unsigned from, unsigned to); |
1765 | int reiserfs_flush_old_commits(struct super_block *); | 1716 | int reiserfs_flush_old_commits(struct super_block *); |
1766 | int reiserfs_commit_for_inode(struct inode *) ; | 1717 | int reiserfs_commit_for_inode(struct inode *); |
1767 | int reiserfs_inode_needs_commit(struct inode *) ; | 1718 | int reiserfs_inode_needs_commit(struct inode *); |
1768 | void reiserfs_update_inode_transaction(struct inode *) ; | 1719 | void reiserfs_update_inode_transaction(struct inode *); |
1769 | void reiserfs_wait_on_write_block(struct super_block *s) ; | 1720 | void reiserfs_wait_on_write_block(struct super_block *s); |
1770 | void reiserfs_block_writes(struct reiserfs_transaction_handle *th) ; | 1721 | void reiserfs_block_writes(struct reiserfs_transaction_handle *th); |
1771 | void reiserfs_allow_writes(struct super_block *s) ; | 1722 | void reiserfs_allow_writes(struct super_block *s); |
1772 | void reiserfs_check_lock_depth(struct super_block *s, char *caller) ; | 1723 | void reiserfs_check_lock_depth(struct super_block *s, char *caller); |
1773 | int reiserfs_prepare_for_journal(struct super_block *, struct buffer_head *bh, int wait) ; | 1724 | int reiserfs_prepare_for_journal(struct super_block *, struct buffer_head *bh, |
1774 | void reiserfs_restore_prepared_buffer(struct super_block *, struct buffer_head *bh) ; | 1725 | int wait); |
1775 | int journal_init(struct super_block *, const char * j_dev_name, int old_format, unsigned int) ; | 1726 | void reiserfs_restore_prepared_buffer(struct super_block *, |
1776 | int journal_release(struct reiserfs_transaction_handle*, struct super_block *) ; | 1727 | struct buffer_head *bh); |
1777 | int journal_release_error(struct reiserfs_transaction_handle*, struct super_block *) ; | 1728 | int journal_init(struct super_block *, const char *j_dev_name, int old_format, |
1778 | int journal_end(struct reiserfs_transaction_handle *, struct super_block *, unsigned long) ; | 1729 | unsigned int); |
1779 | int journal_end_sync(struct reiserfs_transaction_handle *, struct super_block *, unsigned long) ; | 1730 | int journal_release(struct reiserfs_transaction_handle *, struct super_block *); |
1780 | int journal_mark_freed(struct reiserfs_transaction_handle *, struct super_block *, b_blocknr_t blocknr) ; | 1731 | int journal_release_error(struct reiserfs_transaction_handle *, |
1781 | int journal_transaction_should_end(struct reiserfs_transaction_handle *, int) ; | 1732 | struct super_block *); |
1782 | int reiserfs_in_journal(struct super_block *p_s_sb, int bmap_nr, int bit_nr, int searchall, b_blocknr_t *next) ; | 1733 | int journal_end(struct reiserfs_transaction_handle *, struct super_block *, |
1783 | int journal_begin(struct reiserfs_transaction_handle *, struct super_block *p_s_sb, unsigned long) ; | 1734 | unsigned long); |
1784 | int journal_join_abort(struct reiserfs_transaction_handle *, struct super_block *p_s_sb, unsigned long) ; | 1735 | int journal_end_sync(struct reiserfs_transaction_handle *, struct super_block *, |
1785 | void reiserfs_journal_abort (struct super_block *sb, int errno); | 1736 | unsigned long); |
1786 | void reiserfs_abort (struct super_block *sb, int errno, const char *fmt, ...); | 1737 | int journal_mark_freed(struct reiserfs_transaction_handle *, |
1787 | int reiserfs_allocate_list_bitmaps(struct super_block *s, struct reiserfs_list_bitmap *, int) ; | 1738 | struct super_block *, b_blocknr_t blocknr); |
1788 | 1739 | int journal_transaction_should_end(struct reiserfs_transaction_handle *, int); | |
1789 | void add_save_link (struct reiserfs_transaction_handle * th, | 1740 | int reiserfs_in_journal(struct super_block *p_s_sb, int bmap_nr, int bit_nr, |
1790 | struct inode * inode, int truncate); | 1741 | int searchall, b_blocknr_t * next); |
1791 | int remove_save_link (struct inode * inode, int truncate); | 1742 | int journal_begin(struct reiserfs_transaction_handle *, |
1743 | struct super_block *p_s_sb, unsigned long); | ||
1744 | int journal_join_abort(struct reiserfs_transaction_handle *, | ||
1745 | struct super_block *p_s_sb, unsigned long); | ||
1746 | void reiserfs_journal_abort(struct super_block *sb, int errno); | ||
1747 | void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...); | ||
1748 | int reiserfs_allocate_list_bitmaps(struct super_block *s, | ||
1749 | struct reiserfs_list_bitmap *, int); | ||
1750 | |||
1751 | void add_save_link(struct reiserfs_transaction_handle *th, | ||
1752 | struct inode *inode, int truncate); | ||
1753 | int remove_save_link(struct inode *inode, int truncate); | ||
1792 | 1754 | ||
1793 | /* objectid.c */ | 1755 | /* objectid.c */ |
1794 | __u32 reiserfs_get_unused_objectid (struct reiserfs_transaction_handle *th); | 1756 | __u32 reiserfs_get_unused_objectid(struct reiserfs_transaction_handle *th); |
1795 | void reiserfs_release_objectid (struct reiserfs_transaction_handle *th, __u32 objectid_to_release); | 1757 | void reiserfs_release_objectid(struct reiserfs_transaction_handle *th, |
1796 | int reiserfs_convert_objectid_map_v1(struct super_block *) ; | 1758 | __u32 objectid_to_release); |
1759 | int reiserfs_convert_objectid_map_v1(struct super_block *); | ||
1797 | 1760 | ||
1798 | /* stree.c */ | 1761 | /* stree.c */ |
1799 | int B_IS_IN_TREE(const struct buffer_head *); | 1762 | int B_IS_IN_TREE(const struct buffer_head *); |
1800 | extern void copy_item_head(struct item_head * p_v_to, | 1763 | extern void copy_item_head(struct item_head *p_v_to, |
1801 | const struct item_head * p_v_from); | 1764 | const struct item_head *p_v_from); |
1802 | 1765 | ||
1803 | // first key is in cpu form, second - le | 1766 | // first key is in cpu form, second - le |
1804 | extern int comp_short_keys (const struct reiserfs_key * le_key, | 1767 | extern int comp_short_keys(const struct reiserfs_key *le_key, |
1805 | const struct cpu_key * cpu_key); | 1768 | const struct cpu_key *cpu_key); |
1806 | extern void le_key2cpu_key (struct cpu_key * to, const struct reiserfs_key * from); | 1769 | extern void le_key2cpu_key(struct cpu_key *to, const struct reiserfs_key *from); |
1807 | 1770 | ||
1808 | // both are in le form | 1771 | // both are in le form |
1809 | extern int comp_le_keys (const struct reiserfs_key *, const struct reiserfs_key *); | 1772 | extern int comp_le_keys(const struct reiserfs_key *, |
1810 | extern int comp_short_le_keys (const struct reiserfs_key *, const struct reiserfs_key *); | 1773 | const struct reiserfs_key *); |
1774 | extern int comp_short_le_keys(const struct reiserfs_key *, | ||
1775 | const struct reiserfs_key *); | ||
1811 | 1776 | ||
1812 | // | 1777 | // |
1813 | // get key version from on disk key - kludge | 1778 | // get key version from on disk key - kludge |
1814 | // | 1779 | // |
1815 | static inline int le_key_version (const struct reiserfs_key * key) | 1780 | static inline int le_key_version(const struct reiserfs_key *key) |
1816 | { | 1781 | { |
1817 | int type; | 1782 | int type; |
1818 | |||
1819 | type = offset_v2_k_type( &(key->u.k_offset_v2)); | ||
1820 | if (type != TYPE_DIRECT && type != TYPE_INDIRECT && type != TYPE_DIRENTRY) | ||
1821 | return KEY_FORMAT_3_5; | ||
1822 | |||
1823 | return KEY_FORMAT_3_6; | ||
1824 | |||
1825 | } | ||
1826 | 1783 | ||
1784 | type = offset_v2_k_type(&(key->u.k_offset_v2)); | ||
1785 | if (type != TYPE_DIRECT && type != TYPE_INDIRECT | ||
1786 | && type != TYPE_DIRENTRY) | ||
1787 | return KEY_FORMAT_3_5; | ||
1788 | |||
1789 | return KEY_FORMAT_3_6; | ||
1827 | 1790 | ||
1828 | static inline void copy_key (struct reiserfs_key *to, const struct reiserfs_key *from) | ||
1829 | { | ||
1830 | memcpy (to, from, KEY_SIZE); | ||
1831 | } | 1791 | } |
1832 | 1792 | ||
1793 | static inline void copy_key(struct reiserfs_key *to, | ||
1794 | const struct reiserfs_key *from) | ||
1795 | { | ||
1796 | memcpy(to, from, KEY_SIZE); | ||
1797 | } | ||
1833 | 1798 | ||
1834 | int comp_items (const struct item_head * stored_ih, const struct path * p_s_path); | 1799 | int comp_items(const struct item_head *stored_ih, const struct path *p_s_path); |
1835 | const struct reiserfs_key * get_rkey (const struct path * p_s_chk_path, | 1800 | const struct reiserfs_key *get_rkey(const struct path *p_s_chk_path, |
1836 | const struct super_block * p_s_sb); | 1801 | const struct super_block *p_s_sb); |
1837 | int search_by_key (struct super_block *, const struct cpu_key *, | 1802 | int search_by_key(struct super_block *, const struct cpu_key *, |
1838 | struct path *, int); | 1803 | struct path *, int); |
1839 | #define search_item(s,key,path) search_by_key (s, key, path, DISK_LEAF_NODE_LEVEL) | 1804 | #define search_item(s,key,path) search_by_key (s, key, path, DISK_LEAF_NODE_LEVEL) |
1840 | int search_for_position_by_key (struct super_block * p_s_sb, | 1805 | int search_for_position_by_key(struct super_block *p_s_sb, |
1841 | const struct cpu_key * p_s_cpu_key, | 1806 | const struct cpu_key *p_s_cpu_key, |
1842 | struct path * p_s_search_path); | 1807 | struct path *p_s_search_path); |
1843 | extern void decrement_bcount (struct buffer_head * p_s_bh); | 1808 | extern void decrement_bcount(struct buffer_head *p_s_bh); |
1844 | void decrement_counters_in_path (struct path * p_s_search_path); | 1809 | void decrement_counters_in_path(struct path *p_s_search_path); |
1845 | void pathrelse (struct path * p_s_search_path); | 1810 | void pathrelse(struct path *p_s_search_path); |
1846 | int reiserfs_check_path(struct path *p) ; | 1811 | int reiserfs_check_path(struct path *p); |
1847 | void pathrelse_and_restore (struct super_block *s, struct path * p_s_search_path); | 1812 | void pathrelse_and_restore(struct super_block *s, struct path *p_s_search_path); |
1848 | 1813 | ||
1849 | int reiserfs_insert_item (struct reiserfs_transaction_handle *th, | 1814 | int reiserfs_insert_item(struct reiserfs_transaction_handle *th, |
1850 | struct path * path, | 1815 | struct path *path, |
1851 | const struct cpu_key * key, | 1816 | const struct cpu_key *key, |
1852 | struct item_head * ih, | 1817 | struct item_head *ih, |
1853 | struct inode *inode, const char * body); | 1818 | struct inode *inode, const char *body); |
1854 | 1819 | ||
1855 | int reiserfs_paste_into_item (struct reiserfs_transaction_handle *th, | 1820 | int reiserfs_paste_into_item(struct reiserfs_transaction_handle *th, |
1856 | struct path * path, | 1821 | struct path *path, |
1857 | const struct cpu_key * key, | 1822 | const struct cpu_key *key, |
1858 | struct inode *inode, | 1823 | struct inode *inode, |
1859 | const char * body, int paste_size); | 1824 | const char *body, int paste_size); |
1860 | 1825 | ||
1861 | int reiserfs_cut_from_item (struct reiserfs_transaction_handle *th, | 1826 | int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th, |
1862 | struct path * path, | 1827 | struct path *path, |
1863 | struct cpu_key * key, | 1828 | struct cpu_key *key, |
1864 | struct inode * inode, | 1829 | struct inode *inode, |
1865 | struct page *page, | 1830 | struct page *page, loff_t new_file_size); |
1866 | loff_t new_file_size); | 1831 | |
1867 | 1832 | int reiserfs_delete_item(struct reiserfs_transaction_handle *th, | |
1868 | int reiserfs_delete_item (struct reiserfs_transaction_handle *th, | 1833 | struct path *path, |
1869 | struct path * path, | 1834 | const struct cpu_key *key, |
1870 | const struct cpu_key * key, | 1835 | struct inode *inode, struct buffer_head *p_s_un_bh); |
1871 | struct inode * inode, | 1836 | |
1872 | struct buffer_head * p_s_un_bh); | 1837 | void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th, |
1873 | 1838 | struct inode *inode, struct reiserfs_key *key); | |
1874 | void reiserfs_delete_solid_item (struct reiserfs_transaction_handle *th, | 1839 | int reiserfs_delete_object(struct reiserfs_transaction_handle *th, |
1875 | struct inode *inode, struct reiserfs_key * key); | 1840 | struct inode *p_s_inode); |
1876 | int reiserfs_delete_object (struct reiserfs_transaction_handle *th, struct inode * p_s_inode); | 1841 | int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, |
1877 | int reiserfs_do_truncate (struct reiserfs_transaction_handle *th, | 1842 | struct inode *p_s_inode, struct page *, |
1878 | struct inode * p_s_inode, struct page *, | 1843 | int update_timestamps); |
1879 | int update_timestamps); | ||
1880 | 1844 | ||
1881 | #define i_block_size(inode) ((inode)->i_sb->s_blocksize) | 1845 | #define i_block_size(inode) ((inode)->i_sb->s_blocksize) |
1882 | #define file_size(inode) ((inode)->i_size) | 1846 | #define file_size(inode) ((inode)->i_size) |
@@ -1885,66 +1849,67 @@ int reiserfs_do_truncate (struct reiserfs_transaction_handle *th, | |||
1885 | #define tail_has_to_be_packed(inode) (have_large_tails ((inode)->i_sb)?\ | 1849 | #define tail_has_to_be_packed(inode) (have_large_tails ((inode)->i_sb)?\ |
1886 | !STORE_TAIL_IN_UNFM_S1(file_size (inode), tail_size(inode), inode->i_sb->s_blocksize):have_small_tails ((inode)->i_sb)?!STORE_TAIL_IN_UNFM_S2(file_size (inode), tail_size(inode), inode->i_sb->s_blocksize):0 ) | 1850 | !STORE_TAIL_IN_UNFM_S1(file_size (inode), tail_size(inode), inode->i_sb->s_blocksize):have_small_tails ((inode)->i_sb)?!STORE_TAIL_IN_UNFM_S2(file_size (inode), tail_size(inode), inode->i_sb->s_blocksize):0 ) |
1887 | 1851 | ||
1888 | void padd_item (char * item, int total_length, int length); | 1852 | void padd_item(char *item, int total_length, int length); |
1889 | 1853 | ||
1890 | /* inode.c */ | 1854 | /* inode.c */ |
1891 | /* args for the create parameter of reiserfs_get_block */ | 1855 | /* args for the create parameter of reiserfs_get_block */ |
1892 | #define GET_BLOCK_NO_CREATE 0 /* don't create new blocks or convert tails */ | 1856 | #define GET_BLOCK_NO_CREATE 0 /* don't create new blocks or convert tails */ |
1893 | #define GET_BLOCK_CREATE 1 /* add anything you need to find block */ | 1857 | #define GET_BLOCK_CREATE 1 /* add anything you need to find block */ |
1894 | #define GET_BLOCK_NO_HOLE 2 /* return -ENOENT for file holes */ | 1858 | #define GET_BLOCK_NO_HOLE 2 /* return -ENOENT for file holes */ |
1895 | #define GET_BLOCK_READ_DIRECT 4 /* read the tail if indirect item not found */ | 1859 | #define GET_BLOCK_READ_DIRECT 4 /* read the tail if indirect item not found */ |
1896 | #define GET_BLOCK_NO_ISEM 8 /* i_sem is not held, don't preallocate */ | 1860 | #define GET_BLOCK_NO_ISEM 8 /* i_sem is not held, don't preallocate */ |
1897 | #define GET_BLOCK_NO_DANGLE 16 /* don't leave any transactions running */ | 1861 | #define GET_BLOCK_NO_DANGLE 16 /* don't leave any transactions running */ |
1898 | 1862 | ||
1899 | int restart_transaction(struct reiserfs_transaction_handle *th, struct inode *inode, struct path *path); | 1863 | int restart_transaction(struct reiserfs_transaction_handle *th, |
1900 | void reiserfs_read_locked_inode(struct inode * inode, struct reiserfs_iget_args *args) ; | 1864 | struct inode *inode, struct path *path); |
1901 | int reiserfs_find_actor(struct inode * inode, void *p) ; | 1865 | void reiserfs_read_locked_inode(struct inode *inode, |
1902 | int reiserfs_init_locked_inode(struct inode * inode, void *p) ; | 1866 | struct reiserfs_iget_args *args); |
1903 | void reiserfs_delete_inode (struct inode * inode); | 1867 | int reiserfs_find_actor(struct inode *inode, void *p); |
1904 | int reiserfs_write_inode (struct inode * inode, int) ; | 1868 | int reiserfs_init_locked_inode(struct inode *inode, void *p); |
1905 | int reiserfs_get_block (struct inode * inode, sector_t block, struct buffer_head * bh_result, int create); | 1869 | void reiserfs_delete_inode(struct inode *inode); |
1906 | struct dentry *reiserfs_get_dentry(struct super_block *, void *) ; | 1870 | int reiserfs_write_inode(struct inode *inode, int); |
1907 | struct dentry *reiserfs_decode_fh(struct super_block *sb, __u32 *data, | 1871 | int reiserfs_get_block(struct inode *inode, sector_t block, |
1908 | int len, int fhtype, | 1872 | struct buffer_head *bh_result, int create); |
1909 | int (*acceptable)(void *contect, struct dentry *de), | 1873 | struct dentry *reiserfs_get_dentry(struct super_block *, void *); |
1910 | void *context) ; | 1874 | struct dentry *reiserfs_decode_fh(struct super_block *sb, __u32 * data, |
1911 | int reiserfs_encode_fh( struct dentry *dentry, __u32 *data, int *lenp, | 1875 | int len, int fhtype, |
1912 | int connectable ); | 1876 | int (*acceptable) (void *contect, |
1913 | 1877 | struct dentry * de), | |
1914 | int reiserfs_truncate_file(struct inode *, int update_timestamps) ; | 1878 | void *context); |
1915 | void make_cpu_key (struct cpu_key * cpu_key, struct inode * inode, loff_t offset, | 1879 | int reiserfs_encode_fh(struct dentry *dentry, __u32 * data, int *lenp, |
1916 | int type, int key_length); | 1880 | int connectable); |
1917 | void make_le_item_head (struct item_head * ih, const struct cpu_key * key, | 1881 | |
1918 | int version, | 1882 | int reiserfs_truncate_file(struct inode *, int update_timestamps); |
1919 | loff_t offset, int type, int length, int entry_count); | 1883 | void make_cpu_key(struct cpu_key *cpu_key, struct inode *inode, loff_t offset, |
1920 | struct inode * reiserfs_iget (struct super_block * s, | 1884 | int type, int key_length); |
1921 | const struct cpu_key * key); | 1885 | void make_le_item_head(struct item_head *ih, const struct cpu_key *key, |
1922 | 1886 | int version, | |
1923 | 1887 | loff_t offset, int type, int length, int entry_count); | |
1924 | int reiserfs_new_inode (struct reiserfs_transaction_handle *th, | 1888 | struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key); |
1925 | struct inode * dir, int mode, | 1889 | |
1926 | const char * symname, loff_t i_size, | 1890 | int reiserfs_new_inode(struct reiserfs_transaction_handle *th, |
1927 | struct dentry *dentry, struct inode *inode); | 1891 | struct inode *dir, int mode, |
1928 | 1892 | const char *symname, loff_t i_size, | |
1929 | void reiserfs_update_sd_size (struct reiserfs_transaction_handle *th, | 1893 | struct dentry *dentry, struct inode *inode); |
1930 | struct inode * inode, loff_t size); | 1894 | |
1895 | void reiserfs_update_sd_size(struct reiserfs_transaction_handle *th, | ||
1896 | struct inode *inode, loff_t size); | ||
1931 | 1897 | ||
1932 | static inline void reiserfs_update_sd(struct reiserfs_transaction_handle *th, | 1898 | static inline void reiserfs_update_sd(struct reiserfs_transaction_handle *th, |
1933 | struct inode *inode) | 1899 | struct inode *inode) |
1934 | { | 1900 | { |
1935 | reiserfs_update_sd_size(th, inode, inode->i_size) ; | 1901 | reiserfs_update_sd_size(th, inode, inode->i_size); |
1936 | } | 1902 | } |
1937 | 1903 | ||
1938 | void sd_attrs_to_i_attrs( __u16 sd_attrs, struct inode *inode ); | 1904 | void sd_attrs_to_i_attrs(__u16 sd_attrs, struct inode *inode); |
1939 | void i_attrs_to_sd_attrs( struct inode *inode, __u16 *sd_attrs ); | 1905 | void i_attrs_to_sd_attrs(struct inode *inode, __u16 * sd_attrs); |
1940 | int reiserfs_setattr(struct dentry *dentry, struct iattr *attr); | 1906 | int reiserfs_setattr(struct dentry *dentry, struct iattr *attr); |
1941 | 1907 | ||
1942 | /* namei.c */ | 1908 | /* namei.c */ |
1943 | void set_de_name_and_namelen (struct reiserfs_dir_entry * de); | 1909 | void set_de_name_and_namelen(struct reiserfs_dir_entry *de); |
1944 | int search_by_entry_key (struct super_block * sb, const struct cpu_key * key, | 1910 | int search_by_entry_key(struct super_block *sb, const struct cpu_key *key, |
1945 | struct path * path, | 1911 | struct path *path, struct reiserfs_dir_entry *de); |
1946 | struct reiserfs_dir_entry * de); | 1912 | struct dentry *reiserfs_get_parent(struct dentry *); |
1947 | struct dentry *reiserfs_get_parent(struct dentry *) ; | ||
1948 | /* procfs.c */ | 1913 | /* procfs.c */ |
1949 | 1914 | ||
1950 | #if defined( CONFIG_PROC_FS ) && defined( CONFIG_REISERFS_PROC_INFO ) | 1915 | #if defined( CONFIG_PROC_FS ) && defined( CONFIG_REISERFS_PROC_INFO ) |
@@ -1953,15 +1918,15 @@ struct dentry *reiserfs_get_parent(struct dentry *) ; | |||
1953 | #undef REISERFS_PROC_INFO | 1918 | #undef REISERFS_PROC_INFO |
1954 | #endif | 1919 | #endif |
1955 | 1920 | ||
1956 | int reiserfs_proc_info_init( struct super_block *sb ); | 1921 | int reiserfs_proc_info_init(struct super_block *sb); |
1957 | int reiserfs_proc_info_done( struct super_block *sb ); | 1922 | int reiserfs_proc_info_done(struct super_block *sb); |
1958 | struct proc_dir_entry *reiserfs_proc_register_global( char *name, | 1923 | struct proc_dir_entry *reiserfs_proc_register_global(char *name, |
1959 | read_proc_t *func ); | 1924 | read_proc_t * func); |
1960 | void reiserfs_proc_unregister_global( const char *name ); | 1925 | void reiserfs_proc_unregister_global(const char *name); |
1961 | int reiserfs_proc_info_global_init( void ); | 1926 | int reiserfs_proc_info_global_init(void); |
1962 | int reiserfs_proc_info_global_done( void ); | 1927 | int reiserfs_proc_info_global_done(void); |
1963 | int reiserfs_global_version_in_proc( char *buffer, char **start, off_t offset, | 1928 | int reiserfs_global_version_in_proc(char *buffer, char **start, off_t offset, |
1964 | int count, int *eof, void *data ); | 1929 | int count, int *eof, void *data); |
1965 | 1930 | ||
1966 | #if defined( REISERFS_PROC_INFO ) | 1931 | #if defined( REISERFS_PROC_INFO ) |
1967 | 1932 | ||
@@ -1993,123 +1958,132 @@ extern struct inode_operations reiserfs_special_inode_operations; | |||
1993 | extern struct file_operations reiserfs_dir_operations; | 1958 | extern struct file_operations reiserfs_dir_operations; |
1994 | 1959 | ||
1995 | /* tail_conversion.c */ | 1960 | /* tail_conversion.c */ |
1996 | int direct2indirect (struct reiserfs_transaction_handle *, struct inode *, struct path *, struct buffer_head *, loff_t); | 1961 | int direct2indirect(struct reiserfs_transaction_handle *, struct inode *, |
1997 | int indirect2direct (struct reiserfs_transaction_handle *, struct inode *, struct page *, struct path *, const struct cpu_key *, loff_t, char *); | 1962 | struct path *, struct buffer_head *, loff_t); |
1998 | void reiserfs_unmap_buffer(struct buffer_head *) ; | 1963 | int indirect2direct(struct reiserfs_transaction_handle *, struct inode *, |
1999 | 1964 | struct page *, struct path *, const struct cpu_key *, | |
1965 | loff_t, char *); | ||
1966 | void reiserfs_unmap_buffer(struct buffer_head *); | ||
2000 | 1967 | ||
2001 | /* file.c */ | 1968 | /* file.c */ |
2002 | extern struct inode_operations reiserfs_file_inode_operations; | 1969 | extern struct inode_operations reiserfs_file_inode_operations; |
2003 | extern struct file_operations reiserfs_file_operations; | 1970 | extern struct file_operations reiserfs_file_operations; |
2004 | extern struct address_space_operations reiserfs_address_space_operations ; | 1971 | extern struct address_space_operations reiserfs_address_space_operations; |
2005 | 1972 | ||
2006 | /* fix_nodes.c */ | 1973 | /* fix_nodes.c */ |
2007 | #ifdef CONFIG_REISERFS_CHECK | 1974 | #ifdef CONFIG_REISERFS_CHECK |
2008 | void * reiserfs_kmalloc (size_t size, int flags, struct super_block * s); | 1975 | void *reiserfs_kmalloc(size_t size, int flags, struct super_block *s); |
2009 | void reiserfs_kfree (const void * vp, size_t size, struct super_block * s); | 1976 | void reiserfs_kfree(const void *vp, size_t size, struct super_block *s); |
2010 | #else | 1977 | #else |
2011 | static inline void *reiserfs_kmalloc(size_t size, int flags, | 1978 | static inline void *reiserfs_kmalloc(size_t size, int flags, |
2012 | struct super_block *s) | 1979 | struct super_block *s) |
2013 | { | 1980 | { |
2014 | return kmalloc(size, flags); | 1981 | return kmalloc(size, flags); |
2015 | } | 1982 | } |
2016 | 1983 | ||
2017 | static inline void reiserfs_kfree(const void *vp, size_t size, | 1984 | static inline void reiserfs_kfree(const void *vp, size_t size, |
2018 | struct super_block *s) | 1985 | struct super_block *s) |
2019 | { | 1986 | { |
2020 | kfree(vp); | 1987 | kfree(vp); |
2021 | } | 1988 | } |
2022 | #endif | 1989 | #endif |
2023 | 1990 | ||
2024 | int fix_nodes (int n_op_mode, struct tree_balance * p_s_tb, | 1991 | int fix_nodes(int n_op_mode, struct tree_balance *p_s_tb, |
2025 | struct item_head * p_s_ins_ih, const void *); | 1992 | struct item_head *p_s_ins_ih, const void *); |
2026 | void unfix_nodes (struct tree_balance *); | 1993 | void unfix_nodes(struct tree_balance *); |
2027 | |||
2028 | 1994 | ||
2029 | /* prints.c */ | 1995 | /* prints.c */ |
2030 | void reiserfs_panic (struct super_block * s, const char * fmt, ...) __attribute__ ( ( noreturn ) ); | 1996 | void reiserfs_panic(struct super_block *s, const char *fmt, ...) |
2031 | void reiserfs_info (struct super_block *s, const char * fmt, ...); | 1997 | __attribute__ ((noreturn)); |
2032 | void reiserfs_debug (struct super_block *s, int level, const char * fmt, ...); | 1998 | void reiserfs_info(struct super_block *s, const char *fmt, ...); |
2033 | void print_indirect_item (struct buffer_head * bh, int item_num); | 1999 | void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...); |
2034 | void store_print_tb (struct tree_balance * tb); | 2000 | void print_indirect_item(struct buffer_head *bh, int item_num); |
2035 | void print_cur_tb (char * mes); | 2001 | void store_print_tb(struct tree_balance *tb); |
2036 | void print_de (struct reiserfs_dir_entry * de); | 2002 | void print_cur_tb(char *mes); |
2037 | void print_bi (struct buffer_info * bi, char * mes); | 2003 | void print_de(struct reiserfs_dir_entry *de); |
2038 | #define PRINT_LEAF_ITEMS 1 /* print all items */ | 2004 | void print_bi(struct buffer_info *bi, char *mes); |
2039 | #define PRINT_DIRECTORY_ITEMS 2 /* print directory items */ | 2005 | #define PRINT_LEAF_ITEMS 1 /* print all items */ |
2040 | #define PRINT_DIRECT_ITEMS 4 /* print contents of direct items */ | 2006 | #define PRINT_DIRECTORY_ITEMS 2 /* print directory items */ |
2041 | void print_block (struct buffer_head * bh, ...); | 2007 | #define PRINT_DIRECT_ITEMS 4 /* print contents of direct items */ |
2042 | void print_bmap (struct super_block * s, int silent); | 2008 | void print_block(struct buffer_head *bh, ...); |
2043 | void print_bmap_block (int i, char * data, int size, int silent); | 2009 | void print_bmap(struct super_block *s, int silent); |
2010 | void print_bmap_block(int i, char *data, int size, int silent); | ||
2044 | /*void print_super_block (struct super_block * s, char * mes);*/ | 2011 | /*void print_super_block (struct super_block * s, char * mes);*/ |
2045 | void print_objectid_map (struct super_block * s); | 2012 | void print_objectid_map(struct super_block *s); |
2046 | void print_block_head (struct buffer_head * bh, char * mes); | 2013 | void print_block_head(struct buffer_head *bh, char *mes); |
2047 | void check_leaf (struct buffer_head * bh); | 2014 | void check_leaf(struct buffer_head *bh); |
2048 | void check_internal (struct buffer_head * bh); | 2015 | void check_internal(struct buffer_head *bh); |
2049 | void print_statistics (struct super_block * s); | 2016 | void print_statistics(struct super_block *s); |
2050 | char * reiserfs_hashname(int code); | 2017 | char *reiserfs_hashname(int code); |
2051 | 2018 | ||
2052 | /* lbalance.c */ | 2019 | /* lbalance.c */ |
2053 | int leaf_move_items (int shift_mode, struct tree_balance * tb, int mov_num, int mov_bytes, struct buffer_head * Snew); | 2020 | int leaf_move_items(int shift_mode, struct tree_balance *tb, int mov_num, |
2054 | int leaf_shift_left (struct tree_balance * tb, int shift_num, int shift_bytes); | 2021 | int mov_bytes, struct buffer_head *Snew); |
2055 | int leaf_shift_right (struct tree_balance * tb, int shift_num, int shift_bytes); | 2022 | int leaf_shift_left(struct tree_balance *tb, int shift_num, int shift_bytes); |
2056 | void leaf_delete_items (struct buffer_info * cur_bi, int last_first, int first, int del_num, int del_bytes); | 2023 | int leaf_shift_right(struct tree_balance *tb, int shift_num, int shift_bytes); |
2057 | void leaf_insert_into_buf (struct buffer_info * bi, int before, | 2024 | void leaf_delete_items(struct buffer_info *cur_bi, int last_first, int first, |
2058 | struct item_head * inserted_item_ih, const char * inserted_item_body, int zeros_number); | 2025 | int del_num, int del_bytes); |
2059 | void leaf_paste_in_buffer (struct buffer_info * bi, int pasted_item_num, | 2026 | void leaf_insert_into_buf(struct buffer_info *bi, int before, |
2060 | int pos_in_item, int paste_size, const char * body, int zeros_number); | 2027 | struct item_head *inserted_item_ih, |
2061 | void leaf_cut_from_buffer (struct buffer_info * bi, int cut_item_num, int pos_in_item, | 2028 | const char *inserted_item_body, int zeros_number); |
2062 | int cut_size); | 2029 | void leaf_paste_in_buffer(struct buffer_info *bi, int pasted_item_num, |
2063 | void leaf_paste_entries (struct buffer_head * bh, int item_num, int before, | 2030 | int pos_in_item, int paste_size, const char *body, |
2064 | int new_entry_count, struct reiserfs_de_head * new_dehs, const char * records, int paste_size); | 2031 | int zeros_number); |
2032 | void leaf_cut_from_buffer(struct buffer_info *bi, int cut_item_num, | ||
2033 | int pos_in_item, int cut_size); | ||
2034 | void leaf_paste_entries(struct buffer_head *bh, int item_num, int before, | ||
2035 | int new_entry_count, struct reiserfs_de_head *new_dehs, | ||
2036 | const char *records, int paste_size); | ||
2065 | /* ibalance.c */ | 2037 | /* ibalance.c */ |
2066 | int balance_internal (struct tree_balance * , int, int, struct item_head * , | 2038 | int balance_internal(struct tree_balance *, int, int, struct item_head *, |
2067 | struct buffer_head **); | 2039 | struct buffer_head **); |
2068 | 2040 | ||
2069 | /* do_balance.c */ | 2041 | /* do_balance.c */ |
2070 | void do_balance_mark_leaf_dirty (struct tree_balance * tb, | 2042 | void do_balance_mark_leaf_dirty(struct tree_balance *tb, |
2071 | struct buffer_head * bh, int flag); | 2043 | struct buffer_head *bh, int flag); |
2072 | #define do_balance_mark_internal_dirty do_balance_mark_leaf_dirty | 2044 | #define do_balance_mark_internal_dirty do_balance_mark_leaf_dirty |
2073 | #define do_balance_mark_sb_dirty do_balance_mark_leaf_dirty | 2045 | #define do_balance_mark_sb_dirty do_balance_mark_leaf_dirty |
2074 | 2046 | ||
2075 | void do_balance (struct tree_balance * tb, struct item_head * ih, | 2047 | void do_balance(struct tree_balance *tb, struct item_head *ih, |
2076 | const char * body, int flag); | 2048 | const char *body, int flag); |
2077 | void reiserfs_invalidate_buffer (struct tree_balance * tb, struct buffer_head * bh); | 2049 | void reiserfs_invalidate_buffer(struct tree_balance *tb, |
2050 | struct buffer_head *bh); | ||
2078 | 2051 | ||
2079 | int get_left_neighbor_position (struct tree_balance * tb, int h); | 2052 | int get_left_neighbor_position(struct tree_balance *tb, int h); |
2080 | int get_right_neighbor_position (struct tree_balance * tb, int h); | 2053 | int get_right_neighbor_position(struct tree_balance *tb, int h); |
2081 | void replace_key (struct tree_balance * tb, struct buffer_head *, int, struct buffer_head *, int); | 2054 | void replace_key(struct tree_balance *tb, struct buffer_head *, int, |
2082 | void make_empty_node (struct buffer_info *); | 2055 | struct buffer_head *, int); |
2083 | struct buffer_head * get_FEB (struct tree_balance *); | 2056 | void make_empty_node(struct buffer_info *); |
2057 | struct buffer_head *get_FEB(struct tree_balance *); | ||
2084 | 2058 | ||
2085 | /* bitmap.c */ | 2059 | /* bitmap.c */ |
2086 | 2060 | ||
2087 | /* structure contains hints for block allocator, and it is a container for | 2061 | /* structure contains hints for block allocator, and it is a container for |
2088 | * arguments, such as node, search path, transaction_handle, etc. */ | 2062 | * arguments, such as node, search path, transaction_handle, etc. */ |
2089 | struct __reiserfs_blocknr_hint { | 2063 | struct __reiserfs_blocknr_hint { |
2090 | struct inode * inode; /* inode passed to allocator, if we allocate unf. nodes */ | 2064 | struct inode *inode; /* inode passed to allocator, if we allocate unf. nodes */ |
2091 | long block; /* file offset, in blocks */ | 2065 | long block; /* file offset, in blocks */ |
2092 | struct in_core_key key; | 2066 | struct in_core_key key; |
2093 | struct path * path; /* search path, used by allocator to deternine search_start by | 2067 | struct path *path; /* search path, used by allocator to deternine search_start by |
2094 | * various ways */ | 2068 | * various ways */ |
2095 | struct reiserfs_transaction_handle * th; /* transaction handle is needed to log super blocks and | 2069 | struct reiserfs_transaction_handle *th; /* transaction handle is needed to log super blocks and |
2096 | * bitmap blocks changes */ | 2070 | * bitmap blocks changes */ |
2097 | b_blocknr_t beg, end; | 2071 | b_blocknr_t beg, end; |
2098 | b_blocknr_t search_start; /* a field used to transfer search start value (block number) | 2072 | b_blocknr_t search_start; /* a field used to transfer search start value (block number) |
2099 | * between different block allocator procedures | 2073 | * between different block allocator procedures |
2100 | * (determine_search_start() and others) */ | 2074 | * (determine_search_start() and others) */ |
2101 | int prealloc_size; /* is set in determine_prealloc_size() function, used by underlayed | 2075 | int prealloc_size; /* is set in determine_prealloc_size() function, used by underlayed |
2102 | * function that do actual allocation */ | 2076 | * function that do actual allocation */ |
2103 | 2077 | ||
2104 | unsigned formatted_node:1; /* the allocator uses different polices for getting disk space for | 2078 | unsigned formatted_node:1; /* the allocator uses different polices for getting disk space for |
2105 | * formatted/unformatted blocks with/without preallocation */ | 2079 | * formatted/unformatted blocks with/without preallocation */ |
2106 | unsigned preallocate:1; | 2080 | unsigned preallocate:1; |
2107 | }; | 2081 | }; |
2108 | 2082 | ||
2109 | typedef struct __reiserfs_blocknr_hint reiserfs_blocknr_hint_t; | 2083 | typedef struct __reiserfs_blocknr_hint reiserfs_blocknr_hint_t; |
2110 | 2084 | ||
2111 | int reiserfs_parse_alloc_options (struct super_block *, char *); | 2085 | int reiserfs_parse_alloc_options(struct super_block *, char *); |
2112 | void reiserfs_init_alloc_options (struct super_block *s); | 2086 | void reiserfs_init_alloc_options(struct super_block *s); |
2113 | 2087 | ||
2114 | /* | 2088 | /* |
2115 | * given a directory, this will tell you what packing locality | 2089 | * given a directory, this will tell you what packing locality |
@@ -2118,68 +2092,72 @@ void reiserfs_init_alloc_options (struct super_block *s); | |||
2118 | */ | 2092 | */ |
2119 | __le32 reiserfs_choose_packing(struct inode *dir); | 2093 | __le32 reiserfs_choose_packing(struct inode *dir); |
2120 | 2094 | ||
2121 | int is_reusable (struct super_block * s, b_blocknr_t block, int bit_value); | 2095 | int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value); |
2122 | void reiserfs_free_block (struct reiserfs_transaction_handle *th, struct inode *, b_blocknr_t, int for_unformatted); | 2096 | void reiserfs_free_block(struct reiserfs_transaction_handle *th, struct inode *, |
2123 | int reiserfs_allocate_blocknrs(reiserfs_blocknr_hint_t *, b_blocknr_t * , int, int); | 2097 | b_blocknr_t, int for_unformatted); |
2124 | extern inline int reiserfs_new_form_blocknrs (struct tree_balance * tb, | 2098 | int reiserfs_allocate_blocknrs(reiserfs_blocknr_hint_t *, b_blocknr_t *, int, |
2125 | b_blocknr_t *new_blocknrs, int amount_needed) | 2099 | int); |
2100 | extern inline int reiserfs_new_form_blocknrs(struct tree_balance *tb, | ||
2101 | b_blocknr_t * new_blocknrs, | ||
2102 | int amount_needed) | ||
2126 | { | 2103 | { |
2127 | reiserfs_blocknr_hint_t hint = { | 2104 | reiserfs_blocknr_hint_t hint = { |
2128 | .th = tb->transaction_handle, | 2105 | .th = tb->transaction_handle, |
2129 | .path = tb->tb_path, | 2106 | .path = tb->tb_path, |
2130 | .inode = NULL, | 2107 | .inode = NULL, |
2131 | .key = tb->key, | 2108 | .key = tb->key, |
2132 | .block = 0, | 2109 | .block = 0, |
2133 | .formatted_node = 1 | 2110 | .formatted_node = 1 |
2134 | }; | 2111 | }; |
2135 | return reiserfs_allocate_blocknrs(&hint, new_blocknrs, amount_needed, 0); | 2112 | return reiserfs_allocate_blocknrs(&hint, new_blocknrs, amount_needed, |
2113 | 0); | ||
2136 | } | 2114 | } |
2137 | 2115 | ||
2138 | extern inline int reiserfs_new_unf_blocknrs (struct reiserfs_transaction_handle *th, | 2116 | extern inline int reiserfs_new_unf_blocknrs(struct reiserfs_transaction_handle |
2139 | struct inode *inode, | 2117 | *th, struct inode *inode, |
2140 | b_blocknr_t *new_blocknrs, | 2118 | b_blocknr_t * new_blocknrs, |
2141 | struct path * path, long block) | 2119 | struct path *path, long block) |
2142 | { | 2120 | { |
2143 | reiserfs_blocknr_hint_t hint = { | 2121 | reiserfs_blocknr_hint_t hint = { |
2144 | .th = th, | 2122 | .th = th, |
2145 | .path = path, | 2123 | .path = path, |
2146 | .inode = inode, | 2124 | .inode = inode, |
2147 | .block = block, | 2125 | .block = block, |
2148 | .formatted_node = 0, | 2126 | .formatted_node = 0, |
2149 | .preallocate = 0 | 2127 | .preallocate = 0 |
2150 | }; | 2128 | }; |
2151 | return reiserfs_allocate_blocknrs(&hint, new_blocknrs, 1, 0); | 2129 | return reiserfs_allocate_blocknrs(&hint, new_blocknrs, 1, 0); |
2152 | } | 2130 | } |
2153 | 2131 | ||
2154 | #ifdef REISERFS_PREALLOCATE | 2132 | #ifdef REISERFS_PREALLOCATE |
2155 | extern inline int reiserfs_new_unf_blocknrs2(struct reiserfs_transaction_handle *th, | 2133 | extern inline int reiserfs_new_unf_blocknrs2(struct reiserfs_transaction_handle |
2156 | struct inode * inode, | 2134 | *th, struct inode *inode, |
2157 | b_blocknr_t *new_blocknrs, | 2135 | b_blocknr_t * new_blocknrs, |
2158 | struct path * path, long block) | 2136 | struct path *path, long block) |
2159 | { | 2137 | { |
2160 | reiserfs_blocknr_hint_t hint = { | 2138 | reiserfs_blocknr_hint_t hint = { |
2161 | .th = th, | 2139 | .th = th, |
2162 | .path = path, | 2140 | .path = path, |
2163 | .inode = inode, | 2141 | .inode = inode, |
2164 | .block = block, | 2142 | .block = block, |
2165 | .formatted_node = 0, | 2143 | .formatted_node = 0, |
2166 | .preallocate = 1 | 2144 | .preallocate = 1 |
2167 | }; | 2145 | }; |
2168 | return reiserfs_allocate_blocknrs(&hint, new_blocknrs, 1, 0); | 2146 | return reiserfs_allocate_blocknrs(&hint, new_blocknrs, 1, 0); |
2169 | } | 2147 | } |
2170 | 2148 | ||
2171 | void reiserfs_discard_prealloc (struct reiserfs_transaction_handle *th, | 2149 | void reiserfs_discard_prealloc(struct reiserfs_transaction_handle *th, |
2172 | struct inode * inode); | 2150 | struct inode *inode); |
2173 | void reiserfs_discard_all_prealloc (struct reiserfs_transaction_handle *th); | 2151 | void reiserfs_discard_all_prealloc(struct reiserfs_transaction_handle *th); |
2174 | #endif | 2152 | #endif |
2175 | void reiserfs_claim_blocks_to_be_allocated( struct super_block *sb, int blocks); | 2153 | void reiserfs_claim_blocks_to_be_allocated(struct super_block *sb, int blocks); |
2176 | void reiserfs_release_claimed_blocks( struct super_block *sb, int blocks); | 2154 | void reiserfs_release_claimed_blocks(struct super_block *sb, int blocks); |
2177 | int reiserfs_can_fit_pages(struct super_block *sb); | 2155 | int reiserfs_can_fit_pages(struct super_block *sb); |
2178 | 2156 | ||
2179 | /* hashes.c */ | 2157 | /* hashes.c */ |
2180 | __u32 keyed_hash (const signed char *msg, int len); | 2158 | __u32 keyed_hash(const signed char *msg, int len); |
2181 | __u32 yura_hash (const signed char *msg, int len); | 2159 | __u32 yura_hash(const signed char *msg, int len); |
2182 | __u32 r5_hash (const signed char *msg, int len); | 2160 | __u32 r5_hash(const signed char *msg, int len); |
2183 | 2161 | ||
2184 | /* the ext2 bit routines adjust for big or little endian as | 2162 | /* the ext2 bit routines adjust for big or little endian as |
2185 | ** appropriate for the arch, so in our laziness we use them rather | 2163 | ** appropriate for the arch, so in our laziness we use them rather |
@@ -2199,11 +2177,10 @@ __u32 r5_hash (const signed char *msg, int len); | |||
2199 | absolutely safe */ | 2177 | absolutely safe */ |
2200 | #define SPARE_SPACE 500 | 2178 | #define SPARE_SPACE 500 |
2201 | 2179 | ||
2202 | |||
2203 | /* prototypes from ioctl.c */ | 2180 | /* prototypes from ioctl.c */ |
2204 | int reiserfs_ioctl (struct inode * inode, struct file * filp, | 2181 | int reiserfs_ioctl(struct inode *inode, struct file *filp, |
2205 | unsigned int cmd, unsigned long arg); | 2182 | unsigned int cmd, unsigned long arg); |
2206 | 2183 | ||
2207 | /* ioctl's command */ | 2184 | /* ioctl's command */ |
2208 | #define REISERFS_IOC_UNPACK _IOW(0xCD,1,long) | 2185 | #define REISERFS_IOC_UNPACK _IOW(0xCD,1,long) |
2209 | /* define following flags to be the same as in ext2, so that chattr(1), | 2186 | /* define following flags to be the same as in ext2, so that chattr(1), |
@@ -2218,10 +2195,8 @@ int reiserfs_ioctl (struct inode * inode, struct file * filp, | |||
2218 | would evolve into real per-fs locks */ | 2195 | would evolve into real per-fs locks */ |
2219 | #define reiserfs_write_lock( sb ) lock_kernel() | 2196 | #define reiserfs_write_lock( sb ) lock_kernel() |
2220 | #define reiserfs_write_unlock( sb ) unlock_kernel() | 2197 | #define reiserfs_write_unlock( sb ) unlock_kernel() |
2221 | 2198 | ||
2222 | /* xattr stuff */ | 2199 | /* xattr stuff */ |
2223 | #define REISERFS_XATTR_DIR_SEM(s) (REISERFS_SB(s)->xattr_dir_sem) | 2200 | #define REISERFS_XATTR_DIR_SEM(s) (REISERFS_SB(s)->xattr_dir_sem) |
2224 | 2201 | ||
2225 | #endif /* _LINUX_REISER_FS_H */ | 2202 | #endif /* _LINUX_REISER_FS_H */ |
2226 | |||
2227 | |||
diff --git a/include/linux/reiserfs_fs_i.h b/include/linux/reiserfs_fs_i.h index e321eb050d65..149be8d9a0c9 100644 --- a/include/linux/reiserfs_fs_i.h +++ b/include/linux/reiserfs_fs_i.h | |||
@@ -10,54 +10,53 @@ typedef enum { | |||
10 | /** this says what format of key do all items (but stat data) of | 10 | /** this says what format of key do all items (but stat data) of |
11 | an object have. If this is set, that format is 3.6 otherwise | 11 | an object have. If this is set, that format is 3.6 otherwise |
12 | - 3.5 */ | 12 | - 3.5 */ |
13 | i_item_key_version_mask = 0x0001, | 13 | i_item_key_version_mask = 0x0001, |
14 | /** If this is unset, object has 3.5 stat data, otherwise, it has | 14 | /** If this is unset, object has 3.5 stat data, otherwise, it has |
15 | 3.6 stat data with 64bit size, 32bit nlink etc. */ | 15 | 3.6 stat data with 64bit size, 32bit nlink etc. */ |
16 | i_stat_data_version_mask = 0x0002, | 16 | i_stat_data_version_mask = 0x0002, |
17 | /** file might need tail packing on close */ | 17 | /** file might need tail packing on close */ |
18 | i_pack_on_close_mask = 0x0004, | 18 | i_pack_on_close_mask = 0x0004, |
19 | /** don't pack tail of file */ | 19 | /** don't pack tail of file */ |
20 | i_nopack_mask = 0x0008, | 20 | i_nopack_mask = 0x0008, |
21 | /** If those is set, "safe link" was created for this file during | 21 | /** If those is set, "safe link" was created for this file during |
22 | truncate or unlink. Safe link is used to avoid leakage of disk | 22 | truncate or unlink. Safe link is used to avoid leakage of disk |
23 | space on crash with some files open, but unlinked. */ | 23 | space on crash with some files open, but unlinked. */ |
24 | i_link_saved_unlink_mask = 0x0010, | 24 | i_link_saved_unlink_mask = 0x0010, |
25 | i_link_saved_truncate_mask = 0x0020, | 25 | i_link_saved_truncate_mask = 0x0020, |
26 | i_has_xattr_dir = 0x0040, | 26 | i_has_xattr_dir = 0x0040, |
27 | i_data_log = 0x0080, | 27 | i_data_log = 0x0080, |
28 | } reiserfs_inode_flags; | 28 | } reiserfs_inode_flags; |
29 | 29 | ||
30 | |||
31 | struct reiserfs_inode_info { | 30 | struct reiserfs_inode_info { |
32 | __u32 i_key [4];/* key is still 4 32 bit integers */ | 31 | __u32 i_key[4]; /* key is still 4 32 bit integers */ |
33 | /** transient inode flags that are never stored on disk. Bitmasks | 32 | /** transient inode flags that are never stored on disk. Bitmasks |
34 | for this field are defined above. */ | 33 | for this field are defined above. */ |
35 | __u32 i_flags; | 34 | __u32 i_flags; |
36 | 35 | ||
37 | __u32 i_first_direct_byte; // offset of first byte stored in direct item. | 36 | __u32 i_first_direct_byte; // offset of first byte stored in direct item. |
38 | 37 | ||
39 | /* copy of persistent inode flags read from sd_attrs. */ | 38 | /* copy of persistent inode flags read from sd_attrs. */ |
40 | __u32 i_attrs; | 39 | __u32 i_attrs; |
41 | 40 | ||
42 | int i_prealloc_block; /* first unused block of a sequence of unused blocks */ | 41 | int i_prealloc_block; /* first unused block of a sequence of unused blocks */ |
43 | int i_prealloc_count; /* length of that sequence */ | 42 | int i_prealloc_count; /* length of that sequence */ |
44 | struct list_head i_prealloc_list; /* per-transaction list of inodes which | 43 | struct list_head i_prealloc_list; /* per-transaction list of inodes which |
45 | * have preallocated blocks */ | 44 | * have preallocated blocks */ |
46 | 45 | ||
47 | unsigned new_packing_locality:1; /* new_packig_locality is created; new blocks | 46 | unsigned new_packing_locality:1; /* new_packig_locality is created; new blocks |
48 | * for the contents of this directory should be | 47 | * for the contents of this directory should be |
49 | * displaced */ | 48 | * displaced */ |
50 | 49 | ||
51 | /* we use these for fsync or O_SYNC to decide which transaction | 50 | /* we use these for fsync or O_SYNC to decide which transaction |
52 | ** needs to be committed in order for this inode to be properly | 51 | ** needs to be committed in order for this inode to be properly |
53 | ** flushed */ | 52 | ** flushed */ |
54 | unsigned long i_trans_id ; | 53 | unsigned long i_trans_id; |
55 | struct reiserfs_journal_list *i_jl; | 54 | struct reiserfs_journal_list *i_jl; |
56 | 55 | ||
57 | struct posix_acl *i_acl_access; | 56 | struct posix_acl *i_acl_access; |
58 | struct posix_acl *i_acl_default; | 57 | struct posix_acl *i_acl_default; |
59 | struct rw_semaphore xattr_sem; | 58 | struct rw_semaphore xattr_sem; |
60 | struct inode vfs_inode; | 59 | struct inode vfs_inode; |
61 | }; | 60 | }; |
62 | 61 | ||
63 | #endif | 62 | #endif |
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h index 31c709d0fe18..3e68592e52e9 100644 --- a/include/linux/reiserfs_fs_sb.h +++ b/include/linux/reiserfs_fs_sb.h | |||
@@ -10,7 +10,7 @@ | |||
10 | #endif | 10 | #endif |
11 | 11 | ||
12 | typedef enum { | 12 | typedef enum { |
13 | reiserfs_attrs_cleared = 0x00000001, | 13 | reiserfs_attrs_cleared = 0x00000001, |
14 | } reiserfs_super_block_flags; | 14 | } reiserfs_super_block_flags; |
15 | 15 | ||
16 | /* struct reiserfs_super_block accessors/mutators | 16 | /* struct reiserfs_super_block accessors/mutators |
@@ -61,7 +61,7 @@ typedef enum { | |||
61 | #define sb_umount_state(sbp) (le16_to_cpu((sbp)->s_v1.s_umount_state)) | 61 | #define sb_umount_state(sbp) (le16_to_cpu((sbp)->s_v1.s_umount_state)) |
62 | #define set_sb_umount_state(sbp,v) ((sbp)->s_v1.s_umount_state = cpu_to_le16(v)) | 62 | #define set_sb_umount_state(sbp,v) ((sbp)->s_v1.s_umount_state = cpu_to_le16(v)) |
63 | #define sb_fs_state(sbp) (le16_to_cpu((sbp)->s_v1.s_fs_state)) | 63 | #define sb_fs_state(sbp) (le16_to_cpu((sbp)->s_v1.s_fs_state)) |
64 | #define set_sb_fs_state(sbp,v) ((sbp)->s_v1.s_fs_state = cpu_to_le16(v)) | 64 | #define set_sb_fs_state(sbp,v) ((sbp)->s_v1.s_fs_state = cpu_to_le16(v)) |
65 | #define sb_hash_function_code(sbp) \ | 65 | #define sb_hash_function_code(sbp) \ |
66 | (le32_to_cpu((sbp)->s_v1.s_hash_function_code)) | 66 | (le32_to_cpu((sbp)->s_v1.s_hash_function_code)) |
67 | #define set_sb_hash_function_code(sbp,v) \ | 67 | #define set_sb_hash_function_code(sbp,v) \ |
@@ -103,10 +103,10 @@ typedef enum { | |||
103 | 103 | ||
104 | /* don't mess with these for a while */ | 104 | /* don't mess with these for a while */ |
105 | /* we have a node size define somewhere in reiserfs_fs.h. -Hans */ | 105 | /* we have a node size define somewhere in reiserfs_fs.h. -Hans */ |
106 | #define JOURNAL_BLOCK_SIZE 4096 /* BUG gotta get rid of this */ | 106 | #define JOURNAL_BLOCK_SIZE 4096 /* BUG gotta get rid of this */ |
107 | #define JOURNAL_MAX_CNODE 1500 /* max cnodes to allocate. */ | 107 | #define JOURNAL_MAX_CNODE 1500 /* max cnodes to allocate. */ |
108 | #define JOURNAL_HASH_SIZE 8192 | 108 | #define JOURNAL_HASH_SIZE 8192 |
109 | #define JOURNAL_NUM_BITMAPS 5 /* number of copies of the bitmaps to have floating. Must be >= 2 */ | 109 | #define JOURNAL_NUM_BITMAPS 5 /* number of copies of the bitmaps to have floating. Must be >= 2 */ |
110 | 110 | ||
111 | /* One of these for every block in every transaction | 111 | /* One of these for every block in every transaction |
112 | ** Each one is in two hash tables. First, a hash of the current transaction, and after journal_end, a | 112 | ** Each one is in two hash tables. First, a hash of the current transaction, and after journal_end, a |
@@ -117,27 +117,27 @@ typedef enum { | |||
117 | ** to a given transaction. | 117 | ** to a given transaction. |
118 | */ | 118 | */ |
119 | struct reiserfs_journal_cnode { | 119 | struct reiserfs_journal_cnode { |
120 | struct buffer_head *bh ; /* real buffer head */ | 120 | struct buffer_head *bh; /* real buffer head */ |
121 | struct super_block *sb ; /* dev of real buffer head */ | 121 | struct super_block *sb; /* dev of real buffer head */ |
122 | __u32 blocknr ; /* block number of real buffer head, == 0 when buffer on disk */ | 122 | __u32 blocknr; /* block number of real buffer head, == 0 when buffer on disk */ |
123 | long state ; | 123 | long state; |
124 | struct reiserfs_journal_list *jlist ; /* journal list this cnode lives in */ | 124 | struct reiserfs_journal_list *jlist; /* journal list this cnode lives in */ |
125 | struct reiserfs_journal_cnode *next ; /* next in transaction list */ | 125 | struct reiserfs_journal_cnode *next; /* next in transaction list */ |
126 | struct reiserfs_journal_cnode *prev ; /* prev in transaction list */ | 126 | struct reiserfs_journal_cnode *prev; /* prev in transaction list */ |
127 | struct reiserfs_journal_cnode *hprev ; /* prev in hash list */ | 127 | struct reiserfs_journal_cnode *hprev; /* prev in hash list */ |
128 | struct reiserfs_journal_cnode *hnext ; /* next in hash list */ | 128 | struct reiserfs_journal_cnode *hnext; /* next in hash list */ |
129 | }; | 129 | }; |
130 | 130 | ||
131 | struct reiserfs_bitmap_node { | 131 | struct reiserfs_bitmap_node { |
132 | int id ; | 132 | int id; |
133 | char *data ; | 133 | char *data; |
134 | struct list_head list ; | 134 | struct list_head list; |
135 | } ; | 135 | }; |
136 | 136 | ||
137 | struct reiserfs_list_bitmap { | 137 | struct reiserfs_list_bitmap { |
138 | struct reiserfs_journal_list *journal_list ; | 138 | struct reiserfs_journal_list *journal_list; |
139 | struct reiserfs_bitmap_node **bitmaps ; | 139 | struct reiserfs_bitmap_node **bitmaps; |
140 | } ; | 140 | }; |
141 | 141 | ||
142 | /* | 142 | /* |
143 | ** one of these for each transaction. The most important part here is the j_realblock. | 143 | ** one of these for each transaction. The most important part here is the j_realblock. |
@@ -146,273 +146,269 @@ struct reiserfs_list_bitmap { | |||
146 | ** and to make sure every real block in a transaction is on disk before allowing the log area | 146 | ** and to make sure every real block in a transaction is on disk before allowing the log area |
147 | ** to be overwritten */ | 147 | ** to be overwritten */ |
148 | struct reiserfs_journal_list { | 148 | struct reiserfs_journal_list { |
149 | unsigned long j_start ; | 149 | unsigned long j_start; |
150 | unsigned long j_state; | 150 | unsigned long j_state; |
151 | unsigned long j_len ; | 151 | unsigned long j_len; |
152 | atomic_t j_nonzerolen ; | 152 | atomic_t j_nonzerolen; |
153 | atomic_t j_commit_left ; | 153 | atomic_t j_commit_left; |
154 | atomic_t j_older_commits_done ; /* all commits older than this on disk*/ | 154 | atomic_t j_older_commits_done; /* all commits older than this on disk */ |
155 | struct semaphore j_commit_lock; | 155 | struct semaphore j_commit_lock; |
156 | unsigned long j_trans_id ; | 156 | unsigned long j_trans_id; |
157 | time_t j_timestamp ; | 157 | time_t j_timestamp; |
158 | struct reiserfs_list_bitmap *j_list_bitmap ; | 158 | struct reiserfs_list_bitmap *j_list_bitmap; |
159 | struct buffer_head *j_commit_bh ; /* commit buffer head */ | 159 | struct buffer_head *j_commit_bh; /* commit buffer head */ |
160 | struct reiserfs_journal_cnode *j_realblock ; | 160 | struct reiserfs_journal_cnode *j_realblock; |
161 | struct reiserfs_journal_cnode *j_freedlist ; /* list of buffers that were freed during this trans. free each of these on flush */ | 161 | struct reiserfs_journal_cnode *j_freedlist; /* list of buffers that were freed during this trans. free each of these on flush */ |
162 | /* time ordered list of all active transactions */ | 162 | /* time ordered list of all active transactions */ |
163 | struct list_head j_list; | 163 | struct list_head j_list; |
164 | 164 | ||
165 | /* time ordered list of all transactions we haven't tried to flush yet */ | 165 | /* time ordered list of all transactions we haven't tried to flush yet */ |
166 | struct list_head j_working_list; | 166 | struct list_head j_working_list; |
167 | 167 | ||
168 | /* list of tail conversion targets in need of flush before commit */ | 168 | /* list of tail conversion targets in need of flush before commit */ |
169 | struct list_head j_tail_bh_list; | 169 | struct list_head j_tail_bh_list; |
170 | /* list of data=ordered buffers in need of flush before commit */ | 170 | /* list of data=ordered buffers in need of flush before commit */ |
171 | struct list_head j_bh_list; | 171 | struct list_head j_bh_list; |
172 | int j_refcount; | 172 | int j_refcount; |
173 | } ; | 173 | }; |
174 | 174 | ||
175 | struct reiserfs_journal { | 175 | struct reiserfs_journal { |
176 | struct buffer_head ** j_ap_blocks ; /* journal blocks on disk */ | 176 | struct buffer_head **j_ap_blocks; /* journal blocks on disk */ |
177 | struct reiserfs_journal_cnode *j_last ; /* newest journal block */ | 177 | struct reiserfs_journal_cnode *j_last; /* newest journal block */ |
178 | struct reiserfs_journal_cnode *j_first ; /* oldest journal block. start here for traverse */ | 178 | struct reiserfs_journal_cnode *j_first; /* oldest journal block. start here for traverse */ |
179 | 179 | ||
180 | struct file *j_dev_file; | 180 | struct file *j_dev_file; |
181 | struct block_device *j_dev_bd; | 181 | struct block_device *j_dev_bd; |
182 | int j_1st_reserved_block; /* first block on s_dev of reserved area journal */ | 182 | int j_1st_reserved_block; /* first block on s_dev of reserved area journal */ |
183 | 183 | ||
184 | long j_state ; | 184 | long j_state; |
185 | unsigned long j_trans_id ; | 185 | unsigned long j_trans_id; |
186 | unsigned long j_mount_id ; | 186 | unsigned long j_mount_id; |
187 | unsigned long j_start ; /* start of current waiting commit (index into j_ap_blocks) */ | 187 | unsigned long j_start; /* start of current waiting commit (index into j_ap_blocks) */ |
188 | unsigned long j_len ; /* lenght of current waiting commit */ | 188 | unsigned long j_len; /* lenght of current waiting commit */ |
189 | unsigned long j_len_alloc ; /* number of buffers requested by journal_begin() */ | 189 | unsigned long j_len_alloc; /* number of buffers requested by journal_begin() */ |
190 | atomic_t j_wcount ; /* count of writers for current commit */ | 190 | atomic_t j_wcount; /* count of writers for current commit */ |
191 | unsigned long j_bcount ; /* batch count. allows turning X transactions into 1 */ | 191 | unsigned long j_bcount; /* batch count. allows turning X transactions into 1 */ |
192 | unsigned long j_first_unflushed_offset ; /* first unflushed transactions offset */ | 192 | unsigned long j_first_unflushed_offset; /* first unflushed transactions offset */ |
193 | unsigned long j_last_flush_trans_id ; /* last fully flushed journal timestamp */ | 193 | unsigned long j_last_flush_trans_id; /* last fully flushed journal timestamp */ |
194 | struct buffer_head *j_header_bh ; | 194 | struct buffer_head *j_header_bh; |
195 | 195 | ||
196 | time_t j_trans_start_time ; /* time this transaction started */ | 196 | time_t j_trans_start_time; /* time this transaction started */ |
197 | struct semaphore j_lock; | 197 | struct semaphore j_lock; |
198 | struct semaphore j_flush_sem; | 198 | struct semaphore j_flush_sem; |
199 | wait_queue_head_t j_join_wait ; /* wait for current transaction to finish before starting new one */ | 199 | wait_queue_head_t j_join_wait; /* wait for current transaction to finish before starting new one */ |
200 | atomic_t j_jlock ; /* lock for j_join_wait */ | 200 | atomic_t j_jlock; /* lock for j_join_wait */ |
201 | int j_list_bitmap_index ; /* number of next list bitmap to use */ | 201 | int j_list_bitmap_index; /* number of next list bitmap to use */ |
202 | int j_must_wait ; /* no more journal begins allowed. MUST sleep on j_join_wait */ | 202 | int j_must_wait; /* no more journal begins allowed. MUST sleep on j_join_wait */ |
203 | int j_next_full_flush ; /* next journal_end will flush all journal list */ | 203 | int j_next_full_flush; /* next journal_end will flush all journal list */ |
204 | int j_next_async_flush ; /* next journal_end will flush all async commits */ | 204 | int j_next_async_flush; /* next journal_end will flush all async commits */ |
205 | 205 | ||
206 | int j_cnode_used ; /* number of cnodes on the used list */ | 206 | int j_cnode_used; /* number of cnodes on the used list */ |
207 | int j_cnode_free ; /* number of cnodes on the free list */ | 207 | int j_cnode_free; /* number of cnodes on the free list */ |
208 | 208 | ||
209 | unsigned int j_trans_max ; /* max number of blocks in a transaction. */ | 209 | unsigned int j_trans_max; /* max number of blocks in a transaction. */ |
210 | unsigned int j_max_batch ; /* max number of blocks to batch into a trans */ | 210 | unsigned int j_max_batch; /* max number of blocks to batch into a trans */ |
211 | unsigned int j_max_commit_age ; /* in seconds, how old can an async commit be */ | 211 | unsigned int j_max_commit_age; /* in seconds, how old can an async commit be */ |
212 | unsigned int j_max_trans_age ; /* in seconds, how old can a transaction be */ | 212 | unsigned int j_max_trans_age; /* in seconds, how old can a transaction be */ |
213 | unsigned int j_default_max_commit_age ; /* the default for the max commit age */ | 213 | unsigned int j_default_max_commit_age; /* the default for the max commit age */ |
214 | 214 | ||
215 | struct reiserfs_journal_cnode *j_cnode_free_list ; | 215 | struct reiserfs_journal_cnode *j_cnode_free_list; |
216 | struct reiserfs_journal_cnode *j_cnode_free_orig ; /* orig pointer returned from vmalloc */ | 216 | struct reiserfs_journal_cnode *j_cnode_free_orig; /* orig pointer returned from vmalloc */ |
217 | 217 | ||
218 | struct reiserfs_journal_list *j_current_jl; | 218 | struct reiserfs_journal_list *j_current_jl; |
219 | int j_free_bitmap_nodes ; | 219 | int j_free_bitmap_nodes; |
220 | int j_used_bitmap_nodes ; | 220 | int j_used_bitmap_nodes; |
221 | 221 | ||
222 | int j_num_lists; /* total number of active transactions */ | 222 | int j_num_lists; /* total number of active transactions */ |
223 | int j_num_work_lists; /* number that need attention from kreiserfsd */ | 223 | int j_num_work_lists; /* number that need attention from kreiserfsd */ |
224 | 224 | ||
225 | /* debugging to make sure things are flushed in order */ | 225 | /* debugging to make sure things are flushed in order */ |
226 | int j_last_flush_id; | 226 | int j_last_flush_id; |
227 | 227 | ||
228 | /* debugging to make sure things are committed in order */ | 228 | /* debugging to make sure things are committed in order */ |
229 | int j_last_commit_id; | 229 | int j_last_commit_id; |
230 | 230 | ||
231 | struct list_head j_bitmap_nodes ; | 231 | struct list_head j_bitmap_nodes; |
232 | struct list_head j_dirty_buffers ; | 232 | struct list_head j_dirty_buffers; |
233 | spinlock_t j_dirty_buffers_lock ; /* protects j_dirty_buffers */ | 233 | spinlock_t j_dirty_buffers_lock; /* protects j_dirty_buffers */ |
234 | 234 | ||
235 | /* list of all active transactions */ | 235 | /* list of all active transactions */ |
236 | struct list_head j_journal_list; | 236 | struct list_head j_journal_list; |
237 | /* lists that haven't been touched by writeback attempts */ | 237 | /* lists that haven't been touched by writeback attempts */ |
238 | struct list_head j_working_list; | 238 | struct list_head j_working_list; |
239 | 239 | ||
240 | struct reiserfs_list_bitmap j_list_bitmap[JOURNAL_NUM_BITMAPS] ; /* array of bitmaps to record the deleted blocks */ | 240 | struct reiserfs_list_bitmap j_list_bitmap[JOURNAL_NUM_BITMAPS]; /* array of bitmaps to record the deleted blocks */ |
241 | struct reiserfs_journal_cnode *j_hash_table[JOURNAL_HASH_SIZE] ; /* hash table for real buffer heads in current trans */ | 241 | struct reiserfs_journal_cnode *j_hash_table[JOURNAL_HASH_SIZE]; /* hash table for real buffer heads in current trans */ |
242 | struct reiserfs_journal_cnode *j_list_hash_table[JOURNAL_HASH_SIZE] ; /* hash table for all the real buffer heads in all | 242 | struct reiserfs_journal_cnode *j_list_hash_table[JOURNAL_HASH_SIZE]; /* hash table for all the real buffer heads in all |
243 | the transactions */ | 243 | the transactions */ |
244 | struct list_head j_prealloc_list; /* list of inodes which have preallocated blocks */ | 244 | struct list_head j_prealloc_list; /* list of inodes which have preallocated blocks */ |
245 | int j_persistent_trans; | 245 | int j_persistent_trans; |
246 | unsigned long j_max_trans_size ; | 246 | unsigned long j_max_trans_size; |
247 | unsigned long j_max_batch_size ; | 247 | unsigned long j_max_batch_size; |
248 | 248 | ||
249 | int j_errno; | 249 | int j_errno; |
250 | 250 | ||
251 | /* when flushing ordered buffers, throttle new ordered writers */ | 251 | /* when flushing ordered buffers, throttle new ordered writers */ |
252 | struct work_struct j_work; | 252 | struct work_struct j_work; |
253 | atomic_t j_async_throttle; | 253 | atomic_t j_async_throttle; |
254 | }; | 254 | }; |
255 | 255 | ||
256 | enum journal_state_bits { | 256 | enum journal_state_bits { |
257 | J_WRITERS_BLOCKED = 1, /* set when new writers not allowed */ | 257 | J_WRITERS_BLOCKED = 1, /* set when new writers not allowed */ |
258 | J_WRITERS_QUEUED, /* set when log is full due to too many writers */ | 258 | J_WRITERS_QUEUED, /* set when log is full due to too many writers */ |
259 | J_ABORTED, /* set when log is aborted */ | 259 | J_ABORTED, /* set when log is aborted */ |
260 | }; | 260 | }; |
261 | 261 | ||
262 | #define JOURNAL_DESC_MAGIC "ReIsErLB" /* ick. magic string to find desc blocks in the journal */ | ||
262 | 263 | ||
263 | #define JOURNAL_DESC_MAGIC "ReIsErLB" /* ick. magic string to find desc blocks in the journal */ | 264 | typedef __u32(*hashf_t) (const signed char *, int); |
264 | 265 | ||
265 | typedef __u32 (*hashf_t) (const signed char *, int); | 266 | struct reiserfs_bitmap_info { |
266 | 267 | // FIXME: Won't work with block sizes > 8K | |
267 | struct reiserfs_bitmap_info | 268 | __u16 first_zero_hint; |
268 | { | 269 | __u16 free_count; |
269 | // FIXME: Won't work with block sizes > 8K | 270 | struct buffer_head *bh; /* the actual bitmap */ |
270 | __u16 first_zero_hint; | ||
271 | __u16 free_count; | ||
272 | struct buffer_head *bh; /* the actual bitmap */ | ||
273 | }; | 271 | }; |
274 | 272 | ||
275 | struct proc_dir_entry; | 273 | struct proc_dir_entry; |
276 | 274 | ||
277 | #if defined( CONFIG_PROC_FS ) && defined( CONFIG_REISERFS_PROC_INFO ) | 275 | #if defined( CONFIG_PROC_FS ) && defined( CONFIG_REISERFS_PROC_INFO ) |
278 | typedef unsigned long int stat_cnt_t; | 276 | typedef unsigned long int stat_cnt_t; |
279 | typedef struct reiserfs_proc_info_data | 277 | typedef struct reiserfs_proc_info_data { |
280 | { | 278 | spinlock_t lock; |
281 | spinlock_t lock; | 279 | int exiting; |
282 | int exiting; | 280 | int max_hash_collisions; |
283 | int max_hash_collisions; | 281 | |
284 | 282 | stat_cnt_t breads; | |
285 | stat_cnt_t breads; | 283 | stat_cnt_t bread_miss; |
286 | stat_cnt_t bread_miss; | 284 | stat_cnt_t search_by_key; |
287 | stat_cnt_t search_by_key; | 285 | stat_cnt_t search_by_key_fs_changed; |
288 | stat_cnt_t search_by_key_fs_changed; | 286 | stat_cnt_t search_by_key_restarted; |
289 | stat_cnt_t search_by_key_restarted; | 287 | |
290 | 288 | stat_cnt_t insert_item_restarted; | |
291 | stat_cnt_t insert_item_restarted; | 289 | stat_cnt_t paste_into_item_restarted; |
292 | stat_cnt_t paste_into_item_restarted; | 290 | stat_cnt_t cut_from_item_restarted; |
293 | stat_cnt_t cut_from_item_restarted; | 291 | stat_cnt_t delete_solid_item_restarted; |
294 | stat_cnt_t delete_solid_item_restarted; | 292 | stat_cnt_t delete_item_restarted; |
295 | stat_cnt_t delete_item_restarted; | 293 | |
296 | 294 | stat_cnt_t leaked_oid; | |
297 | stat_cnt_t leaked_oid; | 295 | stat_cnt_t leaves_removable; |
298 | stat_cnt_t leaves_removable; | 296 | |
299 | 297 | /* balances per level. Use explicit 5 as MAX_HEIGHT is not visible yet. */ | |
300 | /* balances per level. Use explicit 5 as MAX_HEIGHT is not visible yet. */ | 298 | stat_cnt_t balance_at[5]; /* XXX */ |
301 | stat_cnt_t balance_at[ 5 ]; /* XXX */ | 299 | /* sbk == search_by_key */ |
302 | /* sbk == search_by_key */ | 300 | stat_cnt_t sbk_read_at[5]; /* XXX */ |
303 | stat_cnt_t sbk_read_at[ 5 ]; /* XXX */ | 301 | stat_cnt_t sbk_fs_changed[5]; |
304 | stat_cnt_t sbk_fs_changed[ 5 ]; | 302 | stat_cnt_t sbk_restarted[5]; |
305 | stat_cnt_t sbk_restarted[ 5 ]; | 303 | stat_cnt_t items_at[5]; /* XXX */ |
306 | stat_cnt_t items_at[ 5 ]; /* XXX */ | 304 | stat_cnt_t free_at[5]; /* XXX */ |
307 | stat_cnt_t free_at[ 5 ]; /* XXX */ | 305 | stat_cnt_t can_node_be_removed[5]; /* XXX */ |
308 | stat_cnt_t can_node_be_removed[ 5 ]; /* XXX */ | 306 | long int lnum[5]; /* XXX */ |
309 | long int lnum[ 5 ]; /* XXX */ | 307 | long int rnum[5]; /* XXX */ |
310 | long int rnum[ 5 ]; /* XXX */ | 308 | long int lbytes[5]; /* XXX */ |
311 | long int lbytes[ 5 ]; /* XXX */ | 309 | long int rbytes[5]; /* XXX */ |
312 | long int rbytes[ 5 ]; /* XXX */ | 310 | stat_cnt_t get_neighbors[5]; |
313 | stat_cnt_t get_neighbors[ 5 ]; | 311 | stat_cnt_t get_neighbors_restart[5]; |
314 | stat_cnt_t get_neighbors_restart[ 5 ]; | 312 | stat_cnt_t need_l_neighbor[5]; |
315 | stat_cnt_t need_l_neighbor[ 5 ]; | 313 | stat_cnt_t need_r_neighbor[5]; |
316 | stat_cnt_t need_r_neighbor[ 5 ]; | 314 | |
317 | 315 | stat_cnt_t free_block; | |
318 | stat_cnt_t free_block; | 316 | struct __scan_bitmap_stats { |
319 | struct __scan_bitmap_stats { | 317 | stat_cnt_t call; |
320 | stat_cnt_t call; | 318 | stat_cnt_t wait; |
321 | stat_cnt_t wait; | 319 | stat_cnt_t bmap; |
322 | stat_cnt_t bmap; | 320 | stat_cnt_t retry; |
323 | stat_cnt_t retry; | 321 | stat_cnt_t in_journal_hint; |
324 | stat_cnt_t in_journal_hint; | 322 | stat_cnt_t in_journal_nohint; |
325 | stat_cnt_t in_journal_nohint; | 323 | stat_cnt_t stolen; |
326 | stat_cnt_t stolen; | 324 | } scan_bitmap; |
327 | } scan_bitmap; | 325 | struct __journal_stats { |
328 | struct __journal_stats { | 326 | stat_cnt_t in_journal; |
329 | stat_cnt_t in_journal; | 327 | stat_cnt_t in_journal_bitmap; |
330 | stat_cnt_t in_journal_bitmap; | 328 | stat_cnt_t in_journal_reusable; |
331 | stat_cnt_t in_journal_reusable; | 329 | stat_cnt_t lock_journal; |
332 | stat_cnt_t lock_journal; | 330 | stat_cnt_t lock_journal_wait; |
333 | stat_cnt_t lock_journal_wait; | 331 | stat_cnt_t journal_being; |
334 | stat_cnt_t journal_being; | 332 | stat_cnt_t journal_relock_writers; |
335 | stat_cnt_t journal_relock_writers; | 333 | stat_cnt_t journal_relock_wcount; |
336 | stat_cnt_t journal_relock_wcount; | 334 | stat_cnt_t mark_dirty; |
337 | stat_cnt_t mark_dirty; | 335 | stat_cnt_t mark_dirty_already; |
338 | stat_cnt_t mark_dirty_already; | 336 | stat_cnt_t mark_dirty_notjournal; |
339 | stat_cnt_t mark_dirty_notjournal; | 337 | stat_cnt_t restore_prepared; |
340 | stat_cnt_t restore_prepared; | 338 | stat_cnt_t prepare; |
341 | stat_cnt_t prepare; | 339 | stat_cnt_t prepare_retry; |
342 | stat_cnt_t prepare_retry; | 340 | } journal; |
343 | } journal; | ||
344 | } reiserfs_proc_info_data_t; | 341 | } reiserfs_proc_info_data_t; |
345 | #else | 342 | #else |
346 | typedef struct reiserfs_proc_info_data | 343 | typedef struct reiserfs_proc_info_data { |
347 | {} reiserfs_proc_info_data_t; | 344 | } reiserfs_proc_info_data_t; |
348 | #endif | 345 | #endif |
349 | 346 | ||
350 | /* reiserfs union of in-core super block data */ | 347 | /* reiserfs union of in-core super block data */ |
351 | struct reiserfs_sb_info | 348 | struct reiserfs_sb_info { |
352 | { | 349 | struct buffer_head *s_sbh; /* Buffer containing the super block */ |
353 | struct buffer_head * s_sbh; /* Buffer containing the super block */ | 350 | /* both the comment and the choice of |
354 | /* both the comment and the choice of | 351 | name are unclear for s_rs -Hans */ |
355 | name are unclear for s_rs -Hans */ | 352 | struct reiserfs_super_block *s_rs; /* Pointer to the super block in the buffer */ |
356 | struct reiserfs_super_block * s_rs; /* Pointer to the super block in the buffer */ | 353 | struct reiserfs_bitmap_info *s_ap_bitmap; |
357 | struct reiserfs_bitmap_info * s_ap_bitmap; | 354 | struct reiserfs_journal *s_journal; /* pointer to journal information */ |
358 | struct reiserfs_journal *s_journal ; /* pointer to journal information */ | 355 | unsigned short s_mount_state; /* reiserfs state (valid, invalid) */ |
359 | unsigned short s_mount_state; /* reiserfs state (valid, invalid) */ | 356 | |
360 | 357 | /* Comment? -Hans */ | |
361 | /* Comment? -Hans */ | 358 | void (*end_io_handler) (struct buffer_head *, int); |
362 | void (*end_io_handler)(struct buffer_head *, int); | 359 | hashf_t s_hash_function; /* pointer to function which is used |
363 | hashf_t s_hash_function; /* pointer to function which is used | 360 | to sort names in directory. Set on |
364 | to sort names in directory. Set on | 361 | mount */ |
365 | mount */ | 362 | unsigned long s_mount_opt; /* reiserfs's mount options are set |
366 | unsigned long s_mount_opt; /* reiserfs's mount options are set | 363 | here (currently - NOTAIL, NOLOG, |
367 | here (currently - NOTAIL, NOLOG, | 364 | REPLAYONLY) */ |
368 | REPLAYONLY) */ | 365 | |
369 | 366 | struct { /* This is a structure that describes block allocator options */ | |
370 | struct { /* This is a structure that describes block allocator options */ | 367 | unsigned long bits; /* Bitfield for enable/disable kind of options */ |
371 | unsigned long bits; /* Bitfield for enable/disable kind of options */ | 368 | unsigned long large_file_size; /* size started from which we consider file to be a large one(in blocks) */ |
372 | unsigned long large_file_size; /* size started from which we consider file to be a large one(in blocks) */ | 369 | int border; /* percentage of disk, border takes */ |
373 | int border; /* percentage of disk, border takes */ | 370 | int preallocmin; /* Minimal file size (in blocks) starting from which we do preallocations */ |
374 | int preallocmin; /* Minimal file size (in blocks) starting from which we do preallocations */ | 371 | int preallocsize; /* Number of blocks we try to prealloc when file |
375 | int preallocsize; /* Number of blocks we try to prealloc when file | 372 | reaches preallocmin size (in blocks) or |
376 | reaches preallocmin size (in blocks) or | 373 | prealloc_list is empty. */ |
377 | prealloc_list is empty. */ | 374 | } s_alloc_options; |
378 | } s_alloc_options; | 375 | |
379 | 376 | /* Comment? -Hans */ | |
380 | /* Comment? -Hans */ | 377 | wait_queue_head_t s_wait; |
381 | wait_queue_head_t s_wait; | 378 | /* To be obsoleted soon by per buffer seals.. -Hans */ |
382 | /* To be obsoleted soon by per buffer seals.. -Hans */ | 379 | atomic_t s_generation_counter; // increased by one every time the |
383 | atomic_t s_generation_counter; // increased by one every time the | 380 | // tree gets re-balanced |
384 | // tree gets re-balanced | 381 | unsigned long s_properties; /* File system properties. Currently holds |
385 | unsigned long s_properties; /* File system properties. Currently holds | 382 | on-disk FS format */ |
386 | on-disk FS format */ | 383 | |
387 | 384 | /* session statistics */ | |
388 | /* session statistics */ | 385 | int s_kmallocs; |
389 | int s_kmallocs; | 386 | int s_disk_reads; |
390 | int s_disk_reads; | 387 | int s_disk_writes; |
391 | int s_disk_writes; | 388 | int s_fix_nodes; |
392 | int s_fix_nodes; | 389 | int s_do_balance; |
393 | int s_do_balance; | 390 | int s_unneeded_left_neighbor; |
394 | int s_unneeded_left_neighbor; | 391 | int s_good_search_by_key_reada; |
395 | int s_good_search_by_key_reada; | 392 | int s_bmaps; |
396 | int s_bmaps; | 393 | int s_bmaps_without_search; |
397 | int s_bmaps_without_search; | 394 | int s_direct2indirect; |
398 | int s_direct2indirect; | 395 | int s_indirect2direct; |
399 | int s_indirect2direct; | ||
400 | /* set up when it's ok for reiserfs_read_inode2() to read from | 396 | /* set up when it's ok for reiserfs_read_inode2() to read from |
401 | disk inode with nlink==0. Currently this is only used during | 397 | disk inode with nlink==0. Currently this is only used during |
402 | finish_unfinished() processing at mount time */ | 398 | finish_unfinished() processing at mount time */ |
403 | int s_is_unlinked_ok; | 399 | int s_is_unlinked_ok; |
404 | reiserfs_proc_info_data_t s_proc_info_data; | 400 | reiserfs_proc_info_data_t s_proc_info_data; |
405 | struct proc_dir_entry *procdir; | 401 | struct proc_dir_entry *procdir; |
406 | int reserved_blocks; /* amount of blocks reserved for further allocations */ | 402 | int reserved_blocks; /* amount of blocks reserved for further allocations */ |
407 | spinlock_t bitmap_lock; /* this lock on now only used to protect reserved_blocks variable */ | 403 | spinlock_t bitmap_lock; /* this lock on now only used to protect reserved_blocks variable */ |
408 | struct dentry *priv_root; /* root of /.reiserfs_priv */ | 404 | struct dentry *priv_root; /* root of /.reiserfs_priv */ |
409 | struct dentry *xattr_root; /* root of /.reiserfs_priv/.xa */ | 405 | struct dentry *xattr_root; /* root of /.reiserfs_priv/.xa */ |
410 | struct rw_semaphore xattr_dir_sem; | 406 | struct rw_semaphore xattr_dir_sem; |
411 | 407 | ||
412 | int j_errno; | 408 | int j_errno; |
413 | #ifdef CONFIG_QUOTA | 409 | #ifdef CONFIG_QUOTA |
414 | char *s_qf_names[MAXQUOTAS]; | 410 | char *s_qf_names[MAXQUOTAS]; |
415 | int s_jquota_fmt; | 411 | int s_jquota_fmt; |
416 | #endif | 412 | #endif |
417 | }; | 413 | }; |
418 | 414 | ||
@@ -422,14 +418,14 @@ struct reiserfs_sb_info | |||
422 | 418 | ||
423 | enum reiserfs_mount_options { | 419 | enum reiserfs_mount_options { |
424 | /* Mount options */ | 420 | /* Mount options */ |
425 | REISERFS_LARGETAIL, /* large tails will be created in a session */ | 421 | REISERFS_LARGETAIL, /* large tails will be created in a session */ |
426 | REISERFS_SMALLTAIL, /* small (for files less than block size) tails will be created in a session */ | 422 | REISERFS_SMALLTAIL, /* small (for files less than block size) tails will be created in a session */ |
427 | REPLAYONLY, /* replay journal and return 0. Use by fsck */ | 423 | REPLAYONLY, /* replay journal and return 0. Use by fsck */ |
428 | REISERFS_CONVERT, /* -o conv: causes conversion of old | 424 | REISERFS_CONVERT, /* -o conv: causes conversion of old |
429 | format super block to the new | 425 | format super block to the new |
430 | format. If not specified - old | 426 | format. If not specified - old |
431 | partition will be dealt with in a | 427 | partition will be dealt with in a |
432 | manner of 3.5.x */ | 428 | manner of 3.5.x */ |
433 | 429 | ||
434 | /* -o hash={tea, rupasov, r5, detect} is meant for properly mounting | 430 | /* -o hash={tea, rupasov, r5, detect} is meant for properly mounting |
435 | ** reiserfs disks from 3.5.19 or earlier. 99% of the time, this option | 431 | ** reiserfs disks from 3.5.19 or earlier. 99% of the time, this option |
@@ -439,41 +435,41 @@ enum reiserfs_mount_options { | |||
439 | ** the existing hash on the FS, so if you have a tea hash disk, and mount | 435 | ** the existing hash on the FS, so if you have a tea hash disk, and mount |
440 | ** with -o hash=rupasov, the mount will fail. | 436 | ** with -o hash=rupasov, the mount will fail. |
441 | */ | 437 | */ |
442 | FORCE_TEA_HASH, /* try to force tea hash on mount */ | 438 | FORCE_TEA_HASH, /* try to force tea hash on mount */ |
443 | FORCE_RUPASOV_HASH, /* try to force rupasov hash on mount */ | 439 | FORCE_RUPASOV_HASH, /* try to force rupasov hash on mount */ |
444 | FORCE_R5_HASH, /* try to force rupasov hash on mount */ | 440 | FORCE_R5_HASH, /* try to force rupasov hash on mount */ |
445 | FORCE_HASH_DETECT, /* try to detect hash function on mount */ | 441 | FORCE_HASH_DETECT, /* try to detect hash function on mount */ |
446 | 442 | ||
447 | REISERFS_DATA_LOG, | 443 | REISERFS_DATA_LOG, |
448 | REISERFS_DATA_ORDERED, | 444 | REISERFS_DATA_ORDERED, |
449 | REISERFS_DATA_WRITEBACK, | 445 | REISERFS_DATA_WRITEBACK, |
450 | 446 | ||
451 | /* used for testing experimental features, makes benchmarking new | 447 | /* used for testing experimental features, makes benchmarking new |
452 | features with and without more convenient, should never be used by | 448 | features with and without more convenient, should never be used by |
453 | users in any code shipped to users (ideally) */ | 449 | users in any code shipped to users (ideally) */ |
454 | 450 | ||
455 | REISERFS_NO_BORDER, | 451 | REISERFS_NO_BORDER, |
456 | REISERFS_NO_UNHASHED_RELOCATION, | 452 | REISERFS_NO_UNHASHED_RELOCATION, |
457 | REISERFS_HASHED_RELOCATION, | 453 | REISERFS_HASHED_RELOCATION, |
458 | REISERFS_ATTRS, | 454 | REISERFS_ATTRS, |
459 | REISERFS_XATTRS, | 455 | REISERFS_XATTRS, |
460 | REISERFS_XATTRS_USER, | 456 | REISERFS_XATTRS_USER, |
461 | REISERFS_POSIXACL, | 457 | REISERFS_POSIXACL, |
462 | REISERFS_BARRIER_NONE, | 458 | REISERFS_BARRIER_NONE, |
463 | REISERFS_BARRIER_FLUSH, | 459 | REISERFS_BARRIER_FLUSH, |
464 | 460 | ||
465 | /* Actions on error */ | 461 | /* Actions on error */ |
466 | REISERFS_ERROR_PANIC, | 462 | REISERFS_ERROR_PANIC, |
467 | REISERFS_ERROR_RO, | 463 | REISERFS_ERROR_RO, |
468 | REISERFS_ERROR_CONTINUE, | 464 | REISERFS_ERROR_CONTINUE, |
469 | 465 | ||
470 | REISERFS_QUOTA, /* Some quota option specified */ | 466 | REISERFS_QUOTA, /* Some quota option specified */ |
471 | 467 | ||
472 | REISERFS_TEST1, | 468 | REISERFS_TEST1, |
473 | REISERFS_TEST2, | 469 | REISERFS_TEST2, |
474 | REISERFS_TEST3, | 470 | REISERFS_TEST3, |
475 | REISERFS_TEST4, | 471 | REISERFS_TEST4, |
476 | REISERFS_UNSUPPORTED_OPT, | 472 | REISERFS_UNSUPPORTED_OPT, |
477 | }; | 473 | }; |
478 | 474 | ||
479 | #define reiserfs_r5_hash(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_R5_HASH)) | 475 | #define reiserfs_r5_hash(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_R5_HASH)) |
@@ -504,18 +500,17 @@ enum reiserfs_mount_options { | |||
504 | #define reiserfs_error_panic(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_PANIC)) | 500 | #define reiserfs_error_panic(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_PANIC)) |
505 | #define reiserfs_error_ro(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_RO)) | 501 | #define reiserfs_error_ro(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_RO)) |
506 | 502 | ||
507 | void reiserfs_file_buffer (struct buffer_head * bh, int list); | 503 | void reiserfs_file_buffer(struct buffer_head *bh, int list); |
508 | extern struct file_system_type reiserfs_fs_type; | 504 | extern struct file_system_type reiserfs_fs_type; |
509 | int reiserfs_resize(struct super_block *, unsigned long) ; | 505 | int reiserfs_resize(struct super_block *, unsigned long); |
510 | 506 | ||
511 | #define CARRY_ON 0 | 507 | #define CARRY_ON 0 |
512 | #define SCHEDULE_OCCURRED 1 | 508 | #define SCHEDULE_OCCURRED 1 |
513 | 509 | ||
514 | |||
515 | #define SB_BUFFER_WITH_SB(s) (REISERFS_SB(s)->s_sbh) | 510 | #define SB_BUFFER_WITH_SB(s) (REISERFS_SB(s)->s_sbh) |
516 | #define SB_JOURNAL(s) (REISERFS_SB(s)->s_journal) | 511 | #define SB_JOURNAL(s) (REISERFS_SB(s)->s_journal) |
517 | #define SB_JOURNAL_1st_RESERVED_BLOCK(s) (SB_JOURNAL(s)->j_1st_reserved_block) | 512 | #define SB_JOURNAL_1st_RESERVED_BLOCK(s) (SB_JOURNAL(s)->j_1st_reserved_block) |
518 | #define SB_JOURNAL_LEN_FREE(s) (SB_JOURNAL(s)->j_journal_len_free) | 513 | #define SB_JOURNAL_LEN_FREE(s) (SB_JOURNAL(s)->j_journal_len_free) |
519 | #define SB_AP_BITMAP(s) (REISERFS_SB(s)->s_ap_bitmap) | 514 | #define SB_AP_BITMAP(s) (REISERFS_SB(s)->s_ap_bitmap) |
520 | 515 | ||
521 | #define SB_DISK_JOURNAL_HEAD(s) (SB_JOURNAL(s)->j_header_bh->) | 516 | #define SB_DISK_JOURNAL_HEAD(s) (SB_JOURNAL(s)->j_header_bh->) |
@@ -525,13 +520,14 @@ int reiserfs_resize(struct super_block *, unsigned long) ; | |||
525 | */ | 520 | */ |
526 | static inline char *reiserfs_bdevname(struct super_block *s) | 521 | static inline char *reiserfs_bdevname(struct super_block *s) |
527 | { | 522 | { |
528 | return (s == NULL) ? "Null superblock" : s -> s_id; | 523 | return (s == NULL) ? "Null superblock" : s->s_id; |
529 | } | 524 | } |
530 | 525 | ||
531 | #define reiserfs_is_journal_aborted(journal) (unlikely (__reiserfs_is_journal_aborted (journal))) | 526 | #define reiserfs_is_journal_aborted(journal) (unlikely (__reiserfs_is_journal_aborted (journal))) |
532 | static inline int __reiserfs_is_journal_aborted (struct reiserfs_journal *journal) | 527 | static inline int __reiserfs_is_journal_aborted(struct reiserfs_journal |
528 | *journal) | ||
533 | { | 529 | { |
534 | return test_bit (J_ABORTED, &journal->j_state); | 530 | return test_bit(J_ABORTED, &journal->j_state); |
535 | } | 531 | } |
536 | 532 | ||
537 | #endif /* _LINUX_REISER_FS_SB */ | 533 | #endif /* _LINUX_REISER_FS_SB */ |
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h index 9244c5748820..c84354e8374c 100644 --- a/include/linux/reiserfs_xattr.h +++ b/include/linux/reiserfs_xattr.h | |||
@@ -7,48 +7,48 @@ | |||
7 | #include <linux/xattr.h> | 7 | #include <linux/xattr.h> |
8 | 8 | ||
9 | /* Magic value in header */ | 9 | /* Magic value in header */ |
10 | #define REISERFS_XATTR_MAGIC 0x52465841 /* "RFXA" */ | 10 | #define REISERFS_XATTR_MAGIC 0x52465841 /* "RFXA" */ |
11 | 11 | ||
12 | struct reiserfs_xattr_header { | 12 | struct reiserfs_xattr_header { |
13 | __le32 h_magic; /* magic number for identification */ | 13 | __le32 h_magic; /* magic number for identification */ |
14 | __le32 h_hash; /* hash of the value */ | 14 | __le32 h_hash; /* hash of the value */ |
15 | }; | 15 | }; |
16 | 16 | ||
17 | #ifdef __KERNEL__ | 17 | #ifdef __KERNEL__ |
18 | 18 | ||
19 | struct reiserfs_xattr_handler { | 19 | struct reiserfs_xattr_handler { |
20 | char *prefix; | 20 | char *prefix; |
21 | int (*init)(void); | 21 | int (*init) (void); |
22 | void (*exit)(void); | 22 | void (*exit) (void); |
23 | int (*get)(struct inode *inode, const char *name, void *buffer, | 23 | int (*get) (struct inode * inode, const char *name, void *buffer, |
24 | size_t size); | 24 | size_t size); |
25 | int (*set)(struct inode *inode, const char *name, const void *buffer, | 25 | int (*set) (struct inode * inode, const char *name, const void *buffer, |
26 | size_t size, int flags); | 26 | size_t size, int flags); |
27 | int (*del)(struct inode *inode, const char *name); | 27 | int (*del) (struct inode * inode, const char *name); |
28 | int (*list)(struct inode *inode, const char *name, int namelen, char *out); | 28 | int (*list) (struct inode * inode, const char *name, int namelen, |
29 | struct list_head handlers; | 29 | char *out); |
30 | struct list_head handlers; | ||
30 | }; | 31 | }; |
31 | 32 | ||
32 | |||
33 | #ifdef CONFIG_REISERFS_FS_XATTR | 33 | #ifdef CONFIG_REISERFS_FS_XATTR |
34 | #define is_reiserfs_priv_object(inode) IS_PRIVATE(inode) | 34 | #define is_reiserfs_priv_object(inode) IS_PRIVATE(inode) |
35 | #define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir) | 35 | #define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir) |
36 | ssize_t reiserfs_getxattr (struct dentry *dentry, const char *name, | 36 | ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name, |
37 | void *buffer, size_t size); | 37 | void *buffer, size_t size); |
38 | int reiserfs_setxattr (struct dentry *dentry, const char *name, | 38 | int reiserfs_setxattr(struct dentry *dentry, const char *name, |
39 | const void *value, size_t size, int flags); | 39 | const void *value, size_t size, int flags); |
40 | ssize_t reiserfs_listxattr (struct dentry *dentry, char *buffer, size_t size); | 40 | ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size); |
41 | int reiserfs_removexattr (struct dentry *dentry, const char *name); | 41 | int reiserfs_removexattr(struct dentry *dentry, const char *name); |
42 | int reiserfs_delete_xattrs (struct inode *inode); | 42 | int reiserfs_delete_xattrs(struct inode *inode); |
43 | int reiserfs_chown_xattrs (struct inode *inode, struct iattr *attrs); | 43 | int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs); |
44 | int reiserfs_xattr_init (struct super_block *sb, int mount_flags); | 44 | int reiserfs_xattr_init(struct super_block *sb, int mount_flags); |
45 | int reiserfs_permission (struct inode *inode, int mask, struct nameidata *nd); | 45 | int reiserfs_permission(struct inode *inode, int mask, struct nameidata *nd); |
46 | int reiserfs_permission_locked (struct inode *inode, int mask, struct nameidata *nd); | 46 | int reiserfs_permission_locked(struct inode *inode, int mask, |
47 | 47 | struct nameidata *nd); | |
48 | int reiserfs_xattr_del (struct inode *, const char *); | 48 | |
49 | int reiserfs_xattr_get (const struct inode *, const char *, void *, size_t); | 49 | int reiserfs_xattr_del(struct inode *, const char *); |
50 | int reiserfs_xattr_set (struct inode *, const char *, const void *, | 50 | int reiserfs_xattr_get(const struct inode *, const char *, void *, size_t); |
51 | size_t, int); | 51 | int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int); |
52 | 52 | ||
53 | extern struct reiserfs_xattr_handler user_handler; | 53 | extern struct reiserfs_xattr_handler user_handler; |
54 | extern struct reiserfs_xattr_handler trusted_handler; | 54 | extern struct reiserfs_xattr_handler trusted_handler; |
@@ -56,57 +56,48 @@ extern struct reiserfs_xattr_handler trusted_handler; | |||
56 | extern struct reiserfs_xattr_handler security_handler; | 56 | extern struct reiserfs_xattr_handler security_handler; |
57 | #endif | 57 | #endif |
58 | 58 | ||
59 | int reiserfs_xattr_register_handlers (void) __init; | 59 | int reiserfs_xattr_register_handlers(void) __init; |
60 | void reiserfs_xattr_unregister_handlers (void); | 60 | void reiserfs_xattr_unregister_handlers(void); |
61 | 61 | ||
62 | static inline void | 62 | static inline void reiserfs_write_lock_xattrs(struct super_block *sb) |
63 | reiserfs_write_lock_xattrs(struct super_block *sb) | ||
64 | { | 63 | { |
65 | down_write (&REISERFS_XATTR_DIR_SEM(sb)); | 64 | down_write(&REISERFS_XATTR_DIR_SEM(sb)); |
66 | } | 65 | } |
67 | static inline void | 66 | static inline void reiserfs_write_unlock_xattrs(struct super_block *sb) |
68 | reiserfs_write_unlock_xattrs(struct super_block *sb) | ||
69 | { | 67 | { |
70 | up_write (&REISERFS_XATTR_DIR_SEM(sb)); | 68 | up_write(&REISERFS_XATTR_DIR_SEM(sb)); |
71 | } | 69 | } |
72 | static inline void | 70 | static inline void reiserfs_read_lock_xattrs(struct super_block *sb) |
73 | reiserfs_read_lock_xattrs(struct super_block *sb) | ||
74 | { | 71 | { |
75 | down_read (&REISERFS_XATTR_DIR_SEM(sb)); | 72 | down_read(&REISERFS_XATTR_DIR_SEM(sb)); |
76 | } | 73 | } |
77 | 74 | ||
78 | static inline void | 75 | static inline void reiserfs_read_unlock_xattrs(struct super_block *sb) |
79 | reiserfs_read_unlock_xattrs(struct super_block *sb) | ||
80 | { | 76 | { |
81 | up_read (&REISERFS_XATTR_DIR_SEM(sb)); | 77 | up_read(&REISERFS_XATTR_DIR_SEM(sb)); |
82 | } | 78 | } |
83 | 79 | ||
84 | static inline void | 80 | static inline void reiserfs_write_lock_xattr_i(struct inode *inode) |
85 | reiserfs_write_lock_xattr_i(struct inode *inode) | ||
86 | { | 81 | { |
87 | down_write (&REISERFS_I(inode)->xattr_sem); | 82 | down_write(&REISERFS_I(inode)->xattr_sem); |
88 | } | 83 | } |
89 | static inline void | 84 | static inline void reiserfs_write_unlock_xattr_i(struct inode *inode) |
90 | reiserfs_write_unlock_xattr_i(struct inode *inode) | ||
91 | { | 85 | { |
92 | up_write (&REISERFS_I(inode)->xattr_sem); | 86 | up_write(&REISERFS_I(inode)->xattr_sem); |
93 | } | 87 | } |
94 | static inline void | 88 | static inline void reiserfs_read_lock_xattr_i(struct inode *inode) |
95 | reiserfs_read_lock_xattr_i(struct inode *inode) | ||
96 | { | 89 | { |
97 | down_read (&REISERFS_I(inode)->xattr_sem); | 90 | down_read(&REISERFS_I(inode)->xattr_sem); |
98 | } | 91 | } |
99 | 92 | ||
100 | static inline void | 93 | static inline void reiserfs_read_unlock_xattr_i(struct inode *inode) |
101 | reiserfs_read_unlock_xattr_i(struct inode *inode) | ||
102 | { | 94 | { |
103 | up_read (&REISERFS_I(inode)->xattr_sem); | 95 | up_read(&REISERFS_I(inode)->xattr_sem); |
104 | } | 96 | } |
105 | 97 | ||
106 | static inline void | 98 | static inline void reiserfs_mark_inode_private(struct inode *inode) |
107 | reiserfs_mark_inode_private(struct inode *inode) | ||
108 | { | 99 | { |
109 | inode->i_flags |= S_PRIVATE; | 100 | inode->i_flags |= S_PRIVATE; |
110 | } | 101 | } |
111 | 102 | ||
112 | #else | 103 | #else |
@@ -127,13 +118,20 @@ reiserfs_mark_inode_private(struct inode *inode) | |||
127 | #define reiserfs_xattr_register_handlers() 0 | 118 | #define reiserfs_xattr_register_handlers() 0 |
128 | #define reiserfs_xattr_unregister_handlers() | 119 | #define reiserfs_xattr_unregister_handlers() |
129 | 120 | ||
130 | static inline int reiserfs_delete_xattrs (struct inode *inode) { return 0; }; | 121 | static inline int reiserfs_delete_xattrs(struct inode *inode) |
131 | static inline int reiserfs_chown_xattrs (struct inode *inode, struct iattr *attrs) { return 0; }; | 122 | { |
132 | static inline int reiserfs_xattr_init (struct super_block *sb, int mount_flags) | 123 | return 0; |
124 | }; | ||
125 | static inline int reiserfs_chown_xattrs(struct inode *inode, | ||
126 | struct iattr *attrs) | ||
127 | { | ||
128 | return 0; | ||
129 | }; | ||
130 | static inline int reiserfs_xattr_init(struct super_block *sb, int mount_flags) | ||
133 | { | 131 | { |
134 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL); /* to be sure */ | 132 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL); /* to be sure */ |
135 | return 0; | 133 | return 0; |
136 | }; | 134 | }; |
137 | #endif | 135 | #endif |
138 | 136 | ||
139 | #endif /* __KERNEL__ */ | 137 | #endif /* __KERNEL__ */ |