Attaching below patch that fix the sparse warning for ext4.
NOTE: yet to test the changes.
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 390b36d..a3ffa15 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -2567,7 +2567,7 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
/* previous routine could use block we allocated */
newblock = ext_pblock(&newex);
- allocated = newex.ee_len;
+ allocated = le16_to_cpu(newex.ee_len);
outnew:
__set_bit(BH_New, &bh_result->b_state);
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 89837eb..2136f43 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3298,12 +3298,12 @@ int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode)
iloc, handle);
if (ret) {
EXT4_I(inode)->i_state |= EXT4_STATE_NO_EXPAND;
- if (mnt_count != sbi->s_es->s_mnt_count) {
+ if (mnt_count != le16_to_cpu(sbi->s_es->s_mnt_count)) {
ext4_warning(inode->i_sb, __FUNCTION__,
"Unable to expand inode %lu. Delete"
" some EAs or run e2fsck.",
inode->i_ino);
- mnt_count = sbi->s_es->s_mnt_count;
+ mnt_count = le16_to_cpu(sbi->s_es->s_mnt_count);
}
}
}
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 7b1c640..4ece35c 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2747,7 +2747,7 @@ static int ext4_mb_read_prealloc_table(char *page, char **start,
}
static int ext4_mb_write_prealloc_table(struct file *file,
- const char *buf, unsigned long cnt, void *data)
+ const char __user *buf, unsigned long cnt, void *data)
{
struct ext4_sb_info *sbi = data;
unsigned long value;
@@ -2809,7 +2809,7 @@ static int ext4_mb_read_##name(char *page, char **start, \
#define MB_PROC_VALUE_WRITE(name) \
static int ext4_mb_write_##name(struct file *file, \
- const char *buf, unsigned long cnt, void *data) \
+ const char __user *buf, unsigned long cnt, void *data) \
{ \
struct ext4_sb_info *sbi = data; \
char str[32]; \
diff --git a/include/linux/ext4_fs.h b/include/linux/ext4_fs.h
index 81e0e8d..17afd97 100644
--- a/include/linux/ext4_fs.h
+++ b/include/linux/ext4_fs.h
@@ -156,7 +156,7 @@ struct ext4_group_desc
__le16 bg_free_blocks_count; /* Free blocks count */
__le16 bg_free_inodes_count; /* Free inodes count */
__le16 bg_used_dirs_count; /* Directories count */
- __u16 bg_flags;
+ __le16 bg_flags;
__u32 bg_reserved[2];
__le16 bg_itable_unused; /* Unused inodes count */
__le16 bg_checksum; /* crc16(sb_uuid+group+desc) */
@@ -332,7 +332,7 @@ struct ext4_inode {
__le32 i_flags; /* File flags */
union {
struct {
- __u32 l_i_version;
+ __le32 l_i_version;
} linux1;
struct {
__u32 h_i_translator;
@@ -636,13 +636,13 @@ struct ext4_super_block {
/*150*/ __le32 s_blocks_count_hi; /* Blocks count */
__le32 s_r_blocks_count_hi; /* Reserved blocks count */
__le32 s_free_blocks_count_hi; /* Free blocks count */
- __u16 s_min_extra_isize; /* All inodes have at least # bytes */
- __u16 s_want_extra_isize; /* New inodes should reserve # bytes */
- __u32 s_flags; /* Miscellaneous flags */
- __u16 s_raid_stride; /* RAID stride */
- __u16 s_mmp_interval; /* # seconds to wait in MMP checking */
- __u64 s_mmp_block; /* Block for multi-mount protection */
- __u32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/
+ __le16 s_min_extra_isize; /* All inodes have at least # bytes */
+ __le16 s_want_extra_isize; /* New inodes should reserve # bytes */
+ __le32 s_flags; /* Miscellaneous flags */
+ __le16 s_raid_stride; /* RAID stride */
+ __le16 s_mmp_interval; /* # seconds to wait in MMP checking */
+ __le64 s_mmp_block; /* Block for multi-mount protection */
+ __le32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/
__u32 s_reserved[163]; /* Padding to the end of the block */
};
On Sep 12, 2007 22:18 +0530, Aneesh Kumar K.V wrote:
> Attaching below patch that fix the sparse warning for ext4.
It would be good to also fix the "raw" access of split 48-bit and 64-bit
fields as I previously sent to the list. A new typedef for these fields
(on disk) would ensure that they are not accessed directly and give
compiler warnings if new patches don't have the right macro usage.
> - if (mnt_count != sbi->s_es->s_mnt_count) {
> + if (mnt_count != le16_to_cpu(sbi->s_es->s_mnt_count)) {
That overflows 80 columns, as do several other lines.
>
Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.
On Wed, 2007-09-12 at 18:32 -0600, Andreas Dilger wrote:
> On Sep 12, 2007 22:18 +0530, Aneesh Kumar K.V wrote:
> > Attaching below patch that fix the sparse warning for ext4.
>
> It would be good to also fix the "raw" access of split 48-bit and 64-bit
> fields as I previously sent to the list. A new typedef for these fields
> (on disk) would ensure that they are not accessed directly and give
> compiler warnings if new patches don't have the right macro usage.
>
> > - if (mnt_count != sbi->s_es->s_mnt_count) {
> > + if (mnt_count != le16_to_cpu(sbi->s_es->s_mnt_count)) {
>
> That overflows 80 columns, as do several other lines.
> >
>
checkpatch.pl should catched this... The version in ext4-patch queue
should be clean now.
> Cheers, Andreas
> --
> Andreas Dilger
> Principal Software Engineer
> Cluster File Systems, Inc.
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html