From patchwork Wed Jun 20 15:33:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 139358 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp933691lji; Wed, 20 Jun 2018 08:34:36 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJR5hnB+B41CkeVlxOPwW4olphV30ZvLEtmXoEZbtoJBezRE1mwrkvuLKcXc33CqU2WSSfL X-Received: by 2002:a17:902:8a95:: with SMTP id p21-v6mr11919365plo.91.1529508876747; Wed, 20 Jun 2018 08:34:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529508876; cv=none; d=google.com; s=arc-20160816; b=tKt1+TyLT4ksHGkmSiFRuco8+HB3YAv/Pin5kxpagXsKp3YW2+Tc6n0VWp1G781vlf ltaGX63LCOWgr3WC4S2pfzG1ilZ5m8Mf9rFvNj34qdcyT+jVbk44RAyNaPoWCDnpKGzY Fyae6bai4bulu6gwJrIunU66MPZWbFiagjE+2401ymNJot+ubNX7F2yRyHLUgEsTA6Vc MXkahl0/mmNAQ9DEosPYcF7t7W44B7YuxBBwOGEhNTIPlqTEHV1GbhzlOjbxQzgNBKFh +nroMSHLlTRGnkpj8LRlwmlErX1rylhxshwm5eVbTxyosgEYLX8d2qSQ6TFNxoqEvPbD yk6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=uB6lNjGieMhYjgw09suz8qc5mZQ4skR2q91ONxdZCjs=; b=nEc8p6fPs3qZw6DaT/D0u3AAIW3feADNflBC7psmHREIdbLQezuDVXYngWS0KQ1vVY sE8lUwMJfILFtuDuhzpDWZ6+Q3oaJwUgMiSWJ5dwpvwmjwZIY+ppXpBx59kXv469bTQy M6XR0a0/netQW8OCA4bDqx00CgbOymSZ7iyRWxmKNxh47Fl/76W8e23wL6TyZR6/wGAt vSQJIV36/i5Wtv7iMv2qHzXrxQpntbKb1pnwZ4NK23AwG73MwhjxrmryN0XUKAAcMeZj XOFhJSJOqlEPApiu624drNbaBz5rFnDsp964e/9ES7ToWjUZ+ZMg+1C006sRGeebH/WM rV6Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3-v6si2748244pla.418.2018.06.20.08.34.36; Wed, 20 Jun 2018 08:34:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754280AbeFTPee (ORCPT + 30 others); Wed, 20 Jun 2018 11:34:34 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:41555 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754243AbeFTPeb (ORCPT ); Wed, 20 Jun 2018 11:34:31 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue001 [212.227.15.129]) with ESMTPA (Nemesis) id 0MOXED-1fbQHW3kUn-005r4c; Wed, 20 Jun 2018 17:34:20 +0200 From: Arnd Bergmann To: Theodore Ts'o , Andreas Dilger , Jan Kara Cc: y2038@lists.linaro.org, linux-ext4@vger.kernel.org, Arnd Bergmann , Ross Zwisler , linux-kernel@vger.kernel.org Subject: [PATCH 4/6] ext4: use timespec64 for all inode times Date: Wed, 20 Jun 2018 17:33:01 +0200 Message-Id: <20180620153322.54221-4-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180620153322.54221-1-arnd@arndb.de> References: <20180620153322.54221-1-arnd@arndb.de> X-Provags-ID: V03:K1:OxfsEwd2qoEFU1YiFJomABpL6ZKFyn6XFKTmU1bZQlLXyf/3lVk UpGhjkg6CSa/q1vxQR9zq8/6TVZVcJPeTTRh0L0E7bLnnqCPsTaxisnSTQK+L82IrxQzMOi 88/wwsC3qYe18JC2JehKlWxWmUkcIn9hPqCBJxB9gKHnzb3KUS/fKhga5Hrnf6yWCo7UcNm 2gfiYGILzG7umwVw+ihPQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:h6bulAq365Q=:eBQxlXffo/nv9AGeA2/Jn7 ul4792VEyBkvEfoY4ZWdDCg7tJsZZ8CMRvq1B0kdpBzmFlnUu8oUft/qbvJ0pJRon4EJGtE3r mpzWI6+GsBHqtlNBUlHXJs1BfqPsvP5uSMYTw0x031qu83ERWexKa9iEioolcGYFodYg2ZCbI EbvANqpxx389zlNTLBuuxcsjADmKTrwob+OxVH8S5pqcPvu94Zw2rtP9e6AV/fcxl7Q1FQArq 3QgWdJQeqnrAQsGShOvmA/mKrSir1UaDIEhG5fhd5O64CY+oGRI9FijN9mfUF9b7kYMwPVKc7 Yco8cDJY2lnPkIFzj6O9H4pshNywRxywdcJfM8eC4OYxhUlECjzDhYiMgZhXTq1cSSZSsmV92 INOoiYI1VbYKkPrtG46J8Fh0cnTIRPM0MCEsZMTJXfBMqleH80MTbHJJjxsmwxHX8LRBovym2 q3f0fJBX8UbQHnI2IZ8nGegd/ufJGecWZlEnLcgU4KhWCY/IPBwSkGrMZOjGJdVxn7Fhnly2Q EJiC2CzhfegvHu2Iolgu59EmorIaoCcpngJ9GPIfc3bHbZFOynYfRIQK9kbhaVJUKSJBTJrxv VVhlEpwfPECwdQbqS1MX4uUfXhrm22ifAPYCbOAhuU8ExsYmUZ1U4He+TYA0NmcEC8t1Ci/KE NL0gWlOk4I2WWqBq7qxbGR1cnHKU6wLSt5h2bx73l0Im2A0YLkltDSPR1WRHidDwpPNk= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is the last missing piece for the inode times on 32-bit systems: now that VFS interfaces use timespec64, we just need to stop truncating the tv_sec values for y2038 compatibililty. Signed-off-by: Arnd Bergmann --- fs/ext4/ext4.h | 18 +++++++----------- fs/ext4/ialloc.c | 2 +- 2 files changed, 8 insertions(+), 12 deletions(-) -- 2.9.0 Reviewed-by: Andreas Dilger diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 0b127853c584..6b4f4369a08c 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -789,17 +789,16 @@ struct move_extent { * affected filesystem before 2242. */ -static inline __le32 ext4_encode_extra_time(struct timespec *time) +static inline __le32 ext4_encode_extra_time(struct timespec64 *time) { u32 extra = sizeof(time->tv_sec) > 4 ? ((time->tv_sec - (s32)time->tv_sec) >> 32) & EXT4_EPOCH_MASK : 0; return cpu_to_le32(extra | (time->tv_nsec << EXT4_EPOCH_BITS)); } -static inline void ext4_decode_extra_time(struct timespec *time, __le32 extra) +static inline void ext4_decode_extra_time(struct timespec64 *time, __le32 extra) { - if (unlikely(sizeof(time->tv_sec) > 4 && - (extra & cpu_to_le32(EXT4_EPOCH_MASK)))) { + if (unlikely(extra & cpu_to_le32(EXT4_EPOCH_MASK))) { #if 1 /* Handle legacy encoding of pre-1970 dates with epoch @@ -821,9 +820,8 @@ static inline void ext4_decode_extra_time(struct timespec *time, __le32 extra) do { \ (raw_inode)->xtime = cpu_to_le32((inode)->xtime.tv_sec); \ if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) {\ - struct timespec ts = timespec64_to_timespec((inode)->xtime); \ (raw_inode)->xtime ## _extra = \ - ext4_encode_extra_time(&ts); \ + ext4_encode_extra_time(&(inode)->xtime); \ } \ } while (0) @@ -840,10 +838,8 @@ do { \ do { \ (inode)->xtime.tv_sec = (signed)le32_to_cpu((raw_inode)->xtime); \ if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), xtime ## _extra)) { \ - struct timespec ts = timespec64_to_timespec((inode)->xtime); \ - ext4_decode_extra_time(&ts, \ + ext4_decode_extra_time(&(inode)->xtime, \ raw_inode->xtime ## _extra); \ - (inode)->xtime = timespec_to_timespec64(ts); \ } \ else \ (inode)->xtime.tv_nsec = 0; \ @@ -993,9 +989,9 @@ struct ext4_inode_info { /* * File creation time. Its function is same as that of - * struct timespec i_{a,c,m}time in the generic inode. + * struct timespec64 i_{a,c,m}time in the generic inode. */ - struct timespec i_crtime; + struct timespec64 i_crtime; /* mballoc */ struct list_head i_prealloc_list; diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index f525f909b559..8c00c871f5dc 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c @@ -1073,7 +1073,7 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir, /* This is the optimal IO size (for stat), not the fs block size */ inode->i_blocks = 0; inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); - ei->i_crtime = timespec64_to_timespec(inode->i_mtime); + ei->i_crtime = inode->i_mtime; memset(ei->i_data, 0, sizeof(ei->i_data)); ei->i_dir_start_lookup = 0;