Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 1020

kernel-2.6.18-238.el5.src.rpm

From: Eric Sandeen <sandeen@redhat.com>
Date: Mon, 22 Sep 2008 14:59:19 -0500
Subject: [fs] ext4: fix warning on x86_64 build
Message-id: 48D7F917.6010006@redhat.com
O-Subject: [RHEL5.3 PATCH] ext4: fix warning on x86_64 build
Bugzilla: 463277
RH-Acked-by: Peter Staubach <staubach@redhat.com>
RH-Acked-by: Rik van Riel <riel@redhat.com>
RH-Acked-by: Eugene Teo <eteo@redhat.com>

For bug #463277

The ext4 code generates a warning when built on x86:

fs/ext4/inode.c: In function 'ext4_do_update_inode':
fs/ext4/inode.c:3047: warning: right shift count >= width of type

This is because upstream, the vfs i_version is a long long, but in rhel5 it's
only a long (so 32 bits on 32 bit machines) and we over-shift in that case.

Even though a 32-bit i_version might not be terribly useful for the intended
purpose, this should probably be fixed to avoid unexpected results.

Thanks,
-Eric

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index a0cac14..a33448a 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3043,8 +3043,13 @@ static int ext4_do_update_inode(handle_t *handle,
 	raw_inode->i_disk_version = cpu_to_le32(inode->i_version);
 	if (ei->i_extra_isize) {
 		if (EXT4_FITS_IN_INODE(raw_inode, ei, i_version_hi))
+			/* in RHEL5 i_version is an unsigned long */
+#if BITS_PER_LONG == 64
 			raw_inode->i_version_hi =
 			cpu_to_le32(inode->i_version >> 32);
+#else
+			raw_inode->i_version_hi = 0;
+#endif
 		raw_inode->i_extra_isize = cpu_to_le16(ei->i_extra_isize);
 	}