Sparse endian issues with patches.
Attaching below patch that fix the sparse warning for ext4.
NOTE: yet to test the changes.
fs/ext4/extents.c +0 -0
@@ -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);
fs/ext4/inode.c +0 -0
@@ -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);
}
}
}fs/ext4/mballoc.c +0 -0
@@ -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]; \include/linux/ext4_fs.h +0 -0
@@ -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 */
};
Quoted 1 line · Aneesh Kumar K.V
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.
Review
Quoted 2 lines
(quoted diff) +1
-1- 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.
Quoted 1 line
Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.
Quoted 8 lines · Andreas Dilger
Quoted 1 line · Aneesh Kumar K.V
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.
Quoted 6 lines
Review
Quoted 2 lines
(quoted diff) +1
-1- 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.
Quoted 1 line
checkpatch.pl should catched this... The version in ext4-patch queue should be clean now.
Quoted 10 lines
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