diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-07 20:16:27 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-07 20:16:27 -0500 |
commit | 0c21e3aaf6ae85bee804a325aa29c325209180fd (patch) | |
tree | 81c5d698e1c40cc8f473b21c5587a34598754a64 /fs/hfsplus/hfsplus_fs.h | |
parent | 021db8e2bde53024a163fb4417a185de46fe77aa (diff) | |
parent | b2837fcf4994e699a4def002e26f274d95b387c1 (diff) |
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/hch/hfsplus
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/hch/hfsplus:
hfsplus: %L-to-%ll, macro correction, and remove unneeded braces
hfsplus: spaces/indentation clean-up
hfsplus: C99 comments clean-up
hfsplus: over 80 character lines clean-up
hfsplus: fix an artifact in ioctl flag checking
hfsplus: flush disk caches in sync and fsync
hfsplus: optimize fsync
hfsplus: split up inode flags
hfsplus: write up fsync for directories
hfsplus: simplify fsync
hfsplus: avoid useless work in hfsplus_sync_fs
hfsplus: make sure sync writes out all metadata
hfsplus: use raw bio access for partition tables
hfsplus: use raw bio access for the volume headers
hfsplus: always use hfsplus_sync_fs to write the volume header
hfsplus: silence a few debug printks
hfsplus: fix option parsing during remount
Fix up conflicts due to VFS changes in fs/hfsplus/{hfsplus_fs.h,unicode.c}
Diffstat (limited to 'fs/hfsplus/hfsplus_fs.h')
-rw-r--r-- | fs/hfsplus/hfsplus_fs.h | 126 |
1 files changed, 73 insertions, 53 deletions
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h index a5308f491e3e..d6857523336d 100644 --- a/fs/hfsplus/hfsplus_fs.h +++ b/fs/hfsplus/hfsplus_fs.h | |||
@@ -23,13 +23,16 @@ | |||
23 | #define DBG_EXTENT 0x00000020 | 23 | #define DBG_EXTENT 0x00000020 |
24 | #define DBG_BITMAP 0x00000040 | 24 | #define DBG_BITMAP 0x00000040 |
25 | 25 | ||
26 | //#define DBG_MASK (DBG_EXTENT|DBG_INODE|DBG_BNODE_MOD) | 26 | #if 0 |
27 | //#define DBG_MASK (DBG_BNODE_MOD|DBG_CAT_MOD|DBG_INODE) | 27 | #define DBG_MASK (DBG_EXTENT|DBG_INODE|DBG_BNODE_MOD) |
28 | //#define DBG_MASK (DBG_CAT_MOD|DBG_BNODE_REFS|DBG_INODE|DBG_EXTENT) | 28 | #define DBG_MASK (DBG_BNODE_MOD|DBG_CAT_MOD|DBG_INODE) |
29 | #define DBG_MASK (DBG_CAT_MOD|DBG_BNODE_REFS|DBG_INODE|DBG_EXTENT) | ||
30 | #endif | ||
29 | #define DBG_MASK (0) | 31 | #define DBG_MASK (0) |
30 | 32 | ||
31 | #define dprint(flg, fmt, args...) \ | 33 | #define dprint(flg, fmt, args...) \ |
32 | if (flg & DBG_MASK) printk(fmt , ## args) | 34 | if (flg & DBG_MASK) \ |
35 | printk(fmt , ## args) | ||
33 | 36 | ||
34 | /* Runtime config options */ | 37 | /* Runtime config options */ |
35 | #define HFSPLUS_DEF_CR_TYPE 0x3F3F3F3F /* '????' */ | 38 | #define HFSPLUS_DEF_CR_TYPE 0x3F3F3F3F /* '????' */ |
@@ -37,7 +40,8 @@ | |||
37 | #define HFSPLUS_TYPE_DATA 0x00 | 40 | #define HFSPLUS_TYPE_DATA 0x00 |
38 | #define HFSPLUS_TYPE_RSRC 0xFF | 41 | #define HFSPLUS_TYPE_RSRC 0xFF |
39 | 42 | ||
40 | typedef int (*btree_keycmp)(const hfsplus_btree_key *, const hfsplus_btree_key *); | 43 | typedef int (*btree_keycmp)(const hfsplus_btree_key *, |
44 | const hfsplus_btree_key *); | ||
41 | 45 | ||
42 | #define NODE_HASH_SIZE 256 | 46 | #define NODE_HASH_SIZE 256 |
43 | 47 | ||
@@ -61,7 +65,6 @@ struct hfs_btree { | |||
61 | unsigned int max_key_len; | 65 | unsigned int max_key_len; |
62 | unsigned int depth; | 66 | unsigned int depth; |
63 | 67 | ||
64 | //unsigned int map1_size, map_size; | ||
65 | struct mutex tree_lock; | 68 | struct mutex tree_lock; |
66 | 69 | ||
67 | unsigned int pages_per_bnode; | 70 | unsigned int pages_per_bnode; |
@@ -107,8 +110,8 @@ struct hfsplus_vh; | |||
107 | struct hfs_btree; | 110 | struct hfs_btree; |
108 | 111 | ||
109 | struct hfsplus_sb_info { | 112 | struct hfsplus_sb_info { |
110 | struct buffer_head *s_vhbh; | ||
111 | struct hfsplus_vh *s_vhdr; | 113 | struct hfsplus_vh *s_vhdr; |
114 | struct hfsplus_vh *s_backup_vhdr; | ||
112 | struct hfs_btree *ext_tree; | 115 | struct hfs_btree *ext_tree; |
113 | struct hfs_btree *cat_tree; | 116 | struct hfs_btree *cat_tree; |
114 | struct hfs_btree *attr_tree; | 117 | struct hfs_btree *attr_tree; |
@@ -118,7 +121,8 @@ struct hfsplus_sb_info { | |||
118 | 121 | ||
119 | /* Runtime variables */ | 122 | /* Runtime variables */ |
120 | u32 blockoffset; | 123 | u32 blockoffset; |
121 | u32 sect_count; | 124 | sector_t part_start; |
125 | sector_t sect_count; | ||
122 | int fs_shift; | 126 | int fs_shift; |
123 | 127 | ||
124 | /* immutable data from the volume header */ | 128 | /* immutable data from the volume header */ |
@@ -155,6 +159,12 @@ struct hfsplus_sb_info { | |||
155 | #define HFSPLUS_SB_FORCE 2 | 159 | #define HFSPLUS_SB_FORCE 2 |
156 | #define HFSPLUS_SB_HFSX 3 | 160 | #define HFSPLUS_SB_HFSX 3 |
157 | #define HFSPLUS_SB_CASEFOLD 4 | 161 | #define HFSPLUS_SB_CASEFOLD 4 |
162 | #define HFSPLUS_SB_NOBARRIER 5 | ||
163 | |||
164 | static inline struct hfsplus_sb_info *HFSPLUS_SB(struct super_block *sb) | ||
165 | { | ||
166 | return sb->s_fs_info; | ||
167 | } | ||
158 | 168 | ||
159 | 169 | ||
160 | struct hfsplus_inode_info { | 170 | struct hfsplus_inode_info { |
@@ -170,7 +180,7 @@ struct hfsplus_inode_info { | |||
170 | u32 cached_blocks; | 180 | u32 cached_blocks; |
171 | hfsplus_extent_rec first_extents; | 181 | hfsplus_extent_rec first_extents; |
172 | hfsplus_extent_rec cached_extents; | 182 | hfsplus_extent_rec cached_extents; |
173 | unsigned long flags; | 183 | unsigned int extent_state; |
174 | struct mutex extents_lock; | 184 | struct mutex extents_lock; |
175 | 185 | ||
176 | /* | 186 | /* |
@@ -185,6 +195,11 @@ struct hfsplus_inode_info { | |||
185 | u32 linkid; | 195 | u32 linkid; |
186 | 196 | ||
187 | /* | 197 | /* |
198 | * Accessed using atomic bitops. | ||
199 | */ | ||
200 | unsigned long flags; | ||
201 | |||
202 | /* | ||
188 | * Protected by i_mutex. | 203 | * Protected by i_mutex. |
189 | */ | 204 | */ |
190 | sector_t fs_blocks; | 205 | sector_t fs_blocks; |
@@ -195,12 +210,34 @@ struct hfsplus_inode_info { | |||
195 | struct inode vfs_inode; | 210 | struct inode vfs_inode; |
196 | }; | 211 | }; |
197 | 212 | ||
198 | #define HFSPLUS_FLG_RSRC 0x0001 | 213 | #define HFSPLUS_EXT_DIRTY 0x0001 |
199 | #define HFSPLUS_FLG_EXT_DIRTY 0x0002 | 214 | #define HFSPLUS_EXT_NEW 0x0002 |
200 | #define HFSPLUS_FLG_EXT_NEW 0x0004 | 215 | |
216 | #define HFSPLUS_I_RSRC 0 /* represents a resource fork */ | ||
217 | #define HFSPLUS_I_CAT_DIRTY 1 /* has changes in the catalog tree */ | ||
218 | #define HFSPLUS_I_EXT_DIRTY 2 /* has changes in the extent tree */ | ||
219 | #define HFSPLUS_I_ALLOC_DIRTY 3 /* has changes in the allocation file */ | ||
220 | |||
221 | #define HFSPLUS_IS_RSRC(inode) \ | ||
222 | test_bit(HFSPLUS_I_RSRC, &HFSPLUS_I(inode)->flags) | ||
223 | |||
224 | static inline struct hfsplus_inode_info *HFSPLUS_I(struct inode *inode) | ||
225 | { | ||
226 | return list_entry(inode, struct hfsplus_inode_info, vfs_inode); | ||
227 | } | ||
201 | 228 | ||
202 | #define HFSPLUS_IS_DATA(inode) (!(HFSPLUS_I(inode)->flags & HFSPLUS_FLG_RSRC)) | 229 | /* |
203 | #define HFSPLUS_IS_RSRC(inode) (HFSPLUS_I(inode)->flags & HFSPLUS_FLG_RSRC) | 230 | * Mark an inode dirty, and also mark the btree in which the |
231 | * specific type of metadata is stored. | ||
232 | * For data or metadata that gets written back by into the catalog btree | ||
233 | * by hfsplus_write_inode a plain mark_inode_dirty call is enough. | ||
234 | */ | ||
235 | static inline void hfsplus_mark_inode_dirty(struct inode *inode, | ||
236 | unsigned int flag) | ||
237 | { | ||
238 | set_bit(flag, &HFSPLUS_I(inode)->flags); | ||
239 | mark_inode_dirty(inode); | ||
240 | } | ||
204 | 241 | ||
205 | struct hfs_find_data { | 242 | struct hfs_find_data { |
206 | /* filled by caller */ | 243 | /* filled by caller */ |
@@ -318,9 +355,12 @@ int hfs_brec_read(struct hfs_find_data *, void *, int); | |||
318 | int hfs_brec_goto(struct hfs_find_data *, int); | 355 | int hfs_brec_goto(struct hfs_find_data *, int); |
319 | 356 | ||
320 | /* catalog.c */ | 357 | /* catalog.c */ |
321 | int hfsplus_cat_case_cmp_key(const hfsplus_btree_key *, const hfsplus_btree_key *); | 358 | int hfsplus_cat_case_cmp_key(const hfsplus_btree_key *, |
322 | int hfsplus_cat_bin_cmp_key(const hfsplus_btree_key *, const hfsplus_btree_key *); | 359 | const hfsplus_btree_key *); |
323 | void hfsplus_cat_build_key(struct super_block *sb, hfsplus_btree_key *, u32, struct qstr *); | 360 | int hfsplus_cat_bin_cmp_key(const hfsplus_btree_key *, |
361 | const hfsplus_btree_key *); | ||
362 | void hfsplus_cat_build_key(struct super_block *sb, | ||
363 | hfsplus_btree_key *, u32, struct qstr *); | ||
324 | int hfsplus_find_cat(struct super_block *, u32, struct hfs_find_data *); | 364 | int hfsplus_find_cat(struct super_block *, u32, struct hfs_find_data *); |
325 | int hfsplus_create_cat(u32, struct inode *, struct qstr *, struct inode *); | 365 | int hfsplus_create_cat(u32, struct inode *, struct qstr *, struct inode *); |
326 | int hfsplus_delete_cat(u32, struct inode *, struct qstr *); | 366 | int hfsplus_delete_cat(u32, struct inode *, struct qstr *); |
@@ -336,7 +376,8 @@ extern const struct file_operations hfsplus_dir_operations; | |||
336 | int hfsplus_ext_cmp_key(const hfsplus_btree_key *, const hfsplus_btree_key *); | 376 | int hfsplus_ext_cmp_key(const hfsplus_btree_key *, const hfsplus_btree_key *); |
337 | void hfsplus_ext_write_extent(struct inode *); | 377 | void hfsplus_ext_write_extent(struct inode *); |
338 | int hfsplus_get_block(struct inode *, sector_t, struct buffer_head *, int); | 378 | int hfsplus_get_block(struct inode *, sector_t, struct buffer_head *, int); |
339 | int hfsplus_free_fork(struct super_block *, u32, struct hfsplus_fork_raw *, int); | 379 | int hfsplus_free_fork(struct super_block *, u32, |
380 | struct hfsplus_fork_raw *, int); | ||
340 | int hfsplus_file_extend(struct inode *); | 381 | int hfsplus_file_extend(struct inode *); |
341 | void hfsplus_file_truncate(struct inode *); | 382 | void hfsplus_file_truncate(struct inode *); |
342 | 383 | ||
@@ -351,6 +392,7 @@ int hfsplus_cat_read_inode(struct inode *, struct hfs_find_data *); | |||
351 | int hfsplus_cat_write_inode(struct inode *); | 392 | int hfsplus_cat_write_inode(struct inode *); |
352 | struct inode *hfsplus_new_inode(struct super_block *, int); | 393 | struct inode *hfsplus_new_inode(struct super_block *, int); |
353 | void hfsplus_delete_inode(struct inode *); | 394 | void hfsplus_delete_inode(struct inode *); |
395 | int hfsplus_file_fsync(struct file *file, int datasync); | ||
354 | 396 | ||
355 | /* ioctl.c */ | 397 | /* ioctl.c */ |
356 | long hfsplus_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); | 398 | long hfsplus_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); |
@@ -362,6 +404,7 @@ ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size); | |||
362 | 404 | ||
363 | /* options.c */ | 405 | /* options.c */ |
364 | int hfsplus_parse_options(char *, struct hfsplus_sb_info *); | 406 | int hfsplus_parse_options(char *, struct hfsplus_sb_info *); |
407 | int hfsplus_parse_options_remount(char *input, int *force); | ||
365 | void hfsplus_fill_defaults(struct hfsplus_sb_info *); | 408 | void hfsplus_fill_defaults(struct hfsplus_sb_info *); |
366 | int hfsplus_show_options(struct seq_file *, struct vfsmount *); | 409 | int hfsplus_show_options(struct seq_file *, struct vfsmount *); |
367 | 410 | ||
@@ -375,12 +418,16 @@ extern u16 hfsplus_decompose_table[]; | |||
375 | extern u16 hfsplus_compose_table[]; | 418 | extern u16 hfsplus_compose_table[]; |
376 | 419 | ||
377 | /* unicode.c */ | 420 | /* unicode.c */ |
378 | int hfsplus_strcasecmp(const struct hfsplus_unistr *, const struct hfsplus_unistr *); | 421 | int hfsplus_strcasecmp(const struct hfsplus_unistr *, |
379 | int hfsplus_strcmp(const struct hfsplus_unistr *, const struct hfsplus_unistr *); | 422 | const struct hfsplus_unistr *); |
380 | int hfsplus_uni2asc(struct super_block *, const struct hfsplus_unistr *, char *, int *); | 423 | int hfsplus_strcmp(const struct hfsplus_unistr *, |
381 | int hfsplus_asc2uni(struct super_block *, struct hfsplus_unistr *, const char *, int); | 424 | const struct hfsplus_unistr *); |
382 | int hfsplus_hash_dentry(const struct dentry *dentry, const struct inode *inode, | 425 | int hfsplus_uni2asc(struct super_block *, |
383 | struct qstr *str); | 426 | const struct hfsplus_unistr *, char *, int *); |
427 | int hfsplus_asc2uni(struct super_block *, | ||
428 | struct hfsplus_unistr *, const char *, int); | ||
429 | int hfsplus_hash_dentry(const struct dentry *dentry, | ||
430 | const struct inode *inode, struct qstr *str); | ||
384 | int hfsplus_compare_dentry(const struct dentry *parent, | 431 | int hfsplus_compare_dentry(const struct dentry *parent, |
385 | const struct inode *pinode, | 432 | const struct inode *pinode, |
386 | const struct dentry *dentry, const struct inode *inode, | 433 | const struct dentry *dentry, const struct inode *inode, |
@@ -388,36 +435,9 @@ int hfsplus_compare_dentry(const struct dentry *parent, | |||
388 | 435 | ||
389 | /* wrapper.c */ | 436 | /* wrapper.c */ |
390 | int hfsplus_read_wrapper(struct super_block *); | 437 | int hfsplus_read_wrapper(struct super_block *); |
391 | |||
392 | int hfs_part_find(struct super_block *, sector_t *, sector_t *); | 438 | int hfs_part_find(struct super_block *, sector_t *, sector_t *); |
393 | 439 | int hfsplus_submit_bio(struct block_device *bdev, sector_t sector, | |
394 | /* access macros */ | 440 | void *data, int rw); |
395 | static inline struct hfsplus_sb_info *HFSPLUS_SB(struct super_block *sb) | ||
396 | { | ||
397 | return sb->s_fs_info; | ||
398 | } | ||
399 | |||
400 | static inline struct hfsplus_inode_info *HFSPLUS_I(struct inode *inode) | ||
401 | { | ||
402 | return list_entry(inode, struct hfsplus_inode_info, vfs_inode); | ||
403 | } | ||
404 | |||
405 | #define sb_bread512(sb, sec, data) ({ \ | ||
406 | struct buffer_head *__bh; \ | ||
407 | sector_t __block; \ | ||
408 | loff_t __start; \ | ||
409 | int __offset; \ | ||
410 | \ | ||
411 | __start = (loff_t)(sec) << HFSPLUS_SECTOR_SHIFT;\ | ||
412 | __block = __start >> (sb)->s_blocksize_bits; \ | ||
413 | __offset = __start & ((sb)->s_blocksize - 1); \ | ||
414 | __bh = sb_bread((sb), __block); \ | ||
415 | if (likely(__bh != NULL)) \ | ||
416 | data = (void *)(__bh->b_data + __offset);\ | ||
417 | else \ | ||
418 | data = NULL; \ | ||
419 | __bh; \ | ||
420 | }) | ||
421 | 441 | ||
422 | /* time macros */ | 442 | /* time macros */ |
423 | #define __hfsp_mt2ut(t) (be32_to_cpu(t) - 2082844800U) | 443 | #define __hfsp_mt2ut(t) (be32_to_cpu(t) - 2082844800U) |