Skip to content

Commit a4e4de3

Browse files
Dave KleikampLinus Torvalds
authored andcommitted
[PATCH] ext3: Fix sparse warnings
Fixing up some endian-ness warnings in preparation to clone ext4 from ext3. Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent e9ad562 commit a4e4de3

4 files changed

Lines changed: 14 additions & 15 deletions

File tree

‎fs/ext3/resize.c‎

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ static int verify_reserved_gdb(struct super_block *sb,
336336
unsigned five = 5;
337337
unsigned seven = 7;
338338
unsigned grp;
339-
__u32 *p = (__u32 *)primary->b_data;
339+
__le32 *p = (__le32 *)primary->b_data;
340340
int gdbackups = 0;
341341

342342
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,
380380
struct buffer_head *dind;
381381
int gdbackups;
382382
struct ext3_iloc iloc;
383-
__u32 *data;
383+
__le32 *data;
384384
int err;
385385

386386
if (test_opt(sb, DEBUG))
@@ -417,7 +417,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
417417
goto exit_bh;
418418
}
419419

420-
data = (__u32 *)dind->b_data;
420+
data = (__le32 *)dind->b_data;
421421
if (le32_to_cpu(data[gdb_num % EXT3_ADDR_PER_BLOCK(sb)]) != gdblock) {
422422
ext3_warning(sb, __FUNCTION__,
423423
"new group %u GDT block "E3FSBLK" not reserved",
@@ -519,7 +519,7 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode,
519519
struct buffer_head *dind;
520520
struct ext3_iloc iloc;
521521
ext3_fsblk_t blk;
522-
__u32 *data, *end;
522+
__le32 *data, *end;
523523
int gdbackups = 0;
524524
int res, i;
525525
int err;
@@ -536,16 +536,17 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode,
536536
}
537537

538538
blk = EXT3_SB(sb)->s_sbh->b_blocknr + 1 + EXT3_SB(sb)->s_gdb_count;
539-
data = (__u32 *)dind->b_data + EXT3_SB(sb)->s_gdb_count;
540-
end = (__u32 *)dind->b_data + EXT3_ADDR_PER_BLOCK(sb);
539+
data = (__le32 *)dind->b_data + EXT3_SB(sb)->s_gdb_count;
540+
end = (__le32 *)dind->b_data + EXT3_ADDR_PER_BLOCK(sb);
541541

542542
/* Get each reserved primary GDT block and verify it holds backups */
543543
for (res = 0; res < reserved_gdb; res++, blk++) {
544544
if (le32_to_cpu(*data) != blk) {
545545
ext3_warning(sb, __FUNCTION__,
546546
"reserved block "E3FSBLK
547547
" not at offset %ld",
548-
blk, (long)(data - (__u32 *)dind->b_data));
548+
blk,
549+
(long)(data - (__le32 *)dind->b_data));
549550
err = -EINVAL;
550551
goto exit_bh;
551552
}
@@ -560,7 +561,7 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode,
560561
goto exit_bh;
561562
}
562563
if (++data >= end)
563-
data = (__u32 *)dind->b_data;
564+
data = (__le32 *)dind->b_data;
564565
}
565566

566567
for (i = 0; i < reserved_gdb; i++) {
@@ -584,7 +585,7 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode,
584585
blk = input->group * EXT3_BLOCKS_PER_GROUP(sb);
585586
for (i = 0; i < reserved_gdb; i++) {
586587
int err2;
587-
data = (__u32 *)primary[i]->b_data;
588+
data = (__le32 *)primary[i]->b_data;
588589
/* printk("reserving backup %lu[%u] = %lu\n",
589590
primary[i]->b_blocknr, gdbackups,
590591
blk + primary[i]->b_blocknr); */
@@ -689,7 +690,7 @@ static void update_backups(struct super_block *sb,
689690
"can't update backup for group %d (err %d), "
690691
"forcing fsck on next reboot", group, err);
691692
sbi->s_mount_state &= ~EXT3_VALID_FS;
692-
sbi->s_es->s_state &= ~cpu_to_le16(EXT3_VALID_FS);
693+
sbi->s_es->s_state &= cpu_to_le16(~EXT3_VALID_FS);
693694
mark_buffer_dirty(sbi->s_sbh);
694695
}
695696
}

‎fs/ext3/super.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2348,10 +2348,8 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)
23482348
*/
23492349
ext3_clear_journal_err(sb, es);
23502350
sbi->s_mount_state = le16_to_cpu(es->s_state);
2351-
if ((ret = ext3_group_extend(sb, es, n_blocks_count))) {
2352-
err = ret;
2351+
if ((err = ext3_group_extend(sb, es, n_blocks_count)))
23532352
goto restore_opts;
2354-
}
23552353
if (!ext3_setup_super (sb, es, 0))
23562354
sb->s_flags &= ~MS_RDONLY;
23572355
}

‎fs/jbd/journal.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ int journal_load(journal_t *journal)
10941094
/*
10951095
* Create a slab for this blocksize
10961096
*/
1097-
err = journal_create_jbd_slab(cpu_to_be32(sb->s_blocksize));
1097+
err = journal_create_jbd_slab(be32_to_cpu(sb->s_blocksize));
10981098
if (err)
10991099
return err;
11001100

‎include/linux/ext3_fs.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ struct ext3_super_block {
460460
*/
461461
__u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
462462
__u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
463-
__u16 s_reserved_gdt_blocks; /* Per group desc for online growth */
463+
__le16 s_reserved_gdt_blocks; /* Per group desc for online growth */
464464
/*
465465
* Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set.
466466
*/

0 commit comments

Comments
 (0)