add patch fix-warning-inside-ext4_convert_unwritten_extents_endio
[ext4-patch-queue.git] / drop-legacy-pre-1970-encoding-workaround
blob1604a098ee98c03c0f7855655ad3d1cb2c0950c3
1 ext4: drop legacy pre-1970 encoding workaround
3 Originally, support for expanded timestamps had a bug in that pre-1970
4 times were erroneously encoded as being in the the 24th century.  This
5 was fixed in commit a4dad1ae24f8 ("ext4: Fix handling of extended
6 tv_sec") which landed in 4.4.  Starting with 4.4, pre-1970 timestamps
7 were correctly encoded, but for backwards compatibility those
8 incorrectly encoded timestamps were mapped back to the pre-1970 dates.
10 Given that backwards compatibility workaround has been around for 4
11 years, and given that running e2fsck from e2fsprogs 1.43.2 and later
12 will offer to fix these timestamps (which has been released for 3
13 years), it's past time to drop the legacy workaround from the kernel.
15 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
16 ---
17  fs/ext4/ext4.h | 15 +--------------
18  1 file changed, 1 insertion(+), 14 deletions(-)
20 diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
21 index e2d8ad27f4d1..17cc2dc13174 100644
22 --- a/fs/ext4/ext4.h
23 +++ b/fs/ext4/ext4.h
24 @@ -828,21 +828,8 @@ static inline __le32 ext4_encode_extra_time(struct timespec64 *time)
25  static inline void ext4_decode_extra_time(struct timespec64 *time,
26                                           __le32 extra)
27  {
28 -       if (unlikely(extra & cpu_to_le32(EXT4_EPOCH_MASK))) {
30 -#if 1
31 -               /* Handle legacy encoding of pre-1970 dates with epoch
32 -                * bits 1,1. (This backwards compatibility may be removed
33 -                * at the discretion of the ext4 developers.)
34 -                */
35 -               u64 extra_bits = le32_to_cpu(extra) & EXT4_EPOCH_MASK;
36 -               if (extra_bits == 3 && ((time->tv_sec) & 0x80000000) != 0)
37 -                       extra_bits = 0;
38 -               time->tv_sec += extra_bits << 32;
39 -#else
40 +       if (unlikely(extra & cpu_to_le32(EXT4_EPOCH_MASK)))
41                 time->tv_sec += (u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK) << 32;
42 -#endif
43 -       }
44         time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> EXT4_EPOCH_BITS;
45  }