提交 a4e4de36 编写于 作者: D Dave Kleikamp 提交者: Linus Torvalds

[PATCH] ext3: Fix sparse warnings

Fixing up some endian-ness warnings in preparation to clone ext4 from ext3.
Signed-off-by: NDave Kleikamp <shaggy@austin.ibm.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 e9ad5620
...@@ -336,7 +336,7 @@ static int verify_reserved_gdb(struct super_block *sb, ...@@ -336,7 +336,7 @@ static int verify_reserved_gdb(struct super_block *sb,
unsigned five = 5; unsigned five = 5;
unsigned seven = 7; unsigned seven = 7;
unsigned grp; unsigned grp;
__u32 *p = (__u32 *)primary->b_data; __le32 *p = (__le32 *)primary->b_data;
int gdbackups = 0; int gdbackups = 0;
while ((grp = ext3_list_backups(sb, &three, &five, &seven)) < end) { while ((grp = ext3_list_backups(sb, &three, &five, &seven)) < end) {
...@@ -380,7 +380,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode, ...@@ -380,7 +380,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
struct buffer_head *dind; struct buffer_head *dind;
int gdbackups; int gdbackups;
struct ext3_iloc iloc; struct ext3_iloc iloc;
__u32 *data; __le32 *data;
int err; int err;
if (test_opt(sb, DEBUG)) if (test_opt(sb, DEBUG))
...@@ -417,7 +417,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode, ...@@ -417,7 +417,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
goto exit_bh; goto exit_bh;
} }
data = (__u32 *)dind->b_data; data = (__le32 *)dind->b_data;
if (le32_to_cpu(data[gdb_num % EXT3_ADDR_PER_BLOCK(sb)]) != gdblock) { if (le32_to_cpu(data[gdb_num % EXT3_ADDR_PER_BLOCK(sb)]) != gdblock) {
ext3_warning(sb, __FUNCTION__, ext3_warning(sb, __FUNCTION__,
"new group %u GDT block "E3FSBLK" not reserved", "new group %u GDT block "E3FSBLK" not reserved",
...@@ -519,7 +519,7 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode, ...@@ -519,7 +519,7 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode,
struct buffer_head *dind; struct buffer_head *dind;
struct ext3_iloc iloc; struct ext3_iloc iloc;
ext3_fsblk_t blk; ext3_fsblk_t blk;
__u32 *data, *end; __le32 *data, *end;
int gdbackups = 0; int gdbackups = 0;
int res, i; int res, i;
int err; int err;
...@@ -536,8 +536,8 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode, ...@@ -536,8 +536,8 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode,
} }
blk = EXT3_SB(sb)->s_sbh->b_blocknr + 1 + EXT3_SB(sb)->s_gdb_count; blk = EXT3_SB(sb)->s_sbh->b_blocknr + 1 + EXT3_SB(sb)->s_gdb_count;
data = (__u32 *)dind->b_data + EXT3_SB(sb)->s_gdb_count; data = (__le32 *)dind->b_data + EXT3_SB(sb)->s_gdb_count;
end = (__u32 *)dind->b_data + EXT3_ADDR_PER_BLOCK(sb); end = (__le32 *)dind->b_data + EXT3_ADDR_PER_BLOCK(sb);
/* Get each reserved primary GDT block and verify it holds backups */ /* Get each reserved primary GDT block and verify it holds backups */
for (res = 0; res < reserved_gdb; res++, blk++) { for (res = 0; res < reserved_gdb; res++, blk++) {
...@@ -545,7 +545,8 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode, ...@@ -545,7 +545,8 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode,
ext3_warning(sb, __FUNCTION__, ext3_warning(sb, __FUNCTION__,
"reserved block "E3FSBLK "reserved block "E3FSBLK
" not at offset %ld", " not at offset %ld",
blk, (long)(data - (__u32 *)dind->b_data)); blk,
(long)(data - (__le32 *)dind->b_data));
err = -EINVAL; err = -EINVAL;
goto exit_bh; goto exit_bh;
} }
...@@ -560,7 +561,7 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode, ...@@ -560,7 +561,7 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode,
goto exit_bh; goto exit_bh;
} }
if (++data >= end) if (++data >= end)
data = (__u32 *)dind->b_data; data = (__le32 *)dind->b_data;
} }
for (i = 0; i < reserved_gdb; i++) { for (i = 0; i < reserved_gdb; i++) {
...@@ -584,7 +585,7 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode, ...@@ -584,7 +585,7 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode,
blk = input->group * EXT3_BLOCKS_PER_GROUP(sb); blk = input->group * EXT3_BLOCKS_PER_GROUP(sb);
for (i = 0; i < reserved_gdb; i++) { for (i = 0; i < reserved_gdb; i++) {
int err2; int err2;
data = (__u32 *)primary[i]->b_data; data = (__le32 *)primary[i]->b_data;
/* printk("reserving backup %lu[%u] = %lu\n", /* printk("reserving backup %lu[%u] = %lu\n",
primary[i]->b_blocknr, gdbackups, primary[i]->b_blocknr, gdbackups,
blk + primary[i]->b_blocknr); */ blk + primary[i]->b_blocknr); */
...@@ -689,7 +690,7 @@ static void update_backups(struct super_block *sb, ...@@ -689,7 +690,7 @@ static void update_backups(struct super_block *sb,
"can't update backup for group %d (err %d), " "can't update backup for group %d (err %d), "
"forcing fsck on next reboot", group, err); "forcing fsck on next reboot", group, err);
sbi->s_mount_state &= ~EXT3_VALID_FS; sbi->s_mount_state &= ~EXT3_VALID_FS;
sbi->s_es->s_state &= ~cpu_to_le16(EXT3_VALID_FS); sbi->s_es->s_state &= cpu_to_le16(~EXT3_VALID_FS);
mark_buffer_dirty(sbi->s_sbh); mark_buffer_dirty(sbi->s_sbh);
} }
} }
......
...@@ -2348,10 +2348,8 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data) ...@@ -2348,10 +2348,8 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)
*/ */
ext3_clear_journal_err(sb, es); ext3_clear_journal_err(sb, es);
sbi->s_mount_state = le16_to_cpu(es->s_state); sbi->s_mount_state = le16_to_cpu(es->s_state);
if ((ret = ext3_group_extend(sb, es, n_blocks_count))) { if ((err = ext3_group_extend(sb, es, n_blocks_count)))
err = ret;
goto restore_opts; goto restore_opts;
}
if (!ext3_setup_super (sb, es, 0)) if (!ext3_setup_super (sb, es, 0))
sb->s_flags &= ~MS_RDONLY; sb->s_flags &= ~MS_RDONLY;
} }
......
...@@ -1094,7 +1094,7 @@ int journal_load(journal_t *journal) ...@@ -1094,7 +1094,7 @@ int journal_load(journal_t *journal)
/* /*
* Create a slab for this blocksize * Create a slab for this blocksize
*/ */
err = journal_create_jbd_slab(cpu_to_be32(sb->s_blocksize)); err = journal_create_jbd_slab(be32_to_cpu(sb->s_blocksize));
if (err) if (err)
return err; return err;
......
...@@ -460,7 +460,7 @@ struct ext3_super_block { ...@@ -460,7 +460,7 @@ struct ext3_super_block {
*/ */
__u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/ __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
__u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */ __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
__u16 s_reserved_gdt_blocks; /* Per group desc for online growth */ __le16 s_reserved_gdt_blocks; /* Per group desc for online growth */
/* /*
* Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set. * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set.
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册