From: Dave Kleikamp <shaggy@austin.ibm.com>
To: Andrew Morton <akpm@osdl.org>
Cc: ext4 development <linux-ext4@vger.kernel.org>,
Dave Kleikamp <shaggy@austin.ibm.com>,
linux-kernel@vger.kernel.org
Subject: [RFC:PATCH 002/002] EXT3: Fix sparse warnings
Date: Fri, 8 Sep 2006 15:39:30 -0600 [thread overview]
Message-ID: <20060908213927.11498.18166.sendpatchset@kleikamp.austin.ibm.com> (raw)
In-Reply-To: <20060908213914.11498.3272.sendpatchset@kleikamp.austin.ibm.com>
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>
---
diff -Nurp linux001/fs/ext3/resize.c linux002/fs/ext3/resize.c
--- linux001/fs/ext3/resize.c 2006-09-08 07:24:23.000000000 -0500
+++ linux002/fs/ext3/resize.c 2006-09-08 16:25:07.000000000 -0500
@@ -336,7 +336,7 @@ static int verify_reserved_gdb(struct su
unsigned five = 5;
unsigned seven = 7;
unsigned grp;
- __u32 *p = (__u32 *)primary->b_data;
+ __le32 *p = (__le32 *)primary->b_data;
int gdbackups = 0;
while ((grp = ext3_list_backups(sb, &three, &five, &seven)) < end) {
@@ -380,7 +380,7 @@ static int add_new_gdb(handle_t *handle,
struct buffer_head *dind;
int gdbackups;
struct ext3_iloc iloc;
- __u32 *data;
+ __le32 *data;
int err;
if (test_opt(sb, DEBUG))
@@ -410,14 +410,14 @@ static int add_new_gdb(handle_t *handle,
goto exit_bh;
}
- data = EXT3_I(inode)->i_data + EXT3_DIND_BLOCK;
+ data = (__le32 *)(EXT3_I(inode)->i_data + EXT3_DIND_BLOCK);
dind = sb_bread(sb, le32_to_cpu(*data));
if (!dind) {
err = -EIO;
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) {
ext3_warning(sb, __FUNCTION__,
"new group %u GDT block "E3FSBLK" not reserved",
@@ -519,7 +519,7 @@ static int reserve_backup_gdb(handle_t *
struct buffer_head *dind;
struct ext3_iloc iloc;
ext3_fsblk_t blk;
- __u32 *data, *end;
+ __le32 *data, *end;
int gdbackups = 0;
int res, i;
int err;
@@ -528,7 +528,7 @@ static int reserve_backup_gdb(handle_t *
if (!primary)
return -ENOMEM;
- data = EXT3_I(inode)->i_data + EXT3_DIND_BLOCK;
+ data = (__le32 *)(EXT3_I(inode)->i_data + EXT3_DIND_BLOCK);
dind = sb_bread(sb, le32_to_cpu(*data));
if (!dind) {
err = -EIO;
@@ -536,8 +536,8 @@ static int reserve_backup_gdb(handle_t *
}
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;
- end = (__u32 *)dind->b_data + EXT3_ADDR_PER_BLOCK(sb);
+ data = (__le32 *)dind->b_data + EXT3_SB(sb)->s_gdb_count;
+ end = (__le32 *)dind->b_data + EXT3_ADDR_PER_BLOCK(sb);
/* Get each reserved primary GDT block and verify it holds backups */
for (res = 0; res < reserved_gdb; res++, blk++) {
@@ -545,7 +545,8 @@ static int reserve_backup_gdb(handle_t *
ext3_warning(sb, __FUNCTION__,
"reserved block "E3FSBLK
" not at offset %ld",
- blk, (long)(data - (__u32 *)dind->b_data));
+ blk,
+ (long)(data - (__le32 *)dind->b_data));
err = -EINVAL;
goto exit_bh;
}
@@ -560,7 +561,7 @@ static int reserve_backup_gdb(handle_t *
goto exit_bh;
}
if (++data >= end)
- data = (__u32 *)dind->b_data;
+ data = (__le32 *)dind->b_data;
}
for (i = 0; i < reserved_gdb; i++) {
@@ -584,7 +585,7 @@ static int reserve_backup_gdb(handle_t *
blk = input->group * EXT3_BLOCKS_PER_GROUP(sb);
for (i = 0; i < reserved_gdb; i++) {
int err2;
- data = (__u32 *)primary[i]->b_data;
+ data = (__le32 *)primary[i]->b_data;
/* printk("reserving backup %lu[%u] = %lu\n",
primary[i]->b_blocknr, gdbackups,
blk + primary[i]->b_blocknr); */
@@ -689,7 +690,7 @@ exit_err:
"can't update backup for group %d (err %d), "
"forcing fsck on next reboot", group, err);
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);
}
}
diff -Nurp linux001/fs/ext3/super.c linux002/fs/ext3/super.c
--- linux001/fs/ext3/super.c 2006-09-08 16:25:07.000000000 -0500
+++ linux002/fs/ext3/super.c 2006-09-08 16:25:07.000000000 -0500
@@ -2330,13 +2330,14 @@ static int ext3_remount (struct super_bl
ext3_mark_recovery_complete(sb, es);
} else {
- __le32 ret;
- if ((ret = EXT3_HAS_RO_COMPAT_FEATURE(sb,
+ int ret;
+ __le32 ret_le;
+ if ((ret_le = EXT3_HAS_RO_COMPAT_FEATURE(sb,
~EXT3_FEATURE_RO_COMPAT_SUPP))) {
printk(KERN_WARNING "EXT3-fs: %s: couldn't "
"remount RDWR because of unsupported "
"optional features (%x).\n",
- sb->s_id, le32_to_cpu(ret));
+ sb->s_id, le32_to_cpu(ret_le));
err = -EROFS;
goto restore_opts;
}
diff -Nurp linux001/fs/jbd/journal.c linux002/fs/jbd/journal.c
--- linux001/fs/jbd/journal.c 2006-09-08 16:25:07.000000000 -0500
+++ linux002/fs/jbd/journal.c 2006-09-08 16:25:07.000000000 -0500
@@ -1094,7 +1094,7 @@ int journal_load(journal_t *journal)
/*
* 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)
return err;
diff -Nurp linux001/include/linux/ext3_fs.h linux002/include/linux/ext3_fs.h
--- linux001/include/linux/ext3_fs.h 2006-09-08 16:25:07.000000000 -0500
+++ linux002/include/linux/ext3_fs.h 2006-09-08 16:25:07.000000000 -0500
@@ -481,7 +481,7 @@ struct ext3_super_block {
*/
__u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
__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.
*/
--
David Kleikamp
IBM Linux Technology Center
next prev parent reply other threads:[~2006-09-08 21:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-08 21:39 [RFC:PATCH 000/002] EXT3: cleanups in preparation for ext4 clone Dave Kleikamp
2006-09-08 21:39 ` [RFC:PATCH 001/002] EXT3: More whitespace cleanups Dave Kleikamp
2006-09-08 21:39 ` Dave Kleikamp [this message]
2006-09-08 22:17 ` [RFC:PATCH 002/002] EXT3: Fix sparse warnings Alexey Dobriyan
2006-09-10 14:31 ` Dave Kleikamp
2006-09-08 21:56 ` [RFC:PATCH 000/002] EXT3: cleanups in preparation for ext4 clone Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060908213927.11498.18166.sendpatchset@kleikamp.austin.ibm.com \
--to=shaggy@austin.ibm.com \
--cc=akpm@osdl.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox