diff options
-rw-r--r-- | fs/ext4/balloc.c | 69 | ||||
-rw-r--r-- | fs/ext4/group.h | 8 | ||||
-rw-r--r-- | fs/ext4/ialloc.c | 46 | ||||
-rw-r--r-- | fs/ext4/inode.c | 5 | ||||
-rw-r--r-- | fs/ext4/resize.c | 12 | ||||
-rw-r--r-- | fs/ext4/super.c | 20 | ||||
-rw-r--r-- | include/linux/ext4_fs.h | 11 | ||||
-rw-r--r-- | include/linux/ext4_fs_i.h | 5 | ||||
-rw-r--r-- | include/linux/ext4_fs_sb.h | 2 |
9 files changed, 91 insertions, 87 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index 71ee95e534fd..9568a57c607c 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c | |||
@@ -29,7 +29,7 @@ | |||
29 | * Calculate the block group number and offset, given a block number | 29 | * Calculate the block group number and offset, given a block number |
30 | */ | 30 | */ |
31 | void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr, | 31 | void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr, |
32 | unsigned long *blockgrpp, ext4_grpblk_t *offsetp) | 32 | ext4_group_t *blockgrpp, ext4_grpblk_t *offsetp) |
33 | { | 33 | { |
34 | struct ext4_super_block *es = EXT4_SB(sb)->s_es; | 34 | struct ext4_super_block *es = EXT4_SB(sb)->s_es; |
35 | ext4_grpblk_t offset; | 35 | ext4_grpblk_t offset; |
@@ -46,7 +46,7 @@ void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr, | |||
46 | /* Initializes an uninitialized block bitmap if given, and returns the | 46 | /* Initializes an uninitialized block bitmap if given, and returns the |
47 | * number of blocks free in the group. */ | 47 | * number of blocks free in the group. */ |
48 | unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh, | 48 | unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh, |
49 | int block_group, struct ext4_group_desc *gdp) | 49 | ext4_group_t block_group, struct ext4_group_desc *gdp) |
50 | { | 50 | { |
51 | unsigned long start; | 51 | unsigned long start; |
52 | int bit, bit_max; | 52 | int bit, bit_max; |
@@ -60,7 +60,7 @@ unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh, | |||
60 | * essentially implementing a per-group read-only flag. */ | 60 | * essentially implementing a per-group read-only flag. */ |
61 | if (!ext4_group_desc_csum_verify(sbi, block_group, gdp)) { | 61 | if (!ext4_group_desc_csum_verify(sbi, block_group, gdp)) { |
62 | ext4_error(sb, __FUNCTION__, | 62 | ext4_error(sb, __FUNCTION__, |
63 | "Checksum bad for group %u\n", block_group); | 63 | "Checksum bad for group %lu\n", block_group); |
64 | gdp->bg_free_blocks_count = 0; | 64 | gdp->bg_free_blocks_count = 0; |
65 | gdp->bg_free_inodes_count = 0; | 65 | gdp->bg_free_inodes_count = 0; |
66 | gdp->bg_itable_unused = 0; | 66 | gdp->bg_itable_unused = 0; |
@@ -153,7 +153,7 @@ unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh, | |||
153 | * group descriptor | 153 | * group descriptor |
154 | */ | 154 | */ |
155 | struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb, | 155 | struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb, |
156 | unsigned int block_group, | 156 | ext4_group_t block_group, |
157 | struct buffer_head ** bh) | 157 | struct buffer_head ** bh) |
158 | { | 158 | { |
159 | unsigned long group_desc; | 159 | unsigned long group_desc; |
@@ -164,7 +164,7 @@ struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb, | |||
164 | if (block_group >= sbi->s_groups_count) { | 164 | if (block_group >= sbi->s_groups_count) { |
165 | ext4_error (sb, "ext4_get_group_desc", | 165 | ext4_error (sb, "ext4_get_group_desc", |
166 | "block_group >= groups_count - " | 166 | "block_group >= groups_count - " |
167 | "block_group = %d, groups_count = %lu", | 167 | "block_group = %lu, groups_count = %lu", |
168 | block_group, sbi->s_groups_count); | 168 | block_group, sbi->s_groups_count); |
169 | 169 | ||
170 | return NULL; | 170 | return NULL; |
@@ -176,7 +176,7 @@ struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb, | |||
176 | if (!sbi->s_group_desc[group_desc]) { | 176 | if (!sbi->s_group_desc[group_desc]) { |
177 | ext4_error (sb, "ext4_get_group_desc", | 177 | ext4_error (sb, "ext4_get_group_desc", |
178 | "Group descriptor not loaded - " | 178 | "Group descriptor not loaded - " |
179 | "block_group = %d, group_desc = %lu, desc = %lu", | 179 | "block_group = %lu, group_desc = %lu, desc = %lu", |
180 | block_group, group_desc, offset); | 180 | block_group, group_desc, offset); |
181 | return NULL; | 181 | return NULL; |
182 | } | 182 | } |
@@ -200,7 +200,7 @@ struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb, | |||
200 | * Return buffer_head on success or NULL in case of failure. | 200 | * Return buffer_head on success or NULL in case of failure. |
201 | */ | 201 | */ |
202 | struct buffer_head * | 202 | struct buffer_head * |
203 | read_block_bitmap(struct super_block *sb, unsigned int block_group) | 203 | read_block_bitmap(struct super_block *sb, ext4_group_t block_group) |
204 | { | 204 | { |
205 | struct ext4_group_desc * desc; | 205 | struct ext4_group_desc * desc; |
206 | struct buffer_head * bh = NULL; | 206 | struct buffer_head * bh = NULL; |
@@ -227,7 +227,7 @@ read_block_bitmap(struct super_block *sb, unsigned int block_group) | |||
227 | if (!bh) | 227 | if (!bh) |
228 | ext4_error (sb, __FUNCTION__, | 228 | ext4_error (sb, __FUNCTION__, |
229 | "Cannot read block bitmap - " | 229 | "Cannot read block bitmap - " |
230 | "block_group = %d, block_bitmap = %llu", | 230 | "block_group = %lu, block_bitmap = %llu", |
231 | block_group, bitmap_blk); | 231 | block_group, bitmap_blk); |
232 | return bh; | 232 | return bh; |
233 | } | 233 | } |
@@ -320,7 +320,7 @@ restart: | |||
320 | */ | 320 | */ |
321 | static int | 321 | static int |
322 | goal_in_my_reservation(struct ext4_reserve_window *rsv, ext4_grpblk_t grp_goal, | 322 | goal_in_my_reservation(struct ext4_reserve_window *rsv, ext4_grpblk_t grp_goal, |
323 | unsigned int group, struct super_block * sb) | 323 | ext4_group_t group, struct super_block *sb) |
324 | { | 324 | { |
325 | ext4_fsblk_t group_first_block, group_last_block; | 325 | ext4_fsblk_t group_first_block, group_last_block; |
326 | 326 | ||
@@ -540,7 +540,7 @@ void ext4_free_blocks_sb(handle_t *handle, struct super_block *sb, | |||
540 | { | 540 | { |
541 | struct buffer_head *bitmap_bh = NULL; | 541 | struct buffer_head *bitmap_bh = NULL; |
542 | struct buffer_head *gd_bh; | 542 | struct buffer_head *gd_bh; |
543 | unsigned long block_group; | 543 | ext4_group_t block_group; |
544 | ext4_grpblk_t bit; | 544 | ext4_grpblk_t bit; |
545 | unsigned long i; | 545 | unsigned long i; |
546 | unsigned long overflow; | 546 | unsigned long overflow; |
@@ -920,9 +920,10 @@ claim_block(spinlock_t *lock, ext4_grpblk_t block, struct buffer_head *bh) | |||
920 | * ext4_journal_release_buffer(), else we'll run out of credits. | 920 | * ext4_journal_release_buffer(), else we'll run out of credits. |
921 | */ | 921 | */ |
922 | static ext4_grpblk_t | 922 | static ext4_grpblk_t |
923 | ext4_try_to_allocate(struct super_block *sb, handle_t *handle, int group, | 923 | ext4_try_to_allocate(struct super_block *sb, handle_t *handle, |
924 | struct buffer_head *bitmap_bh, ext4_grpblk_t grp_goal, | 924 | ext4_group_t group, struct buffer_head *bitmap_bh, |
925 | unsigned long *count, struct ext4_reserve_window *my_rsv) | 925 | ext4_grpblk_t grp_goal, unsigned long *count, |
926 | struct ext4_reserve_window *my_rsv) | ||
926 | { | 927 | { |
927 | ext4_fsblk_t group_first_block; | 928 | ext4_fsblk_t group_first_block; |
928 | ext4_grpblk_t start, end; | 929 | ext4_grpblk_t start, end; |
@@ -1156,7 +1157,7 @@ static int find_next_reservable_window( | |||
1156 | */ | 1157 | */ |
1157 | static int alloc_new_reservation(struct ext4_reserve_window_node *my_rsv, | 1158 | static int alloc_new_reservation(struct ext4_reserve_window_node *my_rsv, |
1158 | ext4_grpblk_t grp_goal, struct super_block *sb, | 1159 | ext4_grpblk_t grp_goal, struct super_block *sb, |
1159 | unsigned int group, struct buffer_head *bitmap_bh) | 1160 | ext4_group_t group, struct buffer_head *bitmap_bh) |
1160 | { | 1161 | { |
1161 | struct ext4_reserve_window_node *search_head; | 1162 | struct ext4_reserve_window_node *search_head; |
1162 | ext4_fsblk_t group_first_block, group_end_block, start_block; | 1163 | ext4_fsblk_t group_first_block, group_end_block, start_block; |
@@ -1354,7 +1355,7 @@ static void try_to_extend_reservation(struct ext4_reserve_window_node *my_rsv, | |||
1354 | */ | 1355 | */ |
1355 | static ext4_grpblk_t | 1356 | static ext4_grpblk_t |
1356 | ext4_try_to_allocate_with_rsv(struct super_block *sb, handle_t *handle, | 1357 | ext4_try_to_allocate_with_rsv(struct super_block *sb, handle_t *handle, |
1357 | unsigned int group, struct buffer_head *bitmap_bh, | 1358 | ext4_group_t group, struct buffer_head *bitmap_bh, |
1358 | ext4_grpblk_t grp_goal, | 1359 | ext4_grpblk_t grp_goal, |
1359 | struct ext4_reserve_window_node * my_rsv, | 1360 | struct ext4_reserve_window_node * my_rsv, |
1360 | unsigned long *count, int *errp) | 1361 | unsigned long *count, int *errp) |
@@ -1528,12 +1529,12 @@ ext4_fsblk_t ext4_new_blocks(handle_t *handle, struct inode *inode, | |||
1528 | { | 1529 | { |
1529 | struct buffer_head *bitmap_bh = NULL; | 1530 | struct buffer_head *bitmap_bh = NULL; |
1530 | struct buffer_head *gdp_bh; | 1531 | struct buffer_head *gdp_bh; |
1531 | unsigned long group_no; | 1532 | ext4_group_t group_no; |
1532 | int goal_group; | 1533 | ext4_group_t goal_group; |
1533 | ext4_grpblk_t grp_target_blk; /* blockgroup relative goal block */ | 1534 | ext4_grpblk_t grp_target_blk; /* blockgroup relative goal block */ |
1534 | ext4_grpblk_t grp_alloc_blk; /* blockgroup-relative allocated block*/ | 1535 | ext4_grpblk_t grp_alloc_blk; /* blockgroup-relative allocated block*/ |
1535 | ext4_fsblk_t ret_block; /* filesyetem-wide allocated block */ | 1536 | ext4_fsblk_t ret_block; /* filesyetem-wide allocated block */ |
1536 | int bgi; /* blockgroup iteration index */ | 1537 | ext4_group_t bgi; /* blockgroup iteration index */ |
1537 | int fatal = 0, err; | 1538 | int fatal = 0, err; |
1538 | int performed_allocation = 0; | 1539 | int performed_allocation = 0; |
1539 | ext4_grpblk_t free_blocks; /* number of free blocks in a group */ | 1540 | ext4_grpblk_t free_blocks; /* number of free blocks in a group */ |
@@ -1544,10 +1545,7 @@ ext4_fsblk_t ext4_new_blocks(handle_t *handle, struct inode *inode, | |||
1544 | struct ext4_reserve_window_node *my_rsv = NULL; | 1545 | struct ext4_reserve_window_node *my_rsv = NULL; |
1545 | struct ext4_block_alloc_info *block_i; | 1546 | struct ext4_block_alloc_info *block_i; |
1546 | unsigned short windowsz = 0; | 1547 | unsigned short windowsz = 0; |
1547 | #ifdef EXT4FS_DEBUG | 1548 | ext4_group_t ngroups; |
1548 | static int goal_hits, goal_attempts; | ||
1549 | #endif | ||
1550 | unsigned long ngroups; | ||
1551 | unsigned long num = *count; | 1549 | unsigned long num = *count; |
1552 | 1550 | ||
1553 | *errp = -ENOSPC; | 1551 | *errp = -ENOSPC; |
@@ -1743,9 +1741,6 @@ allocated: | |||
1743 | * list of some description. We don't know in advance whether | 1741 | * list of some description. We don't know in advance whether |
1744 | * the caller wants to use it as metadata or data. | 1742 | * the caller wants to use it as metadata or data. |
1745 | */ | 1743 | */ |
1746 | ext4_debug("allocating block %lu. Goal hits %d of %d.\n", | ||
1747 | ret_block, goal_hits, goal_attempts); | ||
1748 | |||
1749 | spin_lock(sb_bgl_lock(sbi, group_no)); | 1744 | spin_lock(sb_bgl_lock(sbi, group_no)); |
1750 | if (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) | 1745 | if (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) |
1751 | gdp->bg_flags &= cpu_to_le16(~EXT4_BG_BLOCK_UNINIT); | 1746 | gdp->bg_flags &= cpu_to_le16(~EXT4_BG_BLOCK_UNINIT); |
@@ -1804,8 +1799,8 @@ ext4_fsblk_t ext4_count_free_blocks(struct super_block *sb) | |||
1804 | { | 1799 | { |
1805 | ext4_fsblk_t desc_count; | 1800 | ext4_fsblk_t desc_count; |
1806 | struct ext4_group_desc *gdp; | 1801 | struct ext4_group_desc *gdp; |
1807 | int i; | 1802 | ext4_group_t i; |
1808 | unsigned long ngroups = EXT4_SB(sb)->s_groups_count; | 1803 | ext4_group_t ngroups = EXT4_SB(sb)->s_groups_count; |
1809 | #ifdef EXT4FS_DEBUG | 1804 | #ifdef EXT4FS_DEBUG |
1810 | struct ext4_super_block *es; | 1805 | struct ext4_super_block *es; |
1811 | ext4_fsblk_t bitmap_count; | 1806 | ext4_fsblk_t bitmap_count; |
@@ -1829,7 +1824,7 @@ ext4_fsblk_t ext4_count_free_blocks(struct super_block *sb) | |||
1829 | continue; | 1824 | continue; |
1830 | 1825 | ||
1831 | x = ext4_count_free(bitmap_bh, sb->s_blocksize); | 1826 | x = ext4_count_free(bitmap_bh, sb->s_blocksize); |
1832 | printk("group %d: stored = %d, counted = %lu\n", | 1827 | printk(KERN_DEBUG "group %lu: stored = %d, counted = %lu\n", |
1833 | i, le16_to_cpu(gdp->bg_free_blocks_count), x); | 1828 | i, le16_to_cpu(gdp->bg_free_blocks_count), x); |
1834 | bitmap_count += x; | 1829 | bitmap_count += x; |
1835 | } | 1830 | } |
@@ -1853,7 +1848,7 @@ ext4_fsblk_t ext4_count_free_blocks(struct super_block *sb) | |||
1853 | #endif | 1848 | #endif |
1854 | } | 1849 | } |
1855 | 1850 | ||
1856 | static inline int test_root(int a, int b) | 1851 | static inline int test_root(ext4_group_t a, int b) |
1857 | { | 1852 | { |
1858 | int num = b; | 1853 | int num = b; |
1859 | 1854 | ||
@@ -1862,7 +1857,7 @@ static inline int test_root(int a, int b) | |||
1862 | return num == a; | 1857 | return num == a; |
1863 | } | 1858 | } |
1864 | 1859 | ||
1865 | static int ext4_group_sparse(int group) | 1860 | static int ext4_group_sparse(ext4_group_t group) |
1866 | { | 1861 | { |
1867 | if (group <= 1) | 1862 | if (group <= 1) |
1868 | return 1; | 1863 | return 1; |
@@ -1880,7 +1875,7 @@ static int ext4_group_sparse(int group) | |||
1880 | * Return the number of blocks used by the superblock (primary or backup) | 1875 | * Return the number of blocks used by the superblock (primary or backup) |
1881 | * in this group. Currently this will be only 0 or 1. | 1876 | * in this group. Currently this will be only 0 or 1. |
1882 | */ | 1877 | */ |
1883 | int ext4_bg_has_super(struct super_block *sb, int group) | 1878 | int ext4_bg_has_super(struct super_block *sb, ext4_group_t group) |
1884 | { | 1879 | { |
1885 | if (EXT4_HAS_RO_COMPAT_FEATURE(sb, | 1880 | if (EXT4_HAS_RO_COMPAT_FEATURE(sb, |
1886 | EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER) && | 1881 | EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER) && |
@@ -1889,18 +1884,20 @@ int ext4_bg_has_super(struct super_block *sb, int group) | |||
1889 | return 1; | 1884 | return 1; |
1890 | } | 1885 | } |
1891 | 1886 | ||
1892 | static unsigned long ext4_bg_num_gdb_meta(struct super_block *sb, int group) | 1887 | static unsigned long ext4_bg_num_gdb_meta(struct super_block *sb, |
1888 | ext4_group_t group) | ||
1893 | { | 1889 | { |
1894 | unsigned long metagroup = group / EXT4_DESC_PER_BLOCK(sb); | 1890 | unsigned long metagroup = group / EXT4_DESC_PER_BLOCK(sb); |
1895 | unsigned long first = metagroup * EXT4_DESC_PER_BLOCK(sb); | 1891 | ext4_group_t first = metagroup * EXT4_DESC_PER_BLOCK(sb); |
1896 | unsigned long last = first + EXT4_DESC_PER_BLOCK(sb) - 1; | 1892 | ext4_group_t last = first + EXT4_DESC_PER_BLOCK(sb) - 1; |
1897 | 1893 | ||
1898 | if (group == first || group == first + 1 || group == last) | 1894 | if (group == first || group == first + 1 || group == last) |
1899 | return 1; | 1895 | return 1; |
1900 | return 0; | 1896 | return 0; |
1901 | } | 1897 | } |
1902 | 1898 | ||
1903 | static unsigned long ext4_bg_num_gdb_nometa(struct super_block *sb, int group) | 1899 | static unsigned long ext4_bg_num_gdb_nometa(struct super_block *sb, |
1900 | ext4_group_t group) | ||
1904 | { | 1901 | { |
1905 | if (EXT4_HAS_RO_COMPAT_FEATURE(sb, | 1902 | if (EXT4_HAS_RO_COMPAT_FEATURE(sb, |
1906 | EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER) && | 1903 | EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER) && |
@@ -1918,7 +1915,7 @@ static unsigned long ext4_bg_num_gdb_nometa(struct super_block *sb, int group) | |||
1918 | * (primary or backup) in this group. In the future there may be a | 1915 | * (primary or backup) in this group. In the future there may be a |
1919 | * different number of descriptor blocks in each group. | 1916 | * different number of descriptor blocks in each group. |
1920 | */ | 1917 | */ |
1921 | unsigned long ext4_bg_num_gdb(struct super_block *sb, int group) | 1918 | unsigned long ext4_bg_num_gdb(struct super_block *sb, ext4_group_t group) |
1922 | { | 1919 | { |
1923 | unsigned long first_meta_bg = | 1920 | unsigned long first_meta_bg = |
1924 | le32_to_cpu(EXT4_SB(sb)->s_es->s_first_meta_bg); | 1921 | le32_to_cpu(EXT4_SB(sb)->s_es->s_first_meta_bg); |
diff --git a/fs/ext4/group.h b/fs/ext4/group.h index 1577910bb58b..7eb0604e7eea 100644 --- a/fs/ext4/group.h +++ b/fs/ext4/group.h | |||
@@ -14,14 +14,16 @@ extern __le16 ext4_group_desc_csum(struct ext4_sb_info *sbi, __u32 group, | |||
14 | extern int ext4_group_desc_csum_verify(struct ext4_sb_info *sbi, __u32 group, | 14 | extern int ext4_group_desc_csum_verify(struct ext4_sb_info *sbi, __u32 group, |
15 | struct ext4_group_desc *gdp); | 15 | struct ext4_group_desc *gdp); |
16 | struct buffer_head *read_block_bitmap(struct super_block *sb, | 16 | struct buffer_head *read_block_bitmap(struct super_block *sb, |
17 | unsigned int block_group); | 17 | ext4_group_t block_group); |
18 | extern unsigned ext4_init_block_bitmap(struct super_block *sb, | 18 | extern unsigned ext4_init_block_bitmap(struct super_block *sb, |
19 | struct buffer_head *bh, int group, | 19 | struct buffer_head *bh, |
20 | ext4_group_t group, | ||
20 | struct ext4_group_desc *desc); | 21 | struct ext4_group_desc *desc); |
21 | #define ext4_free_blocks_after_init(sb, group, desc) \ | 22 | #define ext4_free_blocks_after_init(sb, group, desc) \ |
22 | ext4_init_block_bitmap(sb, NULL, group, desc) | 23 | ext4_init_block_bitmap(sb, NULL, group, desc) |
23 | extern unsigned ext4_init_inode_bitmap(struct super_block *sb, | 24 | extern unsigned ext4_init_inode_bitmap(struct super_block *sb, |
24 | struct buffer_head *bh, int group, | 25 | struct buffer_head *bh, |
26 | ext4_group_t group, | ||
25 | struct ext4_group_desc *desc); | 27 | struct ext4_group_desc *desc); |
26 | extern void mark_bitmap_end(int start_bit, int end_bit, char *bitmap); | 28 | extern void mark_bitmap_end(int start_bit, int end_bit, char *bitmap); |
27 | #endif /* _LINUX_EXT4_GROUP_H */ | 29 | #endif /* _LINUX_EXT4_GROUP_H */ |
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index c61f37fd3f05..64dea8689e1f 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -64,8 +64,8 @@ void mark_bitmap_end(int start_bit, int end_bit, char *bitmap) | |||
64 | } | 64 | } |
65 | 65 | ||
66 | /* Initializes an uninitialized inode bitmap */ | 66 | /* Initializes an uninitialized inode bitmap */ |
67 | unsigned ext4_init_inode_bitmap(struct super_block *sb, | 67 | unsigned ext4_init_inode_bitmap(struct super_block *sb, struct buffer_head *bh, |
68 | struct buffer_head *bh, int block_group, | 68 | ext4_group_t block_group, |
69 | struct ext4_group_desc *gdp) | 69 | struct ext4_group_desc *gdp) |
70 | { | 70 | { |
71 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 71 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
@@ -75,7 +75,7 @@ unsigned ext4_init_inode_bitmap(struct super_block *sb, | |||
75 | /* If checksum is bad mark all blocks and inodes use to prevent | 75 | /* If checksum is bad mark all blocks and inodes use to prevent |
76 | * allocation, essentially implementing a per-group read-only flag. */ | 76 | * allocation, essentially implementing a per-group read-only flag. */ |
77 | if (!ext4_group_desc_csum_verify(sbi, block_group, gdp)) { | 77 | if (!ext4_group_desc_csum_verify(sbi, block_group, gdp)) { |
78 | ext4_error(sb, __FUNCTION__, "Checksum bad for group %u\n", | 78 | ext4_error(sb, __FUNCTION__, "Checksum bad for group %lu\n", |
79 | block_group); | 79 | block_group); |
80 | gdp->bg_free_blocks_count = 0; | 80 | gdp->bg_free_blocks_count = 0; |
81 | gdp->bg_free_inodes_count = 0; | 81 | gdp->bg_free_inodes_count = 0; |
@@ -98,7 +98,7 @@ unsigned ext4_init_inode_bitmap(struct super_block *sb, | |||
98 | * Return buffer_head of bitmap on success or NULL. | 98 | * Return buffer_head of bitmap on success or NULL. |
99 | */ | 99 | */ |
100 | static struct buffer_head * | 100 | static struct buffer_head * |
101 | read_inode_bitmap(struct super_block * sb, unsigned long block_group) | 101 | read_inode_bitmap(struct super_block *sb, ext4_group_t block_group) |
102 | { | 102 | { |
103 | struct ext4_group_desc *desc; | 103 | struct ext4_group_desc *desc; |
104 | struct buffer_head *bh = NULL; | 104 | struct buffer_head *bh = NULL; |
@@ -152,7 +152,7 @@ void ext4_free_inode (handle_t *handle, struct inode * inode) | |||
152 | unsigned long ino; | 152 | unsigned long ino; |
153 | struct buffer_head *bitmap_bh = NULL; | 153 | struct buffer_head *bitmap_bh = NULL; |
154 | struct buffer_head *bh2; | 154 | struct buffer_head *bh2; |
155 | unsigned long block_group; | 155 | ext4_group_t block_group; |
156 | unsigned long bit; | 156 | unsigned long bit; |
157 | struct ext4_group_desc * gdp; | 157 | struct ext4_group_desc * gdp; |
158 | struct ext4_super_block * es; | 158 | struct ext4_super_block * es; |
@@ -260,12 +260,12 @@ error_return: | |||
260 | * For other inodes, search forward from the parent directory\'s block | 260 | * For other inodes, search forward from the parent directory\'s block |
261 | * group to find a free inode. | 261 | * group to find a free inode. |
262 | */ | 262 | */ |
263 | static int find_group_dir(struct super_block *sb, struct inode *parent) | 263 | static ext4_group_t find_group_dir(struct super_block *sb, struct inode *parent) |
264 | { | 264 | { |
265 | int ngroups = EXT4_SB(sb)->s_groups_count; | 265 | ext4_group_t ngroups = EXT4_SB(sb)->s_groups_count; |
266 | unsigned int freei, avefreei; | 266 | unsigned int freei, avefreei; |
267 | struct ext4_group_desc *desc, *best_desc = NULL; | 267 | struct ext4_group_desc *desc, *best_desc = NULL; |
268 | int group, best_group = -1; | 268 | ext4_group_t group, best_group = -1; |
269 | 269 | ||
270 | freei = percpu_counter_read_positive(&EXT4_SB(sb)->s_freeinodes_counter); | 270 | freei = percpu_counter_read_positive(&EXT4_SB(sb)->s_freeinodes_counter); |
271 | avefreei = freei / ngroups; | 271 | avefreei = freei / ngroups; |
@@ -314,12 +314,13 @@ static int find_group_dir(struct super_block *sb, struct inode *parent) | |||
314 | #define INODE_COST 64 | 314 | #define INODE_COST 64 |
315 | #define BLOCK_COST 256 | 315 | #define BLOCK_COST 256 |
316 | 316 | ||
317 | static int find_group_orlov(struct super_block *sb, struct inode *parent) | 317 | static ext4_group_t find_group_orlov(struct super_block *sb, |
318 | struct inode *parent) | ||
318 | { | 319 | { |
319 | int parent_group = EXT4_I(parent)->i_block_group; | 320 | ext4_group_t parent_group = EXT4_I(parent)->i_block_group; |
320 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 321 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
321 | struct ext4_super_block *es = sbi->s_es; | 322 | struct ext4_super_block *es = sbi->s_es; |
322 | int ngroups = sbi->s_groups_count; | 323 | ext4_group_t ngroups = sbi->s_groups_count; |
323 | int inodes_per_group = EXT4_INODES_PER_GROUP(sb); | 324 | int inodes_per_group = EXT4_INODES_PER_GROUP(sb); |
324 | unsigned int freei, avefreei; | 325 | unsigned int freei, avefreei; |
325 | ext4_fsblk_t freeb, avefreeb; | 326 | ext4_fsblk_t freeb, avefreeb; |
@@ -327,7 +328,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent) | |||
327 | unsigned int ndirs; | 328 | unsigned int ndirs; |
328 | int max_debt, max_dirs, min_inodes; | 329 | int max_debt, max_dirs, min_inodes; |
329 | ext4_grpblk_t min_blocks; | 330 | ext4_grpblk_t min_blocks; |
330 | int group = -1, i; | 331 | ext4_group_t group = -1, i; |
331 | struct ext4_group_desc *desc; | 332 | struct ext4_group_desc *desc; |
332 | 333 | ||
333 | freei = percpu_counter_read_positive(&sbi->s_freeinodes_counter); | 334 | freei = percpu_counter_read_positive(&sbi->s_freeinodes_counter); |
@@ -340,7 +341,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent) | |||
340 | if ((parent == sb->s_root->d_inode) || | 341 | if ((parent == sb->s_root->d_inode) || |
341 | (EXT4_I(parent)->i_flags & EXT4_TOPDIR_FL)) { | 342 | (EXT4_I(parent)->i_flags & EXT4_TOPDIR_FL)) { |
342 | int best_ndir = inodes_per_group; | 343 | int best_ndir = inodes_per_group; |
343 | int best_group = -1; | 344 | ext4_group_t best_group = -1; |
344 | 345 | ||
345 | get_random_bytes(&group, sizeof(group)); | 346 | get_random_bytes(&group, sizeof(group)); |
346 | parent_group = (unsigned)group % ngroups; | 347 | parent_group = (unsigned)group % ngroups; |
@@ -415,12 +416,13 @@ fallback: | |||
415 | return -1; | 416 | return -1; |
416 | } | 417 | } |
417 | 418 | ||
418 | static int find_group_other(struct super_block *sb, struct inode *parent) | 419 | static ext4_group_t find_group_other(struct super_block *sb, |
420 | struct inode *parent) | ||
419 | { | 421 | { |
420 | int parent_group = EXT4_I(parent)->i_block_group; | 422 | ext4_group_t parent_group = EXT4_I(parent)->i_block_group; |
421 | int ngroups = EXT4_SB(sb)->s_groups_count; | 423 | ext4_group_t ngroups = EXT4_SB(sb)->s_groups_count; |
422 | struct ext4_group_desc *desc; | 424 | struct ext4_group_desc *desc; |
423 | int group, i; | 425 | ext4_group_t group, i; |
424 | 426 | ||
425 | /* | 427 | /* |
426 | * Try to place the inode in its parent directory | 428 | * Try to place the inode in its parent directory |
@@ -487,7 +489,7 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode * dir, int mode) | |||
487 | struct super_block *sb; | 489 | struct super_block *sb; |
488 | struct buffer_head *bitmap_bh = NULL; | 490 | struct buffer_head *bitmap_bh = NULL; |
489 | struct buffer_head *bh2; | 491 | struct buffer_head *bh2; |
490 | int group; | 492 | ext4_group_t group; |
491 | unsigned long ino = 0; | 493 | unsigned long ino = 0; |
492 | struct inode * inode; | 494 | struct inode * inode; |
493 | struct ext4_group_desc * gdp = NULL; | 495 | struct ext4_group_desc * gdp = NULL; |
@@ -583,7 +585,7 @@ got: | |||
583 | ino > EXT4_INODES_PER_GROUP(sb)) { | 585 | ino > EXT4_INODES_PER_GROUP(sb)) { |
584 | ext4_error(sb, __FUNCTION__, | 586 | ext4_error(sb, __FUNCTION__, |
585 | "reserved inode or inode > inodes count - " | 587 | "reserved inode or inode > inodes count - " |
586 | "block_group = %d, inode=%lu", group, | 588 | "block_group = %lu, inode=%lu", group, |
587 | ino + group * EXT4_INODES_PER_GROUP(sb)); | 589 | ino + group * EXT4_INODES_PER_GROUP(sb)); |
588 | err = -EIO; | 590 | err = -EIO; |
589 | goto fail; | 591 | goto fail; |
@@ -777,7 +779,7 @@ fail_drop: | |||
777 | struct inode *ext4_orphan_get(struct super_block *sb, unsigned long ino) | 779 | struct inode *ext4_orphan_get(struct super_block *sb, unsigned long ino) |
778 | { | 780 | { |
779 | unsigned long max_ino = le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count); | 781 | unsigned long max_ino = le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count); |
780 | unsigned long block_group; | 782 | ext4_group_t block_group; |
781 | int bit; | 783 | int bit; |
782 | struct buffer_head *bitmap_bh = NULL; | 784 | struct buffer_head *bitmap_bh = NULL; |
783 | struct inode *inode = NULL; | 785 | struct inode *inode = NULL; |
@@ -833,7 +835,7 @@ unsigned long ext4_count_free_inodes (struct super_block * sb) | |||
833 | { | 835 | { |
834 | unsigned long desc_count; | 836 | unsigned long desc_count; |
835 | struct ext4_group_desc *gdp; | 837 | struct ext4_group_desc *gdp; |
836 | int i; | 838 | ext4_group_t i; |
837 | #ifdef EXT4FS_DEBUG | 839 | #ifdef EXT4FS_DEBUG |
838 | struct ext4_super_block *es; | 840 | struct ext4_super_block *es; |
839 | unsigned long bitmap_count, x; | 841 | unsigned long bitmap_count, x; |
@@ -879,7 +881,7 @@ unsigned long ext4_count_free_inodes (struct super_block * sb) | |||
879 | unsigned long ext4_count_dirs (struct super_block * sb) | 881 | unsigned long ext4_count_dirs (struct super_block * sb) |
880 | { | 882 | { |
881 | unsigned long count = 0; | 883 | unsigned long count = 0; |
882 | int i; | 884 | ext4_group_t i; |
883 | 885 | ||
884 | for (i = 0; i < EXT4_SB(sb)->s_groups_count; i++) { | 886 | for (i = 0; i < EXT4_SB(sb)->s_groups_count; i++) { |
885 | struct ext4_group_desc *gdp = ext4_get_group_desc (sb, i, NULL); | 887 | struct ext4_group_desc *gdp = ext4_get_group_desc (sb, i, NULL); |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 488f829a8879..1ee19c918686 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -2464,7 +2464,8 @@ out_stop: | |||
2464 | static ext4_fsblk_t ext4_get_inode_block(struct super_block *sb, | 2464 | static ext4_fsblk_t ext4_get_inode_block(struct super_block *sb, |
2465 | unsigned long ino, struct ext4_iloc *iloc) | 2465 | unsigned long ino, struct ext4_iloc *iloc) |
2466 | { | 2466 | { |
2467 | unsigned long desc, group_desc, block_group; | 2467 | unsigned long desc, group_desc; |
2468 | ext4_group_t block_group; | ||
2468 | unsigned long offset; | 2469 | unsigned long offset; |
2469 | ext4_fsblk_t block; | 2470 | ext4_fsblk_t block; |
2470 | struct buffer_head *bh; | 2471 | struct buffer_head *bh; |
@@ -2551,7 +2552,7 @@ static int __ext4_get_inode_loc(struct inode *inode, | |||
2551 | struct ext4_group_desc *desc; | 2552 | struct ext4_group_desc *desc; |
2552 | int inodes_per_buffer; | 2553 | int inodes_per_buffer; |
2553 | int inode_offset, i; | 2554 | int inode_offset, i; |
2554 | int block_group; | 2555 | ext4_group_t block_group; |
2555 | int start; | 2556 | int start; |
2556 | 2557 | ||
2557 | block_group = (inode->i_ino - 1) / | 2558 | block_group = (inode->i_ino - 1) / |
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index bd8a52bb3999..7090c2d25c76 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c | |||
@@ -28,7 +28,7 @@ static int verify_group_input(struct super_block *sb, | |||
28 | struct ext4_super_block *es = sbi->s_es; | 28 | struct ext4_super_block *es = sbi->s_es; |
29 | ext4_fsblk_t start = ext4_blocks_count(es); | 29 | ext4_fsblk_t start = ext4_blocks_count(es); |
30 | ext4_fsblk_t end = start + input->blocks_count; | 30 | ext4_fsblk_t end = start + input->blocks_count; |
31 | unsigned group = input->group; | 31 | ext4_group_t group = input->group; |
32 | ext4_fsblk_t itend = input->inode_table + sbi->s_itb_per_group; | 32 | ext4_fsblk_t itend = input->inode_table + sbi->s_itb_per_group; |
33 | unsigned overhead = ext4_bg_has_super(sb, group) ? | 33 | unsigned overhead = ext4_bg_has_super(sb, group) ? |
34 | (1 + ext4_bg_num_gdb(sb, group) + | 34 | (1 + ext4_bg_num_gdb(sb, group) + |
@@ -357,7 +357,7 @@ static int verify_reserved_gdb(struct super_block *sb, | |||
357 | struct buffer_head *primary) | 357 | struct buffer_head *primary) |
358 | { | 358 | { |
359 | const ext4_fsblk_t blk = primary->b_blocknr; | 359 | const ext4_fsblk_t blk = primary->b_blocknr; |
360 | const unsigned long end = EXT4_SB(sb)->s_groups_count; | 360 | const ext4_group_t end = EXT4_SB(sb)->s_groups_count; |
361 | unsigned three = 1; | 361 | unsigned three = 1; |
362 | unsigned five = 5; | 362 | unsigned five = 5; |
363 | unsigned seven = 7; | 363 | unsigned seven = 7; |
@@ -656,12 +656,12 @@ static void update_backups(struct super_block *sb, | |||
656 | int blk_off, char *data, int size) | 656 | int blk_off, char *data, int size) |
657 | { | 657 | { |
658 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 658 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
659 | const unsigned long last = sbi->s_groups_count; | 659 | const ext4_group_t last = sbi->s_groups_count; |
660 | const int bpg = EXT4_BLOCKS_PER_GROUP(sb); | 660 | const int bpg = EXT4_BLOCKS_PER_GROUP(sb); |
661 | unsigned three = 1; | 661 | unsigned three = 1; |
662 | unsigned five = 5; | 662 | unsigned five = 5; |
663 | unsigned seven = 7; | 663 | unsigned seven = 7; |
664 | unsigned group; | 664 | ext4_group_t group; |
665 | int rest = sb->s_blocksize - size; | 665 | int rest = sb->s_blocksize - size; |
666 | handle_t *handle; | 666 | handle_t *handle; |
667 | int err = 0, err2; | 667 | int err = 0, err2; |
@@ -716,7 +716,7 @@ static void update_backups(struct super_block *sb, | |||
716 | exit_err: | 716 | exit_err: |
717 | if (err) { | 717 | if (err) { |
718 | ext4_warning(sb, __FUNCTION__, | 718 | ext4_warning(sb, __FUNCTION__, |
719 | "can't update backup for group %d (err %d), " | 719 | "can't update backup for group %lu (err %d), " |
720 | "forcing fsck on next reboot", group, err); | 720 | "forcing fsck on next reboot", group, err); |
721 | sbi->s_mount_state &= ~EXT4_VALID_FS; | 721 | sbi->s_mount_state &= ~EXT4_VALID_FS; |
722 | sbi->s_es->s_state &= cpu_to_le16(~EXT4_VALID_FS); | 722 | sbi->s_es->s_state &= cpu_to_le16(~EXT4_VALID_FS); |
@@ -952,7 +952,7 @@ int ext4_group_extend(struct super_block *sb, struct ext4_super_block *es, | |||
952 | ext4_fsblk_t n_blocks_count) | 952 | ext4_fsblk_t n_blocks_count) |
953 | { | 953 | { |
954 | ext4_fsblk_t o_blocks_count; | 954 | ext4_fsblk_t o_blocks_count; |
955 | unsigned long o_groups_count; | 955 | ext4_group_t o_groups_count; |
956 | ext4_grpblk_t last; | 956 | ext4_grpblk_t last; |
957 | ext4_grpblk_t add; | 957 | ext4_grpblk_t add; |
958 | struct buffer_head * bh; | 958 | struct buffer_head * bh; |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 6302b036c121..df8842b43544 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -1364,7 +1364,7 @@ static int ext4_check_descriptors (struct super_block * sb) | |||
1364 | struct ext4_group_desc * gdp = NULL; | 1364 | struct ext4_group_desc * gdp = NULL; |
1365 | int desc_block = 0; | 1365 | int desc_block = 0; |
1366 | int flexbg_flag = 0; | 1366 | int flexbg_flag = 0; |
1367 | int i; | 1367 | ext4_group_t i; |
1368 | 1368 | ||
1369 | if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) | 1369 | if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) |
1370 | flexbg_flag = 1; | 1370 | flexbg_flag = 1; |
@@ -1386,7 +1386,7 @@ static int ext4_check_descriptors (struct super_block * sb) | |||
1386 | if (block_bitmap < first_block || block_bitmap > last_block) | 1386 | if (block_bitmap < first_block || block_bitmap > last_block) |
1387 | { | 1387 | { |
1388 | ext4_error (sb, "ext4_check_descriptors", | 1388 | ext4_error (sb, "ext4_check_descriptors", |
1389 | "Block bitmap for group %d" | 1389 | "Block bitmap for group %lu" |
1390 | " not in group (block %llu)!", | 1390 | " not in group (block %llu)!", |
1391 | i, block_bitmap); | 1391 | i, block_bitmap); |
1392 | return 0; | 1392 | return 0; |
@@ -1395,7 +1395,7 @@ static int ext4_check_descriptors (struct super_block * sb) | |||
1395 | if (inode_bitmap < first_block || inode_bitmap > last_block) | 1395 | if (inode_bitmap < first_block || inode_bitmap > last_block) |
1396 | { | 1396 | { |
1397 | ext4_error (sb, "ext4_check_descriptors", | 1397 | ext4_error (sb, "ext4_check_descriptors", |
1398 | "Inode bitmap for group %d" | 1398 | "Inode bitmap for group %lu" |
1399 | " not in group (block %llu)!", | 1399 | " not in group (block %llu)!", |
1400 | i, inode_bitmap); | 1400 | i, inode_bitmap); |
1401 | return 0; | 1401 | return 0; |
@@ -1405,17 +1405,16 @@ static int ext4_check_descriptors (struct super_block * sb) | |||
1405 | inode_table + sbi->s_itb_per_group - 1 > last_block) | 1405 | inode_table + sbi->s_itb_per_group - 1 > last_block) |
1406 | { | 1406 | { |
1407 | ext4_error (sb, "ext4_check_descriptors", | 1407 | ext4_error (sb, "ext4_check_descriptors", |
1408 | "Inode table for group %d" | 1408 | "Inode table for group %lu" |
1409 | " not in group (block %llu)!", | 1409 | " not in group (block %llu)!", |
1410 | i, inode_table); | 1410 | i, inode_table); |
1411 | return 0; | 1411 | return 0; |
1412 | } | 1412 | } |
1413 | if (!ext4_group_desc_csum_verify(sbi, i, gdp)) { | 1413 | if (!ext4_group_desc_csum_verify(sbi, i, gdp)) { |
1414 | ext4_error(sb, __FUNCTION__, | 1414 | ext4_error(sb, __FUNCTION__, |
1415 | "Checksum for group %d failed (%u!=%u)\n", i, | 1415 | "Checksum for group %lu failed (%u!=%u)\n", |
1416 | le16_to_cpu(ext4_group_desc_csum(sbi, i, | 1416 | i, le16_to_cpu(ext4_group_desc_csum(sbi, i, |
1417 | gdp)), | 1417 | gdp)), le16_to_cpu(gdp->bg_checksum)); |
1418 | le16_to_cpu(gdp->bg_checksum)); | ||
1419 | return 0; | 1418 | return 0; |
1420 | } | 1419 | } |
1421 | if (!flexbg_flag) | 1420 | if (!flexbg_flag) |
@@ -1429,7 +1428,6 @@ static int ext4_check_descriptors (struct super_block * sb) | |||
1429 | return 1; | 1428 | return 1; |
1430 | } | 1429 | } |
1431 | 1430 | ||
1432 | |||
1433 | /* ext4_orphan_cleanup() walks a singly-linked list of inodes (starting at | 1431 | /* ext4_orphan_cleanup() walks a singly-linked list of inodes (starting at |
1434 | * the superblock) which were deleted from all directories, but held open by | 1432 | * the superblock) which were deleted from all directories, but held open by |
1435 | * a process at the time of a crash. We walk the list and try to delete these | 1433 | * a process at the time of a crash. We walk the list and try to delete these |
@@ -1570,7 +1568,7 @@ static ext4_fsblk_t descriptor_loc(struct super_block *sb, | |||
1570 | ext4_fsblk_t logical_sb_block, int nr) | 1568 | ext4_fsblk_t logical_sb_block, int nr) |
1571 | { | 1569 | { |
1572 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 1570 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
1573 | unsigned long bg, first_meta_bg; | 1571 | ext4_group_t bg, first_meta_bg; |
1574 | int has_super = 0; | 1572 | int has_super = 0; |
1575 | 1573 | ||
1576 | first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg); | 1574 | first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg); |
@@ -2678,7 +2676,7 @@ static int ext4_statfs (struct dentry * dentry, struct kstatfs * buf) | |||
2678 | if (test_opt(sb, MINIX_DF)) { | 2676 | if (test_opt(sb, MINIX_DF)) { |
2679 | sbi->s_overhead_last = 0; | 2677 | sbi->s_overhead_last = 0; |
2680 | } else if (sbi->s_blocks_last != ext4_blocks_count(es)) { | 2678 | } else if (sbi->s_blocks_last != ext4_blocks_count(es)) { |
2681 | unsigned long ngroups = sbi->s_groups_count, i; | 2679 | ext4_group_t ngroups = sbi->s_groups_count, i; |
2682 | ext4_fsblk_t overhead = 0; | 2680 | ext4_fsblk_t overhead = 0; |
2683 | smp_rmb(); | 2681 | smp_rmb(); |
2684 | 2682 | ||
diff --git a/include/linux/ext4_fs.h b/include/linux/ext4_fs.h index 5e2da0974d16..e1103c2a0d42 100644 --- a/include/linux/ext4_fs.h +++ b/include/linux/ext4_fs.h | |||
@@ -830,7 +830,7 @@ struct ext4_iloc | |||
830 | { | 830 | { |
831 | struct buffer_head *bh; | 831 | struct buffer_head *bh; |
832 | unsigned long offset; | 832 | unsigned long offset; |
833 | unsigned long block_group; | 833 | ext4_group_t block_group; |
834 | }; | 834 | }; |
835 | 835 | ||
836 | static inline struct ext4_inode *ext4_raw_inode(struct ext4_iloc *iloc) | 836 | static inline struct ext4_inode *ext4_raw_inode(struct ext4_iloc *iloc) |
@@ -855,7 +855,7 @@ struct dir_private_info { | |||
855 | 855 | ||
856 | /* calculate the first block number of the group */ | 856 | /* calculate the first block number of the group */ |
857 | static inline ext4_fsblk_t | 857 | static inline ext4_fsblk_t |
858 | ext4_group_first_block_no(struct super_block *sb, unsigned long group_no) | 858 | ext4_group_first_block_no(struct super_block *sb, ext4_group_t group_no) |
859 | { | 859 | { |
860 | return group_no * (ext4_fsblk_t)EXT4_BLOCKS_PER_GROUP(sb) + | 860 | return group_no * (ext4_fsblk_t)EXT4_BLOCKS_PER_GROUP(sb) + |
861 | le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block); | 861 | le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block); |
@@ -886,8 +886,9 @@ extern unsigned int ext4_block_group(struct super_block *sb, | |||
886 | ext4_fsblk_t blocknr); | 886 | ext4_fsblk_t blocknr); |
887 | extern ext4_grpblk_t ext4_block_group_offset(struct super_block *sb, | 887 | extern ext4_grpblk_t ext4_block_group_offset(struct super_block *sb, |
888 | ext4_fsblk_t blocknr); | 888 | ext4_fsblk_t blocknr); |
889 | extern int ext4_bg_has_super(struct super_block *sb, int group); | 889 | extern int ext4_bg_has_super(struct super_block *sb, ext4_group_t group); |
890 | extern unsigned long ext4_bg_num_gdb(struct super_block *sb, int group); | 890 | extern unsigned long ext4_bg_num_gdb(struct super_block *sb, |
891 | ext4_group_t group); | ||
891 | extern ext4_fsblk_t ext4_new_block (handle_t *handle, struct inode *inode, | 892 | extern ext4_fsblk_t ext4_new_block (handle_t *handle, struct inode *inode, |
892 | ext4_fsblk_t goal, int *errp); | 893 | ext4_fsblk_t goal, int *errp); |
893 | extern ext4_fsblk_t ext4_new_blocks (handle_t *handle, struct inode *inode, | 894 | extern ext4_fsblk_t ext4_new_blocks (handle_t *handle, struct inode *inode, |
@@ -900,7 +901,7 @@ extern void ext4_free_blocks_sb (handle_t *handle, struct super_block *sb, | |||
900 | extern ext4_fsblk_t ext4_count_free_blocks (struct super_block *); | 901 | extern ext4_fsblk_t ext4_count_free_blocks (struct super_block *); |
901 | extern void ext4_check_blocks_bitmap (struct super_block *); | 902 | extern void ext4_check_blocks_bitmap (struct super_block *); |
902 | extern struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb, | 903 | extern struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb, |
903 | unsigned int block_group, | 904 | ext4_group_t block_group, |
904 | struct buffer_head ** bh); | 905 | struct buffer_head ** bh); |
905 | extern int ext4_should_retry_alloc(struct super_block *sb, int *retries); | 906 | extern int ext4_should_retry_alloc(struct super_block *sb, int *retries); |
906 | extern void ext4_init_block_alloc_info(struct inode *); | 907 | extern void ext4_init_block_alloc_info(struct inode *); |
diff --git a/include/linux/ext4_fs_i.h b/include/linux/ext4_fs_i.h index 6c610b67b047..2b4e3700c725 100644 --- a/include/linux/ext4_fs_i.h +++ b/include/linux/ext4_fs_i.h | |||
@@ -30,6 +30,9 @@ typedef unsigned long long ext4_fsblk_t; | |||
30 | /* data type for file logical block number */ | 30 | /* data type for file logical block number */ |
31 | typedef __u32 ext4_lblk_t; | 31 | typedef __u32 ext4_lblk_t; |
32 | 32 | ||
33 | /* data type for block group number */ | ||
34 | typedef unsigned long ext4_group_t; | ||
35 | |||
33 | struct ext4_reserve_window { | 36 | struct ext4_reserve_window { |
34 | ext4_fsblk_t _rsv_start; /* First byte reserved */ | 37 | ext4_fsblk_t _rsv_start; /* First byte reserved */ |
35 | ext4_fsblk_t _rsv_end; /* Last byte reserved or 0 */ | 38 | ext4_fsblk_t _rsv_end; /* Last byte reserved or 0 */ |
@@ -92,7 +95,7 @@ struct ext4_inode_info { | |||
92 | * place a file's data blocks near its inode block, and new inodes | 95 | * place a file's data blocks near its inode block, and new inodes |
93 | * near to their parent directory's inode. | 96 | * near to their parent directory's inode. |
94 | */ | 97 | */ |
95 | __u32 i_block_group; | 98 | ext4_group_t i_block_group; |
96 | __u32 i_state; /* Dynamic state flags for ext4 */ | 99 | __u32 i_state; /* Dynamic state flags for ext4 */ |
97 | 100 | ||
98 | /* block reservation info */ | 101 | /* block reservation info */ |
diff --git a/include/linux/ext4_fs_sb.h b/include/linux/ext4_fs_sb.h index b40e827cd495..f15821c5e4c4 100644 --- a/include/linux/ext4_fs_sb.h +++ b/include/linux/ext4_fs_sb.h | |||
@@ -35,7 +35,7 @@ struct ext4_sb_info { | |||
35 | unsigned long s_itb_per_group; /* Number of inode table blocks per group */ | 35 | unsigned long s_itb_per_group; /* Number of inode table blocks per group */ |
36 | unsigned long s_gdb_count; /* Number of group descriptor blocks */ | 36 | unsigned long s_gdb_count; /* Number of group descriptor blocks */ |
37 | unsigned long s_desc_per_block; /* Number of group descriptors per block */ | 37 | unsigned long s_desc_per_block; /* Number of group descriptors per block */ |
38 | unsigned long s_groups_count; /* Number of groups in the fs */ | 38 | ext4_group_t s_groups_count; /* Number of groups in the fs */ |
39 | unsigned long s_overhead_last; /* Last calculated overhead */ | 39 | unsigned long s_overhead_last; /* Last calculated overhead */ |
40 | unsigned long s_blocks_last; /* Last seen block count */ | 40 | unsigned long s_blocks_last; /* Last seen block count */ |
41 | struct buffer_head * s_sbh; /* Buffer containing the super block */ | 41 | struct buffer_head * s_sbh; /* Buffer containing the super block */ |