diff options
Diffstat (limited to 'include/linux/ext3_fs.h')
| -rw-r--r-- | include/linux/ext3_fs.h | 50 |
1 files changed, 33 insertions, 17 deletions
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h index 757d54d8f1a5..cc08f56750da 100644 --- a/include/linux/ext3_fs.h +++ b/include/linux/ext3_fs.h | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #define _LINUX_EXT3_FS_H | 17 | #define _LINUX_EXT3_FS_H |
| 18 | 18 | ||
| 19 | #include <linux/types.h> | 19 | #include <linux/types.h> |
| 20 | #include <linux/magic.h> | ||
| 20 | 21 | ||
| 21 | /* | 22 | /* |
| 22 | * The second extended filesystem constants/structures | 23 | * The second extended filesystem constants/structures |
| @@ -67,11 +68,6 @@ | |||
| 67 | #define EXT3_GOOD_OLD_FIRST_INO 11 | 68 | #define EXT3_GOOD_OLD_FIRST_INO 11 |
| 68 | 69 | ||
| 69 | /* | 70 | /* |
| 70 | * The second extended file system magic number | ||
| 71 | */ | ||
| 72 | #define EXT3_SUPER_MAGIC 0xEF53 | ||
| 73 | |||
| 74 | /* | ||
| 75 | * Maximal count of links to a file | 71 | * Maximal count of links to a file |
| 76 | */ | 72 | */ |
| 77 | #define EXT3_LINK_MAX 32000 | 73 | #define EXT3_LINK_MAX 32000 |
| @@ -464,7 +460,7 @@ struct ext3_super_block { | |||
| 464 | */ | 460 | */ |
| 465 | __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/ | 461 | __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/ |
| 466 | __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */ | 462 | __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */ |
| 467 | __u16 s_reserved_gdt_blocks; /* Per group desc for online growth */ | 463 | __le16 s_reserved_gdt_blocks; /* Per group desc for online growth */ |
| 468 | /* | 464 | /* |
| 469 | * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set. | 465 | * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set. |
| 470 | */ | 466 | */ |
| @@ -477,7 +473,7 @@ struct ext3_super_block { | |||
| 477 | __u8 s_reserved_char_pad; | 473 | __u8 s_reserved_char_pad; |
| 478 | __u16 s_reserved_word_pad; | 474 | __u16 s_reserved_word_pad; |
| 479 | __le32 s_default_mount_opts; | 475 | __le32 s_default_mount_opts; |
| 480 | __le32 s_first_meta_bg; /* First metablock block group */ | 476 | __le32 s_first_meta_bg; /* First metablock block group */ |
| 481 | __u32 s_reserved[190]; /* Padding to the end of the block */ | 477 | __u32 s_reserved[190]; /* Padding to the end of the block */ |
| 482 | }; | 478 | }; |
| 483 | 479 | ||
| @@ -492,6 +488,15 @@ static inline struct ext3_inode_info *EXT3_I(struct inode *inode) | |||
| 492 | { | 488 | { |
| 493 | return container_of(inode, struct ext3_inode_info, vfs_inode); | 489 | return container_of(inode, struct ext3_inode_info, vfs_inode); |
| 494 | } | 490 | } |
| 491 | |||
| 492 | static inline int ext3_valid_inum(struct super_block *sb, unsigned long ino) | ||
| 493 | { | ||
| 494 | return ino == EXT3_ROOT_INO || | ||
| 495 | ino == EXT3_JOURNAL_INO || | ||
| 496 | ino == EXT3_RESIZE_INO || | ||
| 497 | (ino >= EXT3_FIRST_INO(sb) && | ||
| 498 | ino <= le32_to_cpu(EXT3_SB(sb)->s_es->s_inodes_count)); | ||
| 499 | } | ||
| 495 | #else | 500 | #else |
| 496 | /* Assume that user mode programs are passing in an ext3fs superblock, not | 501 | /* Assume that user mode programs are passing in an ext3fs superblock, not |
| 497 | * a kernel struct super_block. This will allow us to call the feature-test | 502 | * a kernel struct super_block. This will allow us to call the feature-test |
| @@ -710,6 +715,14 @@ struct dir_private_info { | |||
| 710 | __u32 next_hash; | 715 | __u32 next_hash; |
| 711 | }; | 716 | }; |
| 712 | 717 | ||
| 718 | /* calculate the first block number of the group */ | ||
| 719 | static inline ext3_fsblk_t | ||
| 720 | ext3_group_first_block_no(struct super_block *sb, unsigned long group_no) | ||
| 721 | { | ||
| 722 | return group_no * (ext3_fsblk_t)EXT3_BLOCKS_PER_GROUP(sb) + | ||
| 723 | le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block); | ||
| 724 | } | ||
| 725 | |||
| 713 | /* | 726 | /* |
| 714 | * Special error return code only used by dx_probe() and its callers. | 727 | * Special error return code only used by dx_probe() and its callers. |
| 715 | */ | 728 | */ |
| @@ -730,14 +743,16 @@ struct dir_private_info { | |||
| 730 | /* balloc.c */ | 743 | /* balloc.c */ |
| 731 | extern int ext3_bg_has_super(struct super_block *sb, int group); | 744 | extern int ext3_bg_has_super(struct super_block *sb, int group); |
| 732 | extern unsigned long ext3_bg_num_gdb(struct super_block *sb, int group); | 745 | extern unsigned long ext3_bg_num_gdb(struct super_block *sb, int group); |
| 733 | extern int ext3_new_block (handle_t *, struct inode *, unsigned long, int *); | 746 | extern ext3_fsblk_t ext3_new_block (handle_t *handle, struct inode *inode, |
| 734 | extern int ext3_new_blocks (handle_t *, struct inode *, unsigned long, | 747 | ext3_fsblk_t goal, int *errp); |
| 735 | unsigned long *, int *); | 748 | extern ext3_fsblk_t ext3_new_blocks (handle_t *handle, struct inode *inode, |
| 736 | extern void ext3_free_blocks (handle_t *, struct inode *, unsigned long, | 749 | ext3_fsblk_t goal, unsigned long *count, int *errp); |
| 737 | unsigned long); | 750 | extern void ext3_free_blocks (handle_t *handle, struct inode *inode, |
| 738 | extern void ext3_free_blocks_sb (handle_t *, struct super_block *, | 751 | ext3_fsblk_t block, unsigned long count); |
| 739 | unsigned long, unsigned long, int *); | 752 | extern void ext3_free_blocks_sb (handle_t *handle, struct super_block *sb, |
| 740 | extern unsigned long ext3_count_free_blocks (struct super_block *); | 753 | ext3_fsblk_t block, unsigned long count, |
| 754 | unsigned long *pdquot_freed_blocks); | ||
| 755 | extern ext3_fsblk_t ext3_count_free_blocks (struct super_block *); | ||
| 741 | extern void ext3_check_blocks_bitmap (struct super_block *); | 756 | extern void ext3_check_blocks_bitmap (struct super_block *); |
| 742 | extern struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb, | 757 | extern struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb, |
| 743 | unsigned int block_group, | 758 | unsigned int block_group, |
| @@ -773,7 +788,8 @@ extern unsigned long ext3_count_free (struct buffer_head *, unsigned); | |||
| 773 | 788 | ||
| 774 | 789 | ||
| 775 | /* inode.c */ | 790 | /* inode.c */ |
| 776 | int ext3_forget(handle_t *, int, struct inode *, struct buffer_head *, int); | 791 | int ext3_forget(handle_t *handle, int is_metadata, struct inode *inode, |
| 792 | struct buffer_head *bh, ext3_fsblk_t blocknr); | ||
| 777 | struct buffer_head * ext3_getblk (handle_t *, struct inode *, long, int, int *); | 793 | struct buffer_head * ext3_getblk (handle_t *, struct inode *, long, int, int *); |
| 778 | struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *); | 794 | struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *); |
| 779 | int ext3_get_blocks_handle(handle_t *handle, struct inode *inode, | 795 | int ext3_get_blocks_handle(handle_t *handle, struct inode *inode, |
| @@ -808,7 +824,7 @@ extern int ext3_group_add(struct super_block *sb, | |||
| 808 | struct ext3_new_group_data *input); | 824 | struct ext3_new_group_data *input); |
| 809 | extern int ext3_group_extend(struct super_block *sb, | 825 | extern int ext3_group_extend(struct super_block *sb, |
| 810 | struct ext3_super_block *es, | 826 | struct ext3_super_block *es, |
| 811 | unsigned long n_blocks_count); | 827 | ext3_fsblk_t n_blocks_count); |
| 812 | 828 | ||
| 813 | /* super.c */ | 829 | /* super.c */ |
| 814 | extern void ext3_error (struct super_block *, const char *, const char *, ...) | 830 | extern void ext3_error (struct super_block *, const char *, const char *, ...) |
