diff options
author | Theodore Ts'o <tytso@mit.edu> | 2009-09-30 01:13:55 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-09-30 01:13:55 -0400 |
commit | c1fccc0696bcaff6008c11865091f5ec4b0937ab (patch) | |
tree | 0e8269e07d40278c136b7f93aba7ab118f75f532 /fs/ext4 | |
parent | 0ef122494020521309be855bfdeeb41f34bf8c94 (diff) |
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>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | 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 c508cf7be75c..984ca0cb38c3 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -525,8 +525,8 @@ struct move_extent { | |||
525 | static inline __le32 ext4_encode_extra_time(struct timespec *time) | 525 | static inline __le32 ext4_encode_extra_time(struct timespec *time) |
526 | { | 526 | { |
527 | return cpu_to_le32((sizeof(time->tv_sec) > 4 ? | 527 | return cpu_to_le32((sizeof(time->tv_sec) > 4 ? |
528 | time->tv_sec >> 32 : 0) | | 528 | (time->tv_sec >> 32) & EXT4_EPOCH_MASK : 0) | |
529 | ((time->tv_nsec << 2) & EXT4_NSEC_MASK)); | 529 | ((time->tv_nsec << EXT4_EPOCH_BITS) & EXT4_NSEC_MASK)); |
530 | } | 530 | } |
531 | 531 | ||
532 | static inline void ext4_decode_extra_time(struct timespec *time, __le32 extra) | 532 | 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) | |||
534 | if (sizeof(time->tv_sec) > 4) | 534 | if (sizeof(time->tv_sec) > 4) |
535 | time->tv_sec |= (__u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK) | 535 | time->tv_sec |= (__u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK) |
536 | << 32; | 536 | << 32; |
537 | time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> 2; | 537 | time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> EXT4_EPOCH_BITS; |
538 | } | 538 | } |
539 | 539 | ||
540 | #define EXT4_INODE_SET_XTIME(xtime, inode, raw_inode) \ | 540 | #define EXT4_INODE_SET_XTIME(xtime, inode, raw_inode) \ |