From patchwork Wed Jun 20 14:34:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 139352 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp867518lji; Wed, 20 Jun 2018 07:35:14 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ8R7PbJ0DRzi4eXRX+Wm5pWuHuE6bcwgjkfczzumyhIfkzomrRJ0dLZuJE2F6hlhZvaP3d X-Received: by 2002:a62:90db:: with SMTP id q88-v6mr23274773pfk.186.1529505313979; Wed, 20 Jun 2018 07:35:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529505313; cv=none; d=google.com; s=arc-20160816; b=lfd3fYw342nKlqp6j8HM8PGJI5iHP6BJp3oDkqg5DejaD3uciLf9ldkw7gtt8xqLso /l/EdlNAf7kRJKjfdJOu9MRtRl7jV5LvR7/QrBR+09NDVKJ5QQ8KEsyYmBVsvEfYgJVr 40HquHngYKnAMXtOTj81rcYWaJJJd3dsazC9tNMA7Xbn4l3gfvcme/iHDRbWVMUbOp9V Y3zVD2kApINYai8/5YYFM36VrYWQ6NK+5HVAISZGq0l6tQfKMa18HrcH5WzIvH0t7Ux1 hB+w5cDzbZ66RLu29f+3Zqipt/NcKM0gsIxxdh+49EmsiqhRmJJKCnkG4gSXEKoCYW3s Hi5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=JQ4S1UcL5ZqGuznQSNsf1lmHWyFRxdMJfUxjrpB2ZHI=; b=ub37BFPWycAJveFO8tK+RQQY2clr5Td0HEIIwcVKb4bJB95YRndDmos1+I46Z7WIvR hqZy2kjbQKx1bGbhqcqhZYCToQvxICphZZY+FMXT9kXmK2Zt4uxKJqG8NMghh/0DDOfE O1hsy3ZY+5W/23rbZHrbgflMdCMdeakKKQpZ2Y9Lg/a7Z2xCHxZke7PzSMmeCqua+Q0M R7hukbThMPKC12xzo8j8aCPbf07/ts8KMHHS+RvTdXDCS9g9w+QJ1IvkMeSobUnrUrTN jZjcTzRBRvsH57jzvLy+CYGzaxEUiQHNkkzFo3yf0S+WSzHrQyFyOBJmGzFsU23iyCq7 j1PA== 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 b2-v6si2420599plx.88.2018.06.20.07.35.13; Wed, 20 Jun 2018 07:35:13 -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 S1754153AbeFTOfL (ORCPT + 30 others); Wed, 20 Jun 2018 10:35:11 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:52403 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753202AbeFTOfK (ORCPT ); Wed, 20 Jun 2018 10:35:10 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.145]) with ESMTPA (Nemesis) id 0M3dNR-1gMn0s1RQH-00rDit; Wed, 20 Jun 2018 16:34:51 +0200 From: Arnd Bergmann To: Chris Mason , Josef Bacik , David Sterba Cc: y2038@lists.linaro.org, Arnd Bergmann , Qu Wenruo , Nikolay Borisov , Anand Jain , Liu Bo , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] btrfs: use monotonic time for transaction handling Date: Wed, 20 Jun 2018 16:34:32 +0200 Message-Id: <20180620143448.44388-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K1:MtvJ2iFA9/LaYZd1ruuHDxsLXAOCr+xAiDICHrxoScZxVLigjuM sosnnngWe5MtmRv21mB1rybde/V8XsTaVO6retjpOUQisaav+U49EVeTlRuU8DCfuINulCy lCqGmA+nsE174ZEHbECaMBcs0270OuVIGuKJ7c5J6wEdW6DfXyI/v9wFE9099h4TSdveySz E8HcsaZTAndvMTwoyIx3A== X-UI-Out-Filterresults: notjunk:1; V01:K0:5HUJBgJCYTw=:/J/KS3M5coxrRiZ/V+QM41 563/SwIgYY30v+0PIYzrqyWEfykJbf9VKRgCDDMPSYE5O/+h3OIDE4+AyQMvwTnUm9YBvhEWZ Y2CrPzk4ru9z2gNLSLwwutuSugDNsZzzHrT1qUCKQtz5eNp8WaRPI4WvM7pSa65FUdUMOtUHz 6ulN4nZECmO1R+ALqcmSOd0SHZ1ogoB82uqvvLglC+LI4bn9yug3gt3kivlBxnQDCnGKgIJIL 0r17Exq3ap8c5G4rLN5Xk4mBZ4od2YSZtYFxhys5/jcNyWyqCVbgNYjyAPZnKm3YekXpI+t6Z unpndKUXl46tYeraToRV1WE/h8sqz2JIb22r1jVlkXK9V+gGz95QcmcbZ5KTFqTGyZXDtbVZx cF2xGqcpfpkjWCmmelxLhjIFWKCqMLqCHOlhBt0+5BOFJuevI534OfDc9hVFKTX1+ve/dJS4q 1c3Ikv6wFsv9FCqgLmnEWlHYUUILBF98TLHUM7eABWzPrhx+ISWzarjSj2/CgcMTtmlP3YTXJ KV37v3KlbXpEXSlh5Fr2G3g6KI/gB3OQevuxvNqTqKc4DqiPEGzEMXXqMgiXJjp68b4DOKPSw kIteuOPAo52Ax6zWWDVNtU894/Etx3lO2jFuTVS6bYTde7e2djloVZUEbAfLWhJ5Lz9MwpkA5 BlROkHkKJm60GsdirUK5HgVRMjVyy1Oi/oPLfXtw+owMpx7HPJgYbh0qLN5z/NaFLf4U= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org get_seconds() is deprecated because of the overflow of 32-bit times, and it's not the best choice for measuring time intervals because it can go backwards or jump due to settimeofday() or leap seconds. This changes the transaction handling to instead use ktime_get_seconds(), which returns a CLOCK_MONOTONIC timestamp that has neither of those problems. Signed-off-by: Arnd Bergmann --- fs/btrfs/disk-io.c | 4 ++-- fs/btrfs/transaction.c | 2 +- fs/btrfs/transaction.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) -- 2.9.0 diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 205092dc9390..bf0717f2824d 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1803,7 +1803,7 @@ static int transaction_kthread(void *arg) struct btrfs_trans_handle *trans; struct btrfs_transaction *cur; u64 transid; - unsigned long now; + time64_t now; unsigned long delay; bool cannot_commit; @@ -1819,7 +1819,7 @@ static int transaction_kthread(void *arg) goto sleep; } - now = get_seconds(); + now = ktime_get_seconds(); if (cur->state < TRANS_STATE_BLOCKED && !test_bit(BTRFS_FS_NEED_ASYNC_COMMIT, &fs_info->flags) && (now < cur->start_time || diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index ff5f6c719976..ebe50dfb8947 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -241,7 +241,7 @@ static noinline int join_transaction(struct btrfs_fs_info *fs_info, refcount_set(&cur_trans->use_count, 2); atomic_set(&cur_trans->pending_ordered, 0); cur_trans->flags = 0; - cur_trans->start_time = get_seconds(); + cur_trans->start_time = ktime_get_seconds(); memset(&cur_trans->delayed_refs, 0, sizeof(cur_trans->delayed_refs)); diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h index 94439482a0ec..4cbb1b55387d 100644 --- a/fs/btrfs/transaction.h +++ b/fs/btrfs/transaction.h @@ -48,7 +48,7 @@ struct btrfs_transaction { int aborted; struct list_head list; struct extent_io_tree dirty_pages; - unsigned long start_time; + time64_t start_time; wait_queue_head_t writer_wait; wait_queue_head_t commit_wait; wait_queue_head_t pending_wait; From patchwork Wed Jun 20 14:34:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 139353 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp867630lji; Wed, 20 Jun 2018 07:35:21 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLdYlIOIjaRBPYnkRnrch5Aup1xGSkhFMeO3r0afSoMwquKvDXT8dG19L6vfhubHsYrWfN7 X-Received: by 2002:a62:d97:: with SMTP id 23-v6mr23272476pfn.202.1529505321503; Wed, 20 Jun 2018 07:35:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529505321; cv=none; d=google.com; s=arc-20160816; b=sFrOtCFiCBjGgb0g6FKKlT0q5KfuuHuES2TVNu0E/3F6iUZgRRdJcDXgL54anOXUsD DBZxDP3WWNyjz84mb/+j4WOCmq36k752gXQNPTHY/WUbvmhT6lR1lXrm7WFEmq1aGL2w HiRprPizuew9FTlJtwvJSdk4A1rXk+CMEZ+9LFnWvbI6V0Eyt6AlzXuUm6HgA2Ocy3El uHdHfAjzDIVCq/Kxkd/AOEB0WJ5s/5B2Z5baU42KD3RQrAR7svk+z+yCHBMRkrarzoKJ TZMxbC5Hnw+TPZjA1uYuYS+klDa0UUnxADND17OvaXcyYfyACHZPUoqP9pkEyHf+KQ4K wy0Q== 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=Mq1cnzK0EW9w6NodfoTkwbfMFy9Z9SZW9jG8aVVR9F8=; b=whq/hdvvHPk50+57xA55pjjHxHTfT6hd8rW5vdsg9zCUBmRAtDg4vcgHqoBylaaHC8 BpldgFPcCK31xhwzprIHndXPopPyyBdsyPvwRNoX45QBI7IgvtKmFsYcQFybxxqUpo3Y cJHlhwNlHK3DmR5NQUEdiTiSZ52pkFf+AVqiyk45+EeWtSXGKB5huUU/o9QFfJDFOPRy qkF2jo/4RGZ5Ohetq/cYoL88OPZXAD3+Bd2knQyAKN88XlyHUdQAGJxTcTRX5nV02Yu0 hqbfy7o2k+Ej1PN+uqEy5WeDQ8F2QE13KprQkPwvYmj4yxb99tIBP77KWk+1UgQVS2l2 vsYg== 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 r9-v6si2038912pgp.591.2018.06.20.07.35.21; Wed, 20 Jun 2018 07:35:21 -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 S1754166AbeFTOfT (ORCPT + 30 others); Wed, 20 Jun 2018 10:35:19 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:58661 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752856AbeFTOfR (ORCPT ); Wed, 20 Jun 2018 10:35:17 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.145]) with ESMTPA (Nemesis) id 0MYLUv-1fj2M40HXl-00V8Vn; Wed, 20 Jun 2018 16:35:05 +0200 From: Arnd Bergmann To: Chris Mason , Josef Bacik , David Sterba Cc: y2038@lists.linaro.org, Arnd Bergmann , Anand Jain , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] btrfs: use 64-bit timestamps for struct btrfs_dev_replace_item Date: Wed, 20 Jun 2018 16:34:33 +0200 Message-Id: <20180620143448.44388-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180620143448.44388-1-arnd@arndb.de> References: <20180620143448.44388-1-arnd@arndb.de> X-Provags-ID: V03:K1:qfBHUeRe4dB1qRa0S8jd7SDPMnKRIt5xHOzntFHibu3uJJnuumo dy1cfElifhdyVTuiBRwrnxczzmZuiGythjLwCX5g1kg9vnaBc0CkTOqemChQfoXpgnZJhdm YlZun5zb1P2RszmzszGwwsMKn60eeTxec5wAYC4R/GASm38apvu3bfo6L8W8rUqKNVEOcqP nI0RPqttcwynVrfp5rZKA== X-UI-Out-Filterresults: notjunk:1; V01:K0:fUHJ0lXFL10=:FWCl/lSF8JKMqWaDusUkvr 9PsJlcSmk0BZDDxETliIT1yvXRgryKtrHY2d3GXw54SmKl+x3hhtd5vV6cX4UiPfhPD4ZKki3 LDoybKt3DZLvm2v9ywNv4Ygh8d3TxUgeSjOJLn9RiHJ3N5JUF26k7V4kVVnsU4cLMhd1k/cHB EWZQkkk858Het2XJ6eIaCW27jgs6etAAykjgXSrv7e9T9x7JhqSpQ4XYFPtRswNGMtKktJ1xF Pf2fP6GszBXKkqCtalmvsilxbIaVkMuibh504QaYIykCOlMikKnA/dpkv4d9F3e4++GMR4+xu Ardgs1f6h+TFe96DKbuibeaxozKlfP1gH1/JtVTT09D2pdcjzv6334uCMa6qRH4TKTas8XnOE a2PasnvcZh4l4+gF7xJiX2LHnRUWHErMk5QPgtSeUx9zi0wjtGb8Hg5HSUczfYdGjNn/r+LoK vCAwv39WeZ6QtkwoqMJ7RQwq34dIIW84Ovd7rDPPjfwFLPEiP88vwMb9Vz2lHX9j+e2Hw+z4i kq70RNBftXHB5orSV0uynuXFDShRhQy77e4g2xtsHIrmkmRQ9F5VaEF2XVMPPd3yAE/hqHnCd 0Z7+B0Gaj8IkfyADcno9HrtsIpmARQTaakGp7wFcAGLNox9fZQGjvwqvugjUvzw4RNlZP+Nx/ 1W1Hrrz2EALG8X17euunFRFcnPFhZZgFoo/gMm69/LHaMoJscXj+03QQJwDsFAyQo9lM= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The structure already has 64-bit fields for the timestamps, but calling get_seconds() may truncate and risk overflow on 32-bit architectures. This changes the dev-replace code to use ktime_get_real_seconds() instead, which always returns 64-bit timestamps. Signed-off-by: Arnd Bergmann --- fs/btrfs/dev-replace.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.9.0 diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index e2ba0419297a..1b30c38d05c9 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c @@ -465,7 +465,7 @@ int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info, * go to the tgtdev as well (refer to btrfs_map_block()). */ dev_replace->replace_state = BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED; - dev_replace->time_started = get_seconds(); + dev_replace->time_started = ktime_get_real_seconds(); dev_replace->cursor_left = 0; dev_replace->committed_cursor_left = 0; dev_replace->cursor_left_last_write_of_item = 0; @@ -618,7 +618,7 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, : BTRFS_IOCTL_DEV_REPLACE_STATE_FINISHED; dev_replace->tgtdev = NULL; dev_replace->srcdev = NULL; - dev_replace->time_stopped = get_seconds(); + dev_replace->time_stopped = ktime_get_real_seconds(); dev_replace->item_needs_writeback = 1; /* replace old device with new one in mapping tree */ @@ -807,7 +807,7 @@ int btrfs_dev_replace_cancel(struct btrfs_fs_info *fs_info) break; } dev_replace->replace_state = BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED; - dev_replace->time_stopped = get_seconds(); + dev_replace->time_stopped = ktime_get_real_seconds(); dev_replace->item_needs_writeback = 1; btrfs_dev_replace_write_unlock(dev_replace); btrfs_scrub_cancel(fs_info); @@ -848,7 +848,7 @@ void btrfs_dev_replace_suspend_for_unmount(struct btrfs_fs_info *fs_info) case BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED: dev_replace->replace_state = BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED; - dev_replace->time_stopped = get_seconds(); + dev_replace->time_stopped = ktime_get_real_seconds(); dev_replace->item_needs_writeback = 1; btrfs_info(fs_info, "suspending dev_replace for unmount"); break; From patchwork Wed Jun 20 14:34:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 139354 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp868341lji; Wed, 20 Jun 2018 07:36:01 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLxlbXMfwuJxDWfA+O0ilmaq2DERG99ARfL8K5OA4P+jtxjdBblFhaBe2sKmS+R9GK+FXkF X-Received: by 2002:a62:d09:: with SMTP id v9-v6mr22850654pfi.163.1529505361757; Wed, 20 Jun 2018 07:36:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529505361; cv=none; d=google.com; s=arc-20160816; b=F4iFUyWoN8oad7p/oZxynQVEUG49BnVrmbUiyvbeEAeYG0UA+2P5nkcGgkPp8axA9D t6ws/VNEHwrdt6vqrVYdqBGiJt7lCz6q8QJLmVybwsk6g6jwttOwMRvydl5yVV7ECKj5 QJk9PJPEu+GRpsLUJRh+eKWTAlCoUJoikKWq6eg8K5PDrpgyZ2m5EE/RcNa/5IpT09fC v/Bwjra+IvmluEeFZVoSIJrZ4wmL/oOBNqDOQd3lAbg5jyem/MN5UCNeO5DTOAgg8H9B Ujz4+1tfr3OzeuxromestzmFdDpuwvS+nNRXbmqSVYoz4fNcPixNeJ52iXczt46ipfMJ Ue6w== 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=FKgU0lWxK6ZAmLhwll/oVP1f/sDtMlokeYsjPcVIVRY=; b=iUlC5ln3RaZ2jFWa2ckQAsvD7Nbl+MO98xOnqp3pvnyTNxnxKL5zwtIJZ/npja2DSw g12DNE/LSZkxERu03AIJKWc6SF7REIn4Nn/7fqdA1s2ofUBUMyXY6WbHuxs1TMrJaOWh 3+juya1hpVrOTo8AD6PBptvd9Ei+F4yq7X1I9L52abR/djg23N38wKQlXxXYExOYZSHF od9TA6WuctVH3tNmoQ1mOd1k6PRgVVjFL8wjT/SagVShkNU9yomDkQbIy8uwYWanJcS1 Oz5UmtZxxtg73wMTYUrtDMOHHx5s7S5P/IlgWgzdEHOYHo7mrOEmysJ0+VFu7OiUHAbk dXaQ== 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 y2-v6si2519441plk.473.2018.06.20.07.36.01; Wed, 20 Jun 2018 07:36:01 -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 S1754207AbeFTOf7 (ORCPT + 30 others); Wed, 20 Jun 2018 10:35:59 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:57985 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752856AbeFTOf6 (ORCPT ); Wed, 20 Jun 2018 10:35:58 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.145]) with ESMTPA (Nemesis) id 0MgI6w-1fs8dU01YM-00Ng8S; Wed, 20 Jun 2018 16:35:18 +0200 From: Arnd Bergmann To: Chris Mason , Josef Bacik , David Sterba Cc: y2038@lists.linaro.org, Arnd Bergmann , Nikolay Borisov , Omar Sandoval , Liu Bo , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] btrfs: use timespec64 for i_otime Date: Wed, 20 Jun 2018 16:34:34 +0200 Message-Id: <20180620143448.44388-3-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180620143448.44388-1-arnd@arndb.de> References: <20180620143448.44388-1-arnd@arndb.de> X-Provags-ID: V03:K1:64ae6ej6GWDaggWWkac+lHArkwY6qkKHJYloNUh0uQoskF5Sy9d PZtYjHqS5RdsWDG1vADqfPLQi0dbEYcH2Z0/FeKvLx0ubpjSE3LVBungbhI1INYBaTlAHRA aW4gU8WEKHEdUcp8isDxNTCOQ1O+V+3BBJNE0N58wv8rG9HTQNKQpuirUMdbOW+RaHVgaKa 7PPL2VD7C125eoKtNhkOg== X-UI-Out-Filterresults: notjunk:1; V01:K0:MH9aXRGwem0=:Gpxc20+tA3ANirFW1kpcLT racVDbqcZfdsq6Fo9GRqH1X4466q9qJRnyQHDKc+DAQpoGgpEdiaEeWM7ZXlB9i3SieXAvMAU cQiuQofIXJhN1faaANTEkt57OlFv1hQWxWtiW80QmWFY4MpkynG3QkuHXFxlvKcHX/zOj1eaB JOvSZFDv04Pi52D34HI4uafWK1bIQbcX9litevOJlTFr/5FtxNb0lxAWp7fQiEa3UexTdxOf/ QxUqK0u1aRFak7nixQ8PZ53Xhhx/DherDjZqgfNFS5VPZr3o/GSejhfj+YIooTVpHrZkrnxgW mASiAsmv502XfzSGMR+kHp3olZwRmgB2VzQoNgI0XvCh5qOmN01Ljwn9jTQv+srAb/WeKGp4J iF7tjsdpPvphZuv6TOAC3CjaCQSdr2oLkqpyDP+dHXcRrYAwH0uan0+bK0eWX1c9NvVTOpTgd Xm/2x9vVCwOQSV7HFwc0gjSs6bqYBHaEgitMsrZq8yuA5xyjuLC7BeU99utZ09bLnKmWtaI4h 6jVdDl4QihWJHZw9Fe/aeGgkwoBlzSuJ3QigvXTWFbY5KXPSwa6LpF0rhDU06Emw7ZhxCPN2g kkl2zwKT8AALNwBoqZGpuCxROcv3YXB/Z3ibErqNxjzAQyoBLNGTXSGq2apJroQjBjKEkhfD9 cULHRfzcJ7xqrm7sJywvS3a/7UT0wJWWgXyPbx+R0AqbLHUfH6CqbRY8cWLm1yxygavs= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While the regular inode timestamps all use timespec64 now, the i_otime field is btrfs specific and still needs to be converted to correctly represent times beyond 2038. Signed-off-by: Arnd Bergmann --- fs/btrfs/btrfs_inode.h | 2 +- fs/btrfs/inode.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) -- 2.9.0 diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index 7e075343daa5..1343ac57b438 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h @@ -178,7 +178,7 @@ struct btrfs_inode { struct btrfs_delayed_node *delayed_node; /* File creation time. */ - struct timespec i_otime; + struct timespec64 i_otime; /* Hook into fs_info->delayed_iputs */ struct list_head delayed_iput; diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index e9482f0db9d0..22dcc8afd38f 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -5745,7 +5745,7 @@ static struct inode *new_simple_dir(struct super_block *s, inode->i_mtime = current_time(inode); inode->i_atime = inode->i_mtime; inode->i_ctime = inode->i_mtime; - BTRFS_I(inode)->i_otime = timespec64_to_timespec(inode->i_mtime); + BTRFS_I(inode)->i_otime = inode->i_mtime; return inode; } @@ -6349,7 +6349,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, inode->i_mtime = current_time(inode); inode->i_atime = inode->i_mtime; inode->i_ctime = inode->i_mtime; - BTRFS_I(inode)->i_otime = timespec64_to_timespec(inode->i_mtime); + BTRFS_I(inode)->i_otime = inode->i_mtime; inode_item = btrfs_item_ptr(path->nodes[0], path->slots[0], struct btrfs_inode_item);