aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2008-11-05 00:14:04 -0500
committerTheodore Ts'o <tytso@mit.edu>2008-11-05 00:14:04 -0500
commit498e5f24158da7bf8fa48074a70e370e22844492 (patch)
tree1434b349c8eca3b0667af0b385533cbcd599c1c3
parenta9df9a49102f3578909cba7bd33784eb3b9caaa4 (diff)
ext4: Change unsigned long to unsigned int
Convert the unsigned longs that are most responsible for bloating the stack usage on 64-bit systems. Nearly all places in the ext3/4 code which uses "unsigned long" is probably a bug, since on 32-bit systems a ulong a 32-bits, which means we are wasting stack space on 64-bit systems. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r--fs/ext4/balloc.c14
-rw-r--r--fs/ext4/bitmap.c5
-rw-r--r--fs/ext4/dir.c8
-rw-r--r--fs/ext4/ext4.h22
-rw-r--r--fs/ext4/ext4_i.h13
-rw-r--r--fs/ext4/extents.c24
-rw-r--r--fs/ext4/inode.c25
-rw-r--r--fs/ext4/mballoc.c20
-rw-r--r--fs/ext4/namei.c25
9 files changed, 77 insertions, 79 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index a711898923f0..a0c23b03a264 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -205,8 +205,8 @@ struct ext4_group_desc * ext4_get_group_desc(struct super_block *sb,
205 ext4_group_t block_group, 205 ext4_group_t block_group,
206 struct buffer_head **bh) 206 struct buffer_head **bh)
207{ 207{
208 unsigned long group_desc; 208 unsigned int group_desc;
209 unsigned long offset; 209 unsigned int offset;
210 struct ext4_group_desc *desc; 210 struct ext4_group_desc *desc;
211 struct ext4_sb_info *sbi = EXT4_SB(sb); 211 struct ext4_sb_info *sbi = EXT4_SB(sb);
212 212
@@ -225,7 +225,7 @@ struct ext4_group_desc * ext4_get_group_desc(struct super_block *sb,
225 if (!sbi->s_group_desc[group_desc]) { 225 if (!sbi->s_group_desc[group_desc]) {
226 ext4_error(sb, "ext4_get_group_desc", 226 ext4_error(sb, "ext4_get_group_desc",
227 "Group descriptor not loaded - " 227 "Group descriptor not loaded - "
228 "block_group = %u, group_desc = %lu, desc = %lu", 228 "block_group = %u, group_desc = %u, desc = %u",
229 block_group, group_desc, offset); 229 block_group, group_desc, offset);
230 return NULL; 230 return NULL;
231 } 231 }
@@ -372,8 +372,8 @@ void ext4_free_blocks_sb(handle_t *handle, struct super_block *sb,
372 struct buffer_head *gd_bh; 372 struct buffer_head *gd_bh;
373 ext4_group_t block_group; 373 ext4_group_t block_group;
374 ext4_grpblk_t bit; 374 ext4_grpblk_t bit;
375 unsigned long i; 375 unsigned int i;
376 unsigned long overflow; 376 unsigned int overflow;
377 struct ext4_group_desc *desc; 377 struct ext4_group_desc *desc;
378 struct ext4_super_block *es; 378 struct ext4_super_block *es;
379 struct ext4_sb_info *sbi; 379 struct ext4_sb_info *sbi;
@@ -720,7 +720,7 @@ ext4_fsblk_t ext4_count_free_blocks(struct super_block *sb)
720#ifdef EXT4FS_DEBUG 720#ifdef EXT4FS_DEBUG
721 struct ext4_super_block *es; 721 struct ext4_super_block *es;
722 ext4_fsblk_t bitmap_count; 722 ext4_fsblk_t bitmap_count;
723 unsigned long x; 723 unsigned int x;
724 struct buffer_head *bitmap_bh = NULL; 724 struct buffer_head *bitmap_bh = NULL;
725 725
726 es = EXT4_SB(sb)->s_es; 726 es = EXT4_SB(sb)->s_es;
@@ -740,7 +740,7 @@ ext4_fsblk_t ext4_count_free_blocks(struct super_block *sb)
740 continue; 740 continue;
741 741
742 x = ext4_count_free(bitmap_bh, sb->s_blocksize); 742 x = ext4_count_free(bitmap_bh, sb->s_blocksize);
743 printk(KERN_DEBUG "group %lu: stored = %d, counted = %lu\n", 743 printk(KERN_DEBUG "group %lu: stored = %d, counted = %u\n",
744 i, le16_to_cpu(gdp->bg_free_blocks_count), x); 744 i, le16_to_cpu(gdp->bg_free_blocks_count), x);
745 bitmap_count += x; 745 bitmap_count += x;
746 } 746 }
diff --git a/fs/ext4/bitmap.c b/fs/ext4/bitmap.c
index 0a7a6663c190..fa3af81ac565 100644
--- a/fs/ext4/bitmap.c
+++ b/fs/ext4/bitmap.c
@@ -15,10 +15,9 @@
15 15
16static const int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0}; 16static const int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0};
17 17
18unsigned long ext4_count_free(struct buffer_head *map, unsigned int numchars) 18unsigned int ext4_count_free(struct buffer_head *map, unsigned int numchars)
19{ 19{
20 unsigned int i; 20 unsigned int i, sum = 0;
21 unsigned long sum = 0;
22 21
23 if (!map) 22 if (!map)
24 return 0; 23 return 0;
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
index fed5b610df5a..cf3ccf4a94b0 100644
--- a/fs/ext4/dir.c
+++ b/fs/ext4/dir.c
@@ -64,7 +64,7 @@ static unsigned char get_dtype(struct super_block *sb, int filetype)
64int ext4_check_dir_entry(const char *function, struct inode *dir, 64int ext4_check_dir_entry(const char *function, struct inode *dir,
65 struct ext4_dir_entry_2 *de, 65 struct ext4_dir_entry_2 *de,
66 struct buffer_head *bh, 66 struct buffer_head *bh,
67 unsigned long offset) 67 unsigned int offset)
68{ 68{
69 const char *error_msg = NULL; 69 const char *error_msg = NULL;
70 const int rlen = ext4_rec_len_from_disk(de->rec_len); 70 const int rlen = ext4_rec_len_from_disk(de->rec_len);
@@ -84,9 +84,9 @@ int ext4_check_dir_entry(const char *function, struct inode *dir,
84 if (error_msg != NULL) 84 if (error_msg != NULL)
85 ext4_error(dir->i_sb, function, 85 ext4_error(dir->i_sb, function,
86 "bad entry in directory #%lu: %s - " 86 "bad entry in directory #%lu: %s - "
87 "offset=%lu, inode=%lu, rec_len=%d, name_len=%d", 87 "offset=%u, inode=%u, rec_len=%d, name_len=%d",
88 dir->i_ino, error_msg, offset, 88 dir->i_ino, error_msg, offset,
89 (unsigned long) le32_to_cpu(de->inode), 89 le32_to_cpu(de->inode),
90 rlen, de->name_len); 90 rlen, de->name_len);
91 return error_msg == NULL ? 1 : 0; 91 return error_msg == NULL ? 1 : 0;
92} 92}
@@ -95,7 +95,7 @@ static int ext4_readdir(struct file *filp,
95 void *dirent, filldir_t filldir) 95 void *dirent, filldir_t filldir)
96{ 96{
97 int error = 0; 97 int error = 0;
98 unsigned long offset; 98 unsigned int offset;
99 int i, stored; 99 int i, stored;
100 struct ext4_dir_entry_2 *de; 100 struct ext4_dir_entry_2 *de;
101 struct super_block *sb; 101 struct super_block *sb;
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index e9aacecfbf41..558545d1fead 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -94,9 +94,9 @@ struct ext4_allocation_request {
94 /* phys. block for ^^^ */ 94 /* phys. block for ^^^ */
95 ext4_fsblk_t pright; 95 ext4_fsblk_t pright;
96 /* how many blocks we want to allocate */ 96 /* how many blocks we want to allocate */
97 unsigned long len; 97 unsigned int len;
98 /* flags. see above EXT4_MB_HINT_* */ 98 /* flags. see above EXT4_MB_HINT_* */
99 unsigned long flags; 99 unsigned int flags;
100}; 100};
101 101
102/* 102/*
@@ -997,6 +997,9 @@ do { \
997# define ATTRIB_NORET __attribute__((noreturn)) 997# define ATTRIB_NORET __attribute__((noreturn))
998# define NORET_AND noreturn, 998# define NORET_AND noreturn,
999 999
1000/* bitmap.c */
1001extern unsigned int ext4_count_free(struct buffer_head *, unsigned);
1002
1000/* balloc.c */ 1003/* balloc.c */
1001extern unsigned int ext4_block_group(struct super_block *sb, 1004extern unsigned int ext4_block_group(struct super_block *sb,
1002 ext4_fsblk_t blocknr); 1005 ext4_fsblk_t blocknr);
@@ -1024,7 +1027,7 @@ extern int ext4_should_retry_alloc(struct super_block *sb, int *retries);
1024/* dir.c */ 1027/* dir.c */
1025extern int ext4_check_dir_entry(const char *, struct inode *, 1028extern int ext4_check_dir_entry(const char *, struct inode *,
1026 struct ext4_dir_entry_2 *, 1029 struct ext4_dir_entry_2 *,
1027 struct buffer_head *, unsigned long); 1030 struct buffer_head *, unsigned int);
1028extern int ext4_htree_store_dirent(struct file *dir_file, __u32 hash, 1031extern int ext4_htree_store_dirent(struct file *dir_file, __u32 hash,
1029 __u32 minor_hash, 1032 __u32 minor_hash,
1030 struct ext4_dir_entry_2 *dirent); 1033 struct ext4_dir_entry_2 *dirent);
@@ -1044,7 +1047,6 @@ extern struct inode * ext4_orphan_get(struct super_block *, unsigned long);
1044extern unsigned long ext4_count_free_inodes(struct super_block *); 1047extern unsigned long ext4_count_free_inodes(struct super_block *);
1045extern unsigned long ext4_count_dirs(struct super_block *); 1048extern unsigned long ext4_count_dirs(struct super_block *);
1046extern void ext4_check_inodes_bitmap(struct super_block *); 1049extern void ext4_check_inodes_bitmap(struct super_block *);
1047extern unsigned long ext4_count_free(struct buffer_head *, unsigned);
1048 1050
1049/* mballoc.c */ 1051/* mballoc.c */
1050extern long ext4_mb_stats; 1052extern long ext4_mb_stats;
@@ -1074,10 +1076,6 @@ struct buffer_head *ext4_bread(handle_t *, struct inode *,
1074 ext4_lblk_t, int, int *); 1076 ext4_lblk_t, int, int *);
1075int ext4_get_block(struct inode *inode, sector_t iblock, 1077int ext4_get_block(struct inode *inode, sector_t iblock,
1076 struct buffer_head *bh_result, int create); 1078 struct buffer_head *bh_result, int create);
1077int ext4_get_blocks_handle(handle_t *handle, struct inode *inode,
1078 ext4_lblk_t iblock, unsigned long maxblocks,
1079 struct buffer_head *bh_result,
1080 int create, int extend_disksize);
1081 1079
1082extern struct inode *ext4_iget(struct super_block *, unsigned long); 1080extern struct inode *ext4_iget(struct super_block *, unsigned long);
1083extern int ext4_write_inode(struct inode *, int); 1081extern int ext4_write_inode(struct inode *, int);
@@ -1276,16 +1274,16 @@ extern int ext4_ext_writepage_trans_blocks(struct inode *, int);
1276extern int ext4_ext_index_trans_blocks(struct inode *inode, int nrblocks, 1274extern int ext4_ext_index_trans_blocks(struct inode *inode, int nrblocks,
1277 int chunk); 1275 int chunk);
1278extern int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, 1276extern int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
1279 ext4_lblk_t iblock, 1277 ext4_lblk_t iblock, unsigned int max_blocks,
1280 unsigned long max_blocks, struct buffer_head *bh_result, 1278 struct buffer_head *bh_result,
1281 int create, int extend_disksize); 1279 int create, int extend_disksize);
1282extern void ext4_ext_truncate(struct inode *); 1280extern void ext4_ext_truncate(struct inode *);
1283extern void ext4_ext_init(struct super_block *); 1281extern void ext4_ext_init(struct super_block *);
1284extern void ext4_ext_release(struct super_block *); 1282extern void ext4_ext_release(struct super_block *);
1285extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset, 1283extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset,
1286 loff_t len); 1284 loff_t len);
1287extern int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, 1285extern int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode,
1288 sector_t block, unsigned long max_blocks, 1286 sector_t block, unsigned int max_blocks,
1289 struct buffer_head *bh, int create, 1287 struct buffer_head *bh, int create,
1290 int extend_disksize, int flag); 1288 int extend_disksize, int flag);
1291#endif /* __KERNEL__ */ 1289#endif /* __KERNEL__ */
diff --git a/fs/ext4/ext4_i.h b/fs/ext4/ext4_i.h
index 0a9ebe580195..e69acc16f5c4 100644
--- a/fs/ext4/ext4_i.h
+++ b/fs/ext4/ext4_i.h
@@ -100,9 +100,6 @@ struct ext4_inode_info {
100 */ 100 */
101 loff_t i_disksize; 101 loff_t i_disksize;
102 102
103 /* on-disk additional length */
104 __u16 i_extra_isize;
105
106 /* 103 /*
107 * i_data_sem is for serialising ext4_truncate() against 104 * i_data_sem is for serialising ext4_truncate() against
108 * ext4_getblock(). In the 2.4 ext2 design, great chunks of inode's 105 * ext4_getblock(). In the 2.4 ext2 design, great chunks of inode's
@@ -129,10 +126,14 @@ struct ext4_inode_info {
129 spinlock_t i_prealloc_lock; 126 spinlock_t i_prealloc_lock;
130 127
131 /* allocation reservation info for delalloc */ 128 /* allocation reservation info for delalloc */
132 unsigned long i_reserved_data_blocks; 129 unsigned int i_reserved_data_blocks;
133 unsigned long i_reserved_meta_blocks; 130 unsigned int i_reserved_meta_blocks;
134 unsigned long i_allocated_meta_blocks; 131 unsigned int i_allocated_meta_blocks;
135 unsigned short i_delalloc_reserved_flag; 132 unsigned short i_delalloc_reserved_flag;
133
134 /* on-disk additional length */
135 __u16 i_extra_isize;
136
136 spinlock_t i_block_reservation_lock; 137 spinlock_t i_block_reservation_lock;
137}; 138};
138 139
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index b9e27bc31559..b92cb60737bd 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -2377,7 +2377,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
2377 struct inode *inode, 2377 struct inode *inode,
2378 struct ext4_ext_path *path, 2378 struct ext4_ext_path *path,
2379 ext4_lblk_t iblock, 2379 ext4_lblk_t iblock,
2380 unsigned long max_blocks) 2380 unsigned int max_blocks)
2381{ 2381{
2382 struct ext4_extent *ex, newex, orig_ex; 2382 struct ext4_extent *ex, newex, orig_ex;
2383 struct ext4_extent *ex1 = NULL; 2383 struct ext4_extent *ex1 = NULL;
@@ -2675,26 +2675,26 @@ fix_extent_len:
2675 */ 2675 */
2676int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, 2676int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
2677 ext4_lblk_t iblock, 2677 ext4_lblk_t iblock,
2678 unsigned long max_blocks, struct buffer_head *bh_result, 2678 unsigned int max_blocks, struct buffer_head *bh_result,
2679 int create, int extend_disksize) 2679 int create, int extend_disksize)
2680{ 2680{
2681 struct ext4_ext_path *path = NULL; 2681 struct ext4_ext_path *path = NULL;
2682 struct ext4_extent_header *eh; 2682 struct ext4_extent_header *eh;
2683 struct ext4_extent newex, *ex; 2683 struct ext4_extent newex, *ex;
2684 ext4_fsblk_t goal, newblock; 2684 ext4_fsblk_t newblock;
2685 int err = 0, depth, ret; 2685 int err = 0, depth, ret, cache_type;
2686 unsigned long allocated = 0; 2686 unsigned int allocated = 0;
2687 struct ext4_allocation_request ar; 2687 struct ext4_allocation_request ar;
2688 loff_t disksize; 2688 loff_t disksize;
2689 2689
2690 __clear_bit(BH_New, &bh_result->b_state); 2690 __clear_bit(BH_New, &bh_result->b_state);
2691 ext_debug("blocks %u/%lu requested for inode %u\n", 2691 ext_debug("blocks %u/%u requested for inode %u\n",
2692 iblock, max_blocks, inode->i_ino); 2692 iblock, max_blocks, inode->i_ino);
2693 2693
2694 /* check in cache */ 2694 /* check in cache */
2695 goal = ext4_ext_in_cache(inode, iblock, &newex); 2695 cache_type = ext4_ext_in_cache(inode, iblock, &newex);
2696 if (goal) { 2696 if (cache_type) {
2697 if (goal == EXT4_EXT_CACHE_GAP) { 2697 if (cache_type == EXT4_EXT_CACHE_GAP) {
2698 if (!create) { 2698 if (!create) {
2699 /* 2699 /*
2700 * block isn't allocated yet and 2700 * block isn't allocated yet and
@@ -2703,7 +2703,7 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
2703 goto out2; 2703 goto out2;
2704 } 2704 }
2705 /* we should allocate requested block */ 2705 /* we should allocate requested block */
2706 } else if (goal == EXT4_EXT_CACHE_EXTENT) { 2706 } else if (cache_type == EXT4_EXT_CACHE_EXTENT) {
2707 /* block is already allocated */ 2707 /* block is already allocated */
2708 newblock = iblock 2708 newblock = iblock
2709 - le32_to_cpu(newex.ee_block) 2709 - le32_to_cpu(newex.ee_block)
@@ -2851,7 +2851,7 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
2851 if (!newblock) 2851 if (!newblock)
2852 goto out2; 2852 goto out2;
2853 ext_debug("allocate new block: goal %llu, found %llu/%lu\n", 2853 ext_debug("allocate new block: goal %llu, found %llu/%lu\n",
2854 goal, newblock, allocated); 2854 ar.goal, newblock, allocated);
2855 2855
2856 /* try to insert new extent into found leaf and return */ 2856 /* try to insert new extent into found leaf and return */
2857 ext4_ext_store_pblock(&newex, newblock); 2857 ext4_ext_store_pblock(&newex, newblock);
@@ -3001,7 +3001,7 @@ long ext4_fallocate(struct inode *inode, int mode, loff_t offset, loff_t len)
3001 handle_t *handle; 3001 handle_t *handle;
3002 ext4_lblk_t block; 3002 ext4_lblk_t block;
3003 loff_t new_size; 3003 loff_t new_size;
3004 unsigned long max_blocks; 3004 unsigned int max_blocks;
3005 int ret = 0; 3005 int ret = 0;
3006 int ret2 = 0; 3006 int ret2 = 0;
3007 int retries = 0; 3007 int retries = 0;
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 45d0f70a1f04..91e06f88f08c 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -514,10 +514,10 @@ static ext4_fsblk_t ext4_find_goal(struct inode *inode, ext4_lblk_t block,
514 * return the total number of blocks to be allocate, including the 514 * return the total number of blocks to be allocate, including the
515 * direct and indirect blocks. 515 * direct and indirect blocks.
516 */ 516 */
517static int ext4_blks_to_allocate(Indirect *branch, int k, unsigned long blks, 517static int ext4_blks_to_allocate(Indirect *branch, int k, unsigned int blks,
518 int blocks_to_boundary) 518 int blocks_to_boundary)
519{ 519{
520 unsigned long count = 0; 520 unsigned int count = 0;
521 521
522 /* 522 /*
523 * Simple case, [t,d]Indirect block(s) has not allocated yet 523 * Simple case, [t,d]Indirect block(s) has not allocated yet
@@ -856,10 +856,10 @@ err_out:
856 * down_read(&EXT4_I(inode)->i_data_sem) if not allocating file system block 856 * down_read(&EXT4_I(inode)->i_data_sem) if not allocating file system block
857 * (ie, create is zero). Otherwise down_write(&EXT4_I(inode)->i_data_sem) 857 * (ie, create is zero). Otherwise down_write(&EXT4_I(inode)->i_data_sem)
858 */ 858 */
859int ext4_get_blocks_handle(handle_t *handle, struct inode *inode, 859static int ext4_get_blocks_handle(handle_t *handle, struct inode *inode,
860 ext4_lblk_t iblock, unsigned long maxblocks, 860 ext4_lblk_t iblock, unsigned int maxblocks,
861 struct buffer_head *bh_result, 861 struct buffer_head *bh_result,
862 int create, int extend_disksize) 862 int create, int extend_disksize)
863{ 863{
864 int err = -EIO; 864 int err = -EIO;
865 ext4_lblk_t offsets[4]; 865 ext4_lblk_t offsets[4];
@@ -1061,7 +1061,7 @@ static void ext4_da_update_reserve_space(struct inode *inode, int used)
1061 * It returns the error in case of allocation failure. 1061 * It returns the error in case of allocation failure.
1062 */ 1062 */
1063int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, sector_t block, 1063int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, sector_t block,
1064 unsigned long max_blocks, struct buffer_head *bh, 1064 unsigned int max_blocks, struct buffer_head *bh,
1065 int create, int extend_disksize, int flag) 1065 int create, int extend_disksize, int flag)
1066{ 1066{
1067 int retval; 1067 int retval;
@@ -1641,7 +1641,7 @@ struct mpage_da_data {
1641 get_block_t *get_block; 1641 get_block_t *get_block;
1642 struct writeback_control *wbc; 1642 struct writeback_control *wbc;
1643 int io_done; 1643 int io_done;
1644 long pages_written; 1644 int pages_written;
1645 int retval; 1645 int retval;
1646}; 1646};
1647 1647
@@ -1855,9 +1855,9 @@ static void ext4_print_free_blocks(struct inode *inode)
1855 printk(KERN_EMERG "dirty_blocks=%lld\n", 1855 printk(KERN_EMERG "dirty_blocks=%lld\n",
1856 (long long)percpu_counter_sum(&sbi->s_dirtyblocks_counter)); 1856 (long long)percpu_counter_sum(&sbi->s_dirtyblocks_counter));
1857 printk(KERN_EMERG "Block reservation details\n"); 1857 printk(KERN_EMERG "Block reservation details\n");
1858 printk(KERN_EMERG "i_reserved_data_blocks=%lu\n", 1858 printk(KERN_EMERG "i_reserved_data_blocks=%u\n",
1859 EXT4_I(inode)->i_reserved_data_blocks); 1859 EXT4_I(inode)->i_reserved_data_blocks);
1860 printk(KERN_EMERG "i_reserved_meta_blocks=%lu\n", 1860 printk(KERN_EMERG "i_reserved_meta_blocks=%u\n",
1861 EXT4_I(inode)->i_reserved_meta_blocks); 1861 EXT4_I(inode)->i_reserved_meta_blocks);
1862 return; 1862 return;
1863} 1863}
@@ -2307,7 +2307,7 @@ static int ext4_da_writepage(struct page *page,
2307{ 2307{
2308 int ret = 0; 2308 int ret = 0;
2309 loff_t size; 2309 loff_t size;
2310 unsigned long len; 2310 unsigned int len;
2311 struct buffer_head *page_bufs; 2311 struct buffer_head *page_bufs;
2312 struct inode *inode = page->mapping->host; 2312 struct inode *inode = page->mapping->host;
2313 2313
@@ -2416,7 +2416,8 @@ static int ext4_da_writepages(struct address_space *mapping,
2416 struct mpage_da_data mpd; 2416 struct mpage_da_data mpd;
2417 struct inode *inode = mapping->host; 2417 struct inode *inode = mapping->host;
2418 int no_nrwrite_index_update; 2418 int no_nrwrite_index_update;
2419 long pages_written = 0, pages_skipped; 2419 int pages_written = 0;
2420 long pages_skipped;
2420 int needed_blocks, ret = 0, nr_to_writebump = 0; 2421 int needed_blocks, ret = 0, nr_to_writebump = 0;
2421 struct ext4_sb_info *sbi = EXT4_SB(mapping->host->i_sb); 2422 struct ext4_sb_info *sbi = EXT4_SB(mapping->host->i_sb);
2422 2423
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 6cfe68a7e070..1d78435ce388 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2796,7 +2796,7 @@ void exit_ext4_mballoc(void)
2796 */ 2796 */
2797static noinline_for_stack int 2797static noinline_for_stack int
2798ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac, 2798ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
2799 handle_t *handle, unsigned long reserv_blks) 2799 handle_t *handle, unsigned int reserv_blks)
2800{ 2800{
2801 struct buffer_head *bitmap_bh = NULL; 2801 struct buffer_head *bitmap_bh = NULL;
2802 struct ext4_super_block *es; 2802 struct ext4_super_block *es;
@@ -3036,7 +3036,7 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
3036 /* check we don't cross already preallocated blocks */ 3036 /* check we don't cross already preallocated blocks */
3037 rcu_read_lock(); 3037 rcu_read_lock();
3038 list_for_each_entry_rcu(pa, &ei->i_prealloc_list, pa_inode_list) { 3038 list_for_each_entry_rcu(pa, &ei->i_prealloc_list, pa_inode_list) {
3039 unsigned long pa_end; 3039 ext4_lblk_t pa_end;
3040 3040
3041 if (pa->pa_deleted) 3041 if (pa->pa_deleted)
3042 continue; 3042 continue;
@@ -3080,7 +3080,7 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
3080 /* XXX: extra loop to check we really don't overlap preallocations */ 3080 /* XXX: extra loop to check we really don't overlap preallocations */
3081 rcu_read_lock(); 3081 rcu_read_lock();
3082 list_for_each_entry_rcu(pa, &ei->i_prealloc_list, pa_inode_list) { 3082 list_for_each_entry_rcu(pa, &ei->i_prealloc_list, pa_inode_list) {
3083 unsigned long pa_end; 3083 ext4_lblk_t pa_end;
3084 spin_lock(&pa->pa_lock); 3084 spin_lock(&pa->pa_lock);
3085 if (pa->pa_deleted == 0) { 3085 if (pa->pa_deleted == 0) {
3086 pa_end = pa->pa_lstart + pa->pa_len; 3086 pa_end = pa->pa_lstart + pa->pa_len;
@@ -3584,8 +3584,8 @@ ext4_mb_release_inode_pa(struct ext4_buddy *e4b, struct buffer_head *bitmap_bh,
3584{ 3584{
3585 struct super_block *sb = e4b->bd_sb; 3585 struct super_block *sb = e4b->bd_sb;
3586 struct ext4_sb_info *sbi = EXT4_SB(sb); 3586 struct ext4_sb_info *sbi = EXT4_SB(sb);
3587 unsigned long end; 3587 unsigned int end;
3588 unsigned long next; 3588 unsigned int next;
3589 ext4_group_t group; 3589 ext4_group_t group;
3590 ext4_grpblk_t bit; 3590 ext4_grpblk_t bit;
3591 sector_t start; 3591 sector_t start;
@@ -4029,8 +4029,8 @@ ext4_mb_initialize_context(struct ext4_allocation_context *ac,
4029 struct ext4_sb_info *sbi = EXT4_SB(sb); 4029 struct ext4_sb_info *sbi = EXT4_SB(sb);
4030 struct ext4_super_block *es = sbi->s_es; 4030 struct ext4_super_block *es = sbi->s_es;
4031 ext4_group_t group; 4031 ext4_group_t group;
4032 unsigned long len; 4032 unsigned int len;
4033 unsigned long goal; 4033 ext4_fsblk_t goal;
4034 ext4_grpblk_t block; 4034 ext4_grpblk_t block;
4035 4035
4036 /* we can't allocate > group size */ 4036 /* we can't allocate > group size */
@@ -4291,8 +4291,8 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,
4291 struct ext4_sb_info *sbi; 4291 struct ext4_sb_info *sbi;
4292 struct super_block *sb; 4292 struct super_block *sb;
4293 ext4_fsblk_t block = 0; 4293 ext4_fsblk_t block = 0;
4294 unsigned long inquota; 4294 unsigned int inquota;
4295 unsigned long reserv_blks = 0; 4295 unsigned int reserv_blks = 0;
4296 4296
4297 sb = ar->inode->i_sb; 4297 sb = ar->inode->i_sb;
4298 sbi = EXT4_SB(sb); 4298 sbi = EXT4_SB(sb);
@@ -4504,7 +4504,7 @@ void ext4_mb_free_blocks(handle_t *handle, struct inode *inode,
4504 struct ext4_allocation_context *ac = NULL; 4504 struct ext4_allocation_context *ac = NULL;
4505 struct ext4_group_desc *gdp; 4505 struct ext4_group_desc *gdp;
4506 struct ext4_super_block *es; 4506 struct ext4_super_block *es;
4507 unsigned long overflow; 4507 unsigned int overflow;
4508 ext4_grpblk_t bit; 4508 ext4_grpblk_t bit;
4509 struct buffer_head *gd_bh; 4509 struct buffer_head *gd_bh;
4510 ext4_group_t block_group; 4510 ext4_group_t block_group;
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 08873e938ab2..183a09a8b14e 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -811,7 +811,7 @@ static inline int ext4_match (int len, const char * const name,
811static inline int search_dirblock(struct buffer_head *bh, 811static inline int search_dirblock(struct buffer_head *bh,
812 struct inode *dir, 812 struct inode *dir,
813 const struct qstr *d_name, 813 const struct qstr *d_name,
814 unsigned long offset, 814 unsigned int offset,
815 struct ext4_dir_entry_2 ** res_dir) 815 struct ext4_dir_entry_2 ** res_dir)
816{ 816{
817 struct ext4_dir_entry_2 * de; 817 struct ext4_dir_entry_2 * de;
@@ -1048,11 +1048,11 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, stru
1048 bh = ext4_find_entry(dir, &dentry->d_name, &de); 1048 bh = ext4_find_entry(dir, &dentry->d_name, &de);
1049 inode = NULL; 1049 inode = NULL;
1050 if (bh) { 1050 if (bh) {
1051 unsigned long ino = le32_to_cpu(de->inode); 1051 __u32 ino = le32_to_cpu(de->inode);
1052 brelse(bh); 1052 brelse(bh);
1053 if (!ext4_valid_inum(dir->i_sb, ino)) { 1053 if (!ext4_valid_inum(dir->i_sb, ino)) {
1054 ext4_error(dir->i_sb, "ext4_lookup", 1054 ext4_error(dir->i_sb, "ext4_lookup",
1055 "bad inode number: %lu", ino); 1055 "bad inode number: %u", ino);
1056 return ERR_PTR(-EIO); 1056 return ERR_PTR(-EIO);
1057 } 1057 }
1058 inode = ext4_iget(dir->i_sb, ino); 1058 inode = ext4_iget(dir->i_sb, ino);
@@ -1065,7 +1065,7 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, stru
1065 1065
1066struct dentry *ext4_get_parent(struct dentry *child) 1066struct dentry *ext4_get_parent(struct dentry *child)
1067{ 1067{
1068 unsigned long ino; 1068 __u32 ino;
1069 struct inode *inode; 1069 struct inode *inode;
1070 static const struct qstr dotdot = { 1070 static const struct qstr dotdot = {
1071 .name = "..", 1071 .name = "..",
@@ -1083,7 +1083,7 @@ struct dentry *ext4_get_parent(struct dentry *child)
1083 1083
1084 if (!ext4_valid_inum(child->d_inode->i_sb, ino)) { 1084 if (!ext4_valid_inum(child->d_inode->i_sb, ino)) {
1085 ext4_error(child->d_inode->i_sb, "ext4_get_parent", 1085 ext4_error(child->d_inode->i_sb, "ext4_get_parent",
1086 "bad inode number: %lu", ino); 1086 "bad inode number: %u", ino);
1087 return ERR_PTR(-EIO); 1087 return ERR_PTR(-EIO);
1088 } 1088 }
1089 1089
@@ -1271,7 +1271,7 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
1271 struct inode *dir = dentry->d_parent->d_inode; 1271 struct inode *dir = dentry->d_parent->d_inode;
1272 const char *name = dentry->d_name.name; 1272 const char *name = dentry->d_name.name;
1273 int namelen = dentry->d_name.len; 1273 int namelen = dentry->d_name.len;
1274 unsigned long offset = 0; 1274 unsigned int offset = 0;
1275 unsigned short reclen; 1275 unsigned short reclen;
1276 int nlen, rlen, err; 1276 int nlen, rlen, err;
1277 char *top; 1277 char *top;
@@ -1444,7 +1444,6 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
1444 struct inode *inode) 1444 struct inode *inode)
1445{ 1445{
1446 struct inode *dir = dentry->d_parent->d_inode; 1446 struct inode *dir = dentry->d_parent->d_inode;
1447 unsigned long offset;
1448 struct buffer_head *bh; 1447 struct buffer_head *bh;
1449 struct ext4_dir_entry_2 *de; 1448 struct ext4_dir_entry_2 *de;
1450 struct super_block *sb; 1449 struct super_block *sb;
@@ -1466,7 +1465,7 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
1466 ext4_mark_inode_dirty(handle, dir); 1465 ext4_mark_inode_dirty(handle, dir);
1467 } 1466 }
1468 blocks = dir->i_size >> sb->s_blocksize_bits; 1467 blocks = dir->i_size >> sb->s_blocksize_bits;
1469 for (block = 0, offset = 0; block < blocks; block++) { 1468 for (block = 0; block < blocks; block++) {
1470 bh = ext4_bread(handle, dir, block, 0, &retval); 1469 bh = ext4_bread(handle, dir, block, 0, &retval);
1471 if(!bh) 1470 if(!bh)
1472 return retval; 1471 return retval;
@@ -1861,7 +1860,7 @@ out_stop:
1861 */ 1860 */
1862static int empty_dir(struct inode *inode) 1861static int empty_dir(struct inode *inode)
1863{ 1862{
1864 unsigned long offset; 1863 unsigned int offset;
1865 struct buffer_head *bh; 1864 struct buffer_head *bh;
1866 struct ext4_dir_entry_2 *de, *de1; 1865 struct ext4_dir_entry_2 *de, *de1;
1867 struct super_block *sb; 1866 struct super_block *sb;
@@ -1906,7 +1905,7 @@ static int empty_dir(struct inode *inode)
1906 if (err) 1905 if (err)
1907 ext4_error(sb, __func__, 1906 ext4_error(sb, __func__,
1908 "error %d reading directory" 1907 "error %d reading directory"
1909 " #%lu offset %lu", 1908 " #%lu offset %u",
1910 err, inode->i_ino, offset); 1909 err, inode->i_ino, offset);
1911 offset += sb->s_blocksize; 1910 offset += sb->s_blocksize;
1912 continue; 1911 continue;
@@ -2009,7 +2008,7 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode)
2009 struct list_head *prev; 2008 struct list_head *prev;
2010 struct ext4_inode_info *ei = EXT4_I(inode); 2009 struct ext4_inode_info *ei = EXT4_I(inode);
2011 struct ext4_sb_info *sbi; 2010 struct ext4_sb_info *sbi;
2012 unsigned long ino_next; 2011 __u32 ino_next;
2013 struct ext4_iloc iloc; 2012 struct ext4_iloc iloc;
2014 int err = 0; 2013 int err = 0;
2015 2014
@@ -2042,7 +2041,7 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode)
2042 goto out_err; 2041 goto out_err;
2043 2042
2044 if (prev == &sbi->s_orphan) { 2043 if (prev == &sbi->s_orphan) {
2045 jbd_debug(4, "superblock will point to %lu\n", ino_next); 2044 jbd_debug(4, "superblock will point to %u\n", ino_next);
2046 BUFFER_TRACE(sbi->s_sbh, "get_write_access"); 2045 BUFFER_TRACE(sbi->s_sbh, "get_write_access");
2047 err = ext4_journal_get_write_access(handle, sbi->s_sbh); 2046 err = ext4_journal_get_write_access(handle, sbi->s_sbh);
2048 if (err) 2047 if (err)
@@ -2054,7 +2053,7 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode)
2054 struct inode *i_prev = 2053 struct inode *i_prev =
2055 &list_entry(prev, struct ext4_inode_info, i_orphan)->vfs_inode; 2054 &list_entry(prev, struct ext4_inode_info, i_orphan)->vfs_inode;
2056 2055
2057 jbd_debug(4, "orphan inode %lu will point to %lu\n", 2056 jbd_debug(4, "orphan inode %lu will point to %u\n",
2058 i_prev->i_ino, ino_next); 2057 i_prev->i_ino, ino_next);
2059 err = ext4_reserve_inode_write(handle, i_prev, &iloc2); 2058 err = ext4_reserve_inode_write(handle, i_prev, &iloc2);
2060 if (err) 2059 if (err)