All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: valerie.clement@bull.net, Andreas Dilger <adilger@clusterfs.com>,
	Mingming Cao <cmm@us.ibm.com>
Cc: linux-ext4 <linux-ext4@vger.kernel.org>
Subject: Sparse endian issues with patches.
Date: Wed, 12 Sep 2007 22:18:39 +0530	[thread overview]
Message-ID: <46E81867.1000606@linux.vnet.ibm.com> (raw)

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 */
 };
 

             reply	other threads:[~2007-09-12 16:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-12 16:48 Aneesh Kumar K.V [this message]
2007-09-13  0:32 ` Sparse endian issues with patches Andreas Dilger
2007-09-13  0:36   ` Mingming Cao

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=46E81867.1000606@linux.vnet.ibm.com \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=adilger@clusterfs.com \
    --cc=cmm@us.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=valerie.clement@bull.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.