[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-head
Subject:    ext4: Fix time encoding with extra epoch bits
From:       Linux Kernel Mailing List <linux-kernel () vger ! kernel ! org>
Date:       2009-09-30 20:59:21
Message-ID: 200909302059.n8UKxLsg020671 () hera ! kernel ! org
[Download RAW message or body]

Gitweb:     http://git.kernel.org/linus/c1fccc0696bcaff6008c11865091f5ec4b0937ab
Commit:     c1fccc0696bcaff6008c11865091f5ec4b0937ab
Parent:     0ef122494020521309be855bfdeeb41f34bf8c94
Author:     Theodore Ts'o <tytso@mit.edu>
AuthorDate: Wed Sep 30 01:13:55 2009 -0400
Committer:  Theodore Ts'o <tytso@mit.edu>
CommitDate: Wed Sep 30 01:13:55 2009 -0400

    ext4: Fix time encoding with extra epoch bits
    
    "Looking at ext4.h, I think the setting of extra time fields forgets to
    mask the epoch bits so the epoch part overwrites nsec part. The second
    change is only for coherency (2 -> EXT4_EPOCH_BITS)."
    
    Thanks to Damien Guibouret for pointing out this problem.
    
    Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
 fs/ext4/ext4.h |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index c508cf7..984ca0c 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -525,8 +525,8 @@ struct move_extent {
 static inline __le32 ext4_encode_extra_time(struct timespec *time)
 {
        return cpu_to_le32((sizeof(time->tv_sec) > 4 ?
-			   time->tv_sec >> 32 : 0) |
-			   ((time->tv_nsec << 2) & EXT4_NSEC_MASK));
+			   (time->tv_sec >> 32) & EXT4_EPOCH_MASK : 0) |
+                          ((time->tv_nsec << EXT4_EPOCH_BITS) & EXT4_NSEC_MASK));
 }
 
 static inline void ext4_decode_extra_time(struct timespec *time, __le32 extra)
@@ -534,7 +534,7 @@ static inline void ext4_decode_extra_time(struct timespec *time, __le32 extra)
        if (sizeof(time->tv_sec) > 4)
 	       time->tv_sec |= (__u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK)
 			       << 32;
-       time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> 2;
+       time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> EXT4_EPOCH_BITS;
 }
 
 #define EXT4_INODE_SET_XTIME(xtime, inode, raw_inode)			       \
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic