Sophie

Sophie

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

kernel-2.6.18-238.el5.src.rpm

From: Eric Sandeen <sandeen@redhat.com>
Date: Tue, 5 May 2009 11:17:50 -0500
Subject: [fs] ext4: re-fix warning on x86 build
Message-id: 4A0066AE.6070402@redhat.com
O-Subject: [PATCH RHEL5.4 V2] ext4: re-fix warning on x86 build
Bugzilla: 499202
RH-Acked-by: Peter Staubach <staubach@redhat.com>
RH-Acked-by: Zachary Amsden <zamsden@redhat.com>

(resend with proper subject so Don sees it, oops)

For bug 499202 - New compilation warning in ext4 rebase

(A little embarassing since I re-introduced this one)

The ext4 code generates a warning when built on x86:

fs/ext4/inode.c: In function 'ext4_do_update_inode':
fs/ext4/inode.c:4521: 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 e678f99..75546bd 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4517,8 +4517,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);
 	}