ext3_fsblk_t: the rest of in-kernel filesystem blocks conversion.
PATCH 2/2 ext3_fsblk_t: the rest of in-kernel filesystem blocks conversion.
[Patch 2] Convert the ext3 in-kernel filesystem blocks to ext3_fsblk_t.
Convert the rest of all unsigned long type in-kernel filesystem blocks to ext3_fsblk_t, and replace the printk format string respondingly.
Signed-off-by Mingming Cao <[email protected]>
---
linux-2.6.17-rc4-ming/fs/ext3/balloc.c | 29 +++++------- linux-2.6.17-rc4-ming/fs/ext3/inode.c | 55 ++++++++++++------------ linux-2.6.17-rc4-ming/fs/ext3/ioctl.c | 2 linux-2.6.17-rc4-ming/fs/ext3/resize.c | 34 +++++++------- linux-2.6.17-rc4-ming/fs/ext3/super.c | 33 +++++++------- linux-2.6.17-rc4-ming/fs/ext3/xattr.c | 12 ++--- linux-2.6.17-rc4-ming/include/linux/ext3_fs.h | 12 ++++- linux-2.6.17-rc4-ming/include/linux/ext3_fs_i.h | 8 +-- 8 files changed, 97 insertions(+), 88 deletions(-)
fs/ext3/balloc.c renamed from fs/ext3/balloc.c~ext3_convert_blks_to_fsblk_t +13 -16
@@ -168,8 +168,7 @@ goal_in_my_reservation(struct ext3_reser {ext3_fsblk_t group_first_block, group_last_block; - group_first_block =le32_to_cpu (EXT3_SB (sb)->s_es->s_first_data_block) + - group *EXT3_BLOCKS_PER_GROUP (sb); + group_first_block =ext3_group_first_block_no (sb, group); group_last_block = group_first_block +EXT3_BLOCKS_PER_GROUP (sb) -1 ; if ((rsv->_rsv_start > group_last_block) ||
@@ -664,9 +663,7 @@ ext3_try_to_allocate(struct super_block/* we do allocation within the reservation window if we have a window */ if (my_rsv) { - group_first_block = -le32_to_cpu (EXT3_SB (sb)->s_es->s_first_data_block) + - group *EXT3_BLOCKS_PER_GROUP (sb); + group_first_block =ext3_group_first_block_no (sb, group);if (my_rsv->_rsv_start >= group_first_block) start = my_rsv->_rsv_start - group_first_block;else
@@ -900,8 +897,7 @@ static int alloc_new_reservation(structint ret;spinlock_t *rsv_lock = &EXT3_SB (sb)->s_rsv_window_lock; - group_first_block =le32_to_cpu (EXT3_SB (sb)->s_es->s_first_data_block) + - group *EXT3_BLOCKS_PER_GROUP (sb); + group_first_block =ext3_group_first_block_no (sb, group); group_end_block = group_first_block +EXT3_BLOCKS_PER_GROUP (sb) -1 ;if (grp_goal <0 )
@@ -1104,8 +1100,7 @@ ext3_try_to_allocate_with_rsv(struct sup* first block is a filesystem wide block number * first block is the block number of the first block in this group */ - group_first_block =le32_to_cpu (EXT3_SB (sb)->s_es->s_first_data_block) + - group *EXT3_BLOCKS_PER_GROUP (sb); + group_first_block =ext3_group_first_block_no (sb, group);/* * Basically we will allocate a new block from inode's reservation
@@ -1371,8 +1366,7 @@ allocated:if (fatal) goto out; - ret_block = grp_alloc_blk + group_no *EXT3_BLOCKS_PER_GROUP (sb) - +le32_to_cpu (es->s_first_data_block); + ret_block = grp_alloc_blk +ext3_group_first_block_no (sb, group_no); if (in_range(le32_to_cpu(gdp->bg_block_bitmap), ret_block, num) || in_range(le32_to_cpu(gdp->bg_inode_bitmap), ret_block, num) ||
@@ -1478,15 +1472,16 @@ ext3_fsblk_t ext3_new_block(handle_t *hareturn ext3_new_blocks (handle, inode, goal, &count, errp); } -unsigned long ext3_count_free_blocks (struct super_block *sb) +ext3_fsblk_t ext3_count_free_blocks (struct super_block *sb) { -unsigned long desc_count; +ext3_fsblk_t desc_count;struct ext3_group_desc *gdp;int i;unsigned long ngroups =EXT3_SB (sb)->s_groups_count;#ifdef EXT3FS_DEBUG struct ext3_super_block *es; -unsigned long bitmap_count, x; +ext3_fsblk_t bitmap_count; +unsigned long x;struct buffer_head *bitmap_bh =NULL ; es =EXT3_SB (sb)->s_es;
@@ -1511,8 +1506,10 @@ unsigned long ext3_count_free_blocks(str bitmap_count += x; }brelse (bitmap_bh); -printk ("ext3_count_free_blocks: stored = %u, computed = %lu, %lu\n" , -le32_to_cpu (es->s_free_blocks_count), desc_count, bitmap_count); +printk ("ext3_count_free_blocks: stored = " E3FSBLK +", computed = " E3FSBLK ", " E3FSBLK "\n" , +le32_to_cpu (es->s_free_blocks_count), + desc_count, bitmap_count);return bitmap_count;#else desc_count =0 ;
fs/ext3/inode.c renamed from fs/ext3/inode.c~ext3_convert_blks_to_fsblk_t +28 -27
183 lines not on this page · raw message
fs/ext3/ioctl.c renamed from fs/ext3/ioctl.c~ext3_convert_blks_to_fsblk_t +1 -1
@@ -204,7 +204,7 @@ flags_err:return 0 ; }case EXT3_IOC_GROUP_EXTEND : { -unsigned long n_blocks_count; +ext3_fsblk_t n_blocks_count;struct super_block *sb = inode->i_sb;int err;
fs/ext3/resize.c renamed from fs/ext3/resize.c~ext3_convert_blks_to_fsblk_t +18 -16
@@ -116,7 +116,7 @@ static int verify_group_input(struct sup }static struct buffer_head *bclean (handle_t *handle,struct super_block *sb, -unsigned long blk) +ext3_fsblk_t blk) {struct buffer_head *bh;int err;
@@ -167,14 +167,13 @@ static int setup_new_group_blocks(struct struct ext3_new_group_data *input) {struct ext3_sb_info *sbi =EXT3_SB (sb); -unsigned long start = input->group * sbi->s_blocks_per_group + -le32_to_cpu (sbi->s_es->s_first_data_block); +ext3_fsblk_t start =ext3_group_first_block_no (sb, input->group);int reserved_gdb =ext3_bg_has_super (sb, input->group) ?le16_to_cpu (sbi->s_es->s_reserved_gdt_blocks) :0 ;unsigned long gdblocks =ext3_bg_num_gdb (sb, input->group);struct buffer_head *bh;handle_t *handle; -unsigned long block; +ext3_fsblk_t block;ext3_grpblk_t bit;int i;int err =0 , err2;
@@ -332,7 +331,7 @@ static unsigned ext3_list_backups(structstatic int verify_reserved_gdb (struct super_block *sb,struct buffer_head *primary) { -const unsigned long blk = primary->b_blocknr; +const ext3_fsblk_t blk = primary->b_blocknr;const unsigned long end =EXT3_SB (sb)->s_groups_count;unsigned three =1 ;unsigned five =5 ;
@@ -344,7 +343,8 @@ static int verify_reserved_gdb(struct suwhile ((grp =ext3_list_backups (sb, &three, &five, &seven)) < end) {if (le32_to_cpu (*p++) != grp *EXT3_BLOCKS_PER_GROUP (sb) + blk){ext3_warning (sb, __FUNCTION__, -"reserved GDT %lu missing grp %d (%lu)" , +"reserved GDT " E3FSBLK +" missing grp %d (" E3FSBLK ")" , blk, grp, grp *EXT3_BLOCKS_PER_GROUP (sb) + blk);return -EINVAL ;
@@ -376,7 +376,7 @@ static int add_new_gdb(handle_t *handle,struct super_block *sb = inode->i_sb;struct ext3_super_block *es =EXT3_SB (sb)->s_es;unsigned long gdb_num = input->group /EXT3_DESC_PER_BLOCK (sb); -unsigned long gdblock =EXT3_SB (sb)->s_sbh->b_blocknr +1 + gdb_num; +ext3_fsblk_t gdblock =EXT3_SB (sb)->s_sbh->b_blocknr +1 + gdb_num;struct buffer_head **o_group_desc, **n_group_desc;struct buffer_head *dind;int gdbackups;
@@ -421,7 +421,7 @@ static int add_new_gdb(handle_t *handle, data = (__u32 *)dind->b_data;if (le32_to_cpu (data[gdb_num %EXT3_ADDR_PER_BLOCK (sb)]) != gdblock) {ext3_warning (sb, __FUNCTION__, -"new group %u GDT block %lu not reserved" , +"new group %u GDT block " E3FSBLK " not reserved" , input->group, gdblock); err = -EINVAL ; goto exit_dind;
@@ -519,7 +519,7 @@ static int reserve_backup_gdb(handle_t *struct buffer_head **primary;struct buffer_head *dind;struct ext3_iloc iloc; -unsigned long blk; +ext3_fsblk_t blk;__u32 *data, *end;int gdbackups =0 ;int res, i;
@@ -544,7 +544,8 @@ static int reserve_backup_gdb(handle_t *for (res =0 ; res < reserved_gdb; res++, blk++) {if (le32_to_cpu (*data) != blk) {ext3_warning (sb, __FUNCTION__, -"reserved block %lu not at offset %ld" , +"reserved block " E3FSBLK +" not at offset %ld" , blk, (long )(data - (__u32 *)dind->b_data)); err = -EINVAL ; goto exit_bh;
@@ -907,9 +908,9 @@ exit_put:* GDT blocks are reserved to grow to the desired size. */ int ext3_group_extend (struct super_block *sb,struct ext3_super_block *es, -unsigned long n_blocks_count) +ext3_fsblk_t n_blocks_count) { -unsigned long o_blocks_count; +ext3_fsblk_t o_blocks_count;unsigned long o_groups_count;ext3_grpblk_t last;ext3_grpblk_t add;
@@ -925,7 +926,7 @@ int ext3_group_extend(struct super_block o_groups_count =EXT3_SB (sb)->s_groups_count;if (test_opt (sb,DEBUG )) -printk (KERN_DEBUG "EXT3-fs: extending last group from %lu to %lu blocks\n" , +printk (KERN_DEBUG "EXT3-fs: extending last group from " E3FSBLK " uto " E3FSBLK " blocks\n" , o_blocks_count, n_blocks_count);if (n_blocks_count ==0 || n_blocks_count == o_blocks_count)
@@ -964,7 +965,8 @@ int ext3_group_extend(struct super_blockif (o_blocks_count + add < n_blocks_count)ext3_warning (sb, __FUNCTION__, -"will only finish group (%lu blocks, %u new)" , +"will only finish group (" E3FSBLK +" blocks, %u new)" , o_blocks_count + add, add);/* See if the device is actually as big as what was requested */
@@ -1007,10 +1009,10 @@ int ext3_group_extend(struct super_blockext3_journal_dirty_metadata (handle,EXT3_SB (sb)->s_sbh); sb->s_dirt =1 ;unlock_super (sb); -ext3_debug ("freeing blocks %lu through %lu\n" , o_blocks_count, +ext3_debug ("freeing blocks %lu through " E3FSBLK "\n" , o_blocks_count, o_blocks_count + add);ext3_free_blocks_sb (handle, sb, o_blocks_count, add, &freed_blocks); -ext3_debug ("freed blocks %lu through %lu\n" , o_blocks_count, +ext3_debug ("freed blocks " E3FSBLK " through " E3FSBLK "\n" , o_blocks_count, o_blocks_count + add);if ((err =ext3_journal_stop (handle))) goto exit_put;
fs/ext3/super.c renamed from fs/ext3/super.c~ext3_convert_blks_to_fsblk_t +17 -16
@@ -688,14 +688,15 @@ static match_table_t tokens = { {Opt_resize, "resize"}, }; -static unsigned long get_sb_block (void **data) +static ext3_fsblk_t get_sb_block (void **data) { -unsigned long sb_block; +ext3_fsblk_t sb_block;char *options = (char *) *data;if (!options ||strncmp (options,"sb=" ,3 ) !=0 )return 1 ;/* Default location */ options +=3 ; +/*todo: use simple_strtoll with >32bit ext3 */ sb_block =simple_strtoul (options, &options,0 );if (*options && *options !=',' ) { printk("EXT3-fs: Invalid sb specification: %s\n",
@@ -710,7 +711,7 @@ static unsigned long get_sb_block(void *static int parse_options (char *options,struct super_block *sb,unsigned long *inum,unsigned long *journal_devnum, -unsigned long *n_blocks_count,int is_remount) +ext3_fsblk_t *n_blocks_count,int is_remount) {struct ext3_sb_info *sbi =EXT3_SB (sb);char * p;
@@ -1127,7 +1128,7 @@ static int ext3_setup_super(struct superstatic int ext3_check_descriptors (struct super_block * sb) {struct ext3_sb_info *sbi =EXT3_SB (sb); -unsigned long block =le32_to_cpu (sbi->s_es->s_first_data_block); +ext3_fsblk_t block =le32_to_cpu (sbi->s_es->s_first_data_block);struct ext3_group_desc * gdp =NULL ;int desc_block =0 ;int i;
@@ -1314,15 +1315,14 @@ static loff_t ext3_max_size(int bits)return res; } -static unsigned long descriptor_loc (struct super_block *sb, -unsigned long logic_sb_block, +static ext3_fsblk_t descriptor_loc (struct super_block *sb, +ext3_fsblk_t logic_sb_block,int nr) {struct ext3_sb_info *sbi =EXT3_SB (sb); -unsigned long bg, first_data_block, first_meta_bg; +unsigned long bg, first_meta_bg;int has_super =0 ; - first_data_block =le32_to_cpu (sbi->s_es->s_first_data_block); first_meta_bg =le32_to_cpu (sbi->s_es->s_first_meta_bg); if (!EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_META_BG) ||
@@ -1331,7 +1331,7 @@ static unsigned long descriptor_loc(stru bg = sbi->s_desc_per_block * nr;if (ext3_bg_has_super (sb, bg)) has_super =1 ; -return (first_data_block + has_super + (bg * sbi->s_blocks_per_group)); +return (has_super +ext3_group_first_block_no (sb, bg)); }
@@ -1340,9 +1340,9 @@ static int ext3_fill_super (struct superstruct buffer_head * bh;struct ext3_super_block *es =NULL ;struct ext3_sb_info *sbi; -unsigned long block; -unsigned long sb_block =get_sb_block (&data); -unsigned long logic_sb_block; +ext3_fsblk_t block; +ext3_fsblk_t sb_block =get_sb_block (&data); +ext3_fsblk_t logic_sb_block;unsigned long offset =0 ;unsigned long journal_inum =0 ;unsigned long journal_devnum =0 ;
@@ -1603,6 +1603,7 @@ static int ext3_fill_super (struct super }if (!ext3_check_descriptors (sb)) {printk (KERN_ERR "EXT3-fs: group descriptors corrupted !\n" ); + goto failed_mount2; } sbi->s_gdb_count = db_count;
@@ -1839,10 +1840,10 @@ static journal_t *ext3_get_dev_journal(s {struct buffer_head * bh;journal_t *journal; -int start; +ext3_fsblk_t start;ext3_fsblk_t len;int hblock, blocksize; -unsigned long sb_block; +ext3_fsblk_t sb_block;unsigned long offset;struct ext3_super_block * es;struct block_device *bdev;
@@ -2215,7 +2216,7 @@ static int ext3_remount (struct super_bl {struct ext3_super_block * es;struct ext3_sb_info *sbi =EXT3_SB (sb); -unsigned long n_blocks_count =0 ; +ext3_fsblk_t n_blocks_count =0 ;unsigned long old_sb_flags;struct ext3_mount_options old_opts;int err;
@@ -2334,7 +2335,7 @@ static int ext3_statfs (struct super_blo {struct ext3_sb_info *sbi =EXT3_SB (sb);struct ext3_super_block *es = sbi->s_es; -unsigned long overhead; +ext3_fsblk_t overhead;int i;if (test_opt (sb,MINIX_DF ))
fs/ext3/xattr.c renamed from fs/ext3/xattr.c~ext3_convert_blks_to_fsblk_t +6 -6
@@ -233,7 +233,7 @@ ext3_xattr_block_get(struct inode *inode atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount));if (ext3_xattr_check_block (bh)) { bad_block:ext3_error (inode->i_sb, __FUNCTION__, -"inode %ld: bad block %u" , inode->i_ino, +"inode %ld: bad block " E3FSBLK , inode->i_ino,EXT3_I (inode)->i_file_acl); error = -EIO ; goto cleanup;
@@ -375,7 +375,7 @@ ext3_xattr_block_list(struct inode *inod atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount));if (ext3_xattr_check_block (bh)) {ext3_error (inode->i_sb, __FUNCTION__, -"inode %ld: bad block %u" , inode->i_ino, +"inode %ld: bad block " E3FSBLK , inode->i_ino,EXT3_I (inode)->i_file_acl); error = -EIO ; goto cleanup;
@@ -647,7 +647,7 @@ ext3_xattr_block_find(struct inode *inod le32_to_cpu(BHDR(bs->bh)->h_refcount));if (ext3_xattr_check_block (bs->bh)) {ext3_error (sb, __FUNCTION__, -"inode %ld: bad block %u" , inode->i_ino, +"inode %ld: bad block " E3FSBLK , inode->i_ino,EXT3_I (inode)->i_file_acl); error = -EIO ; goto cleanup;
@@ -848,7 +848,7 @@ cleanup_dquot: bad_block:ext3_error (inode->i_sb, __FUNCTION__, -"inode %ld: bad block %u" , inode->i_ino, +"inode %ld: bad block " E3FSBLK , inode->i_ino,EXT3_I (inode)->i_file_acl); goto cleanup;
@@ -1077,14 +1077,14 @@ ext3_xattr_delete_inode(handle_t *handle bh =sb_bread (inode->i_sb,EXT3_I (inode)->i_file_acl);if (!bh) {ext3_error (inode->i_sb, __FUNCTION__, -"inode %ld: block %u read error" , inode->i_ino, +"inode %ld: block " E3FSBLK " read error" , inode->i_ino,EXT3_I (inode)->i_file_acl); goto cleanup; }if (BHDR (bh)->h_magic !=cpu_to_le32 (EXT3_XATTR_MAGIC ) ||BHDR (bh)->h_blocks !=cpu_to_le32 (1 )) {ext3_error (inode->i_sb, __FUNCTION__, -"inode %ld: bad block %u" , inode->i_ino, +"inode %ld: bad block " E3FSBLK , inode->i_ino,EXT3_I (inode)->i_file_acl); goto cleanup; }
include/linux/ext3_fs.h renamed from include/linux/ext3_fs.h~ext3_convert_blks_to_fsblk_t +10 -2
@@ -712,6 +712,14 @@ struct dir_private_info {__u32 next_hash; }; +/* calculate the first block number of the group */ +static inline ext3_fsblk_t +ext3_group_first_block_no (struct super_block *sb,unsigned long group_no) +{ +return group_no * (ext3_fsblk_t )EXT3_BLOCKS_PER_GROUP (sb) + +le32_to_cpu (EXT3_SB (sb)->s_es->s_first_data_block); +} +/* * Special error return code only used by dx_probe() and its callers. */
@@ -741,7 +749,7 @@ extern void ext3_free_blocks (handle_t *extern void ext3_free_blocks_sb (handle_t *handle,struct super_block *sb,ext3_fsblk_t block,unsigned long count,unsigned long *pdquot_freed_blocks); -extern unsigned long ext3_count_free_blocks (struct super_block *); +extern ext3_fsblk_t ext3_count_free_blocks (struct super_block *);extern void ext3_check_blocks_bitmap (struct super_block *); extern struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb, unsigned int block_group,
@@ -813,7 +821,7 @@ extern int ext3_group_add(struct super_b struct ext3_new_group_data *input);extern int ext3_group_extend (struct super_block *sb,struct ext3_super_block *es, -unsigned long n_blocks_count); +ext3_fsblk_t n_blocks_count);/* super.c */ extern void ext3_error (struct super_block *,const char *,const char *, ...)
include/linux/ext3_fs_i.h renamed from include/linux/ext3_fs_i.h~ext3_convert_blks_to_fsblk_t +4 -4
@@ -30,8 +30,8 @@ typedef unsigned long ext3_fsblk_t;#define E3FSBLK "%lu"struct ext3_reserve_window { -__u32 _rsv_start;/* First byte reserved */ -__u32 _rsv_end;/* Last byte reserved or 0 */ +ext3_fsblk_t _rsv_start;/* First byte reserved */ +ext3_fsblk_t _rsv_end;/* Last byte reserved or 0 */ };struct ext3_reserve_window_node {
@@ -58,7 +58,7 @@ struct ext3_block_alloc_info {* allocated to this file. This give us the goal (target) for the next * allocation when we detect linearly ascending requests. */ -__u32 last_alloc_physical_block; +ext3_fsblk_t last_alloc_physical_block; };#define rsv_start rsv_window._rsv_start
@@ -75,7 +75,7 @@ struct ext3_inode_info {__u8 i_frag_no;__u8 i_frag_size;#endif -__u32 i_file_acl; +ext3_fsblk_t i_file_acl;__u32 i_dir_acl;__u32 i_dtime;
_
-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk! Fully trained technicians. The highest number of Red Hat certifications in the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642