From patchwork Wed Jun 20 14:25:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 139347 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp857051lji; Wed, 20 Jun 2018 07:25:34 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKtmzS7kAiY8pgcuF3daneVdVHQa/SBapKae1b/bof838NoIYCek1QXkK8YrjKoe4cresP0 X-Received: by 2002:a62:d74d:: with SMTP id v13-v6mr23303007pfl.0.1529504734724; Wed, 20 Jun 2018 07:25:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529504734; cv=none; d=google.com; s=arc-20160816; b=cJIwDVgL3QcuSD1CPxQ8/lcJt3UfPXslhavhcwewQ+owuZeyB6lWYEw6eTw+tHsb6O sNgaEkqBaMDm0IV4DVehvMt+JpfGzT+AvpFlTxvgft7PKvNs97RNicbwe6V68pxpiuyI sraBD1al25wzFtLtJlHY7vQslZd/gS/zkjSqDl8Kwm2Iuz3DDPtIvvu/zzCYIt4KaJAb 0URYer9Eg13pLQVX65pZzaC62Rd+nyjSPIb/tzUV2j2Hlno+h3hHsA1P7IjeS1YOjiuP mcnzFaZbgt7WNXGEtxEXcnKmZQQ+r/HFAPrSgvuTv4b09a3svGxOnd6P9BOL4eyLR7Uf YEaw== 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=vn+njpHDZ0fFoE93aZgLWoBXC8nl9KdgeN/12PwHpZU=; b=o92f2sIoKQDTVC0yIwZadSulS7rtWNkoY4092cNZNrqYhVDnIN+N9JN4+6rTQ/Jj8T MDOlqMXMui5pjPynLlKyhjecwK2jCFlk/dUvkUrONR6kS7WzgH117icLGAaYV+ttXWXH LvtVZhHKjXnSteuFLc42brqHdw6s60rlaqD01Sselo8MkpE8HU6+4YFzIKoF9PHsTrSF iwojAyCFNR1eWLczrEU8S4ZOgkx8JAahV2HqFZqEoaLy0byPZkjarXUjUWP0AEpOeZLr WEBba904YJ155wCZ8Ph9D2/Oci7l1nMNL9gAA7GlS+dWJVTMs6AxQAkNwZD4MoisPNN9 B8Sg== 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 m7-v6si2119890pgs.623.2018.06.20.07.25.34; Wed, 20 Jun 2018 07:25:34 -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 S1754110AbeFTOZc (ORCPT + 30 others); Wed, 20 Jun 2018 10:25:32 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:38637 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752725AbeFTOZb (ORCPT ); Wed, 20 Jun 2018 10:25:31 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue004 [212.227.15.129]) with ESMTPA (Nemesis) id 0M4miX-1gQ7583WYv-00ywch; Wed, 20 Jun 2018 16:25:27 +0200 From: Arnd Bergmann To: Andrew Morton Cc: y2038@lists.linaro.org, Al Viro , Jan Kara , Arnd Bergmann , reiserfs-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] [v2] reiserfs: remove unused j_timestamp Date: Wed, 20 Jun 2018 16:25:02 +0200 Message-Id: <20180620142522.27639-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K1:8youE5gdzqlCVc47C1M34WBtIrfY3nKAxGELInFt2od+eETb7vX qLjzZIMt0nw1tperFlZofr/vs2qvCZEustwtGaSN0yuhn0Wcjwfg1FFNcLdxhAsC9kkJFE9 xR3oIE/QcOZEpsD9tKi3Jh0e5pcRr86IL7EffEgoRtXS9orUAGHkbtE3xxh/cH69dVnY47z l4VPohNRiaVH9ZgT6hnEg== X-UI-Out-Filterresults: notjunk:1; V01:K0:VD5C1kPIHoE=:2qDUVVSovwfSDfKR7NJZ0d x+rE4qCrAyAFZ+gmRwtP3DcS99UUqBbjWN9zYiBXcifuilb823C4iRun56driWsJ2lCS8ZLBB rT/tkGf6SXQdFaDysi1fmTxT8Xs05LpHRwWAwh+rSiGMGG7Ga06CUYWzVIIhHDX5lUe2C3OlL ixO6WUUCqK4FSQDIiefkduTvYEC6bt9rYnM3lQO+Nnkc6EFnnh+DqNvltzA86xRTU7nPdAvlT rAKxP5V1IwelJIhRls+6I+F8j3epFLmTWHZFPmu45wxcQSbIAANaQEwuijV8ShyHmx3RZT3ly MXbS5EiSEC6LTGKVOgcTR33YQaWQdALJGHMdLMxOBcwF6aPVm/o2z/G+KhyXBQKmZIlmMQrbx bSQB7IbOfh80uLPnZ+XSmJ9kQYB3omkz1eZWbQNgKNrzDmbVlPzdIVSDfuhIhrz0YgyIjo3tP +3ORMpqn+mOkJ61zBbrdIzr6C6xlQfiUCQxpcr6+6Yp8RGrK9ZatI+dcTC3s8b3bIq1IJHTep B3cEZs5KEui8BrbxxDYUMglqeK601obgvgRFX1h5YMCmBlpp3yCwqQCkIDMlrDe5qwP7EBuNw loh1dlGB7XtLrJ8zz5xvfyOMx0zW3GWlYtM5okMi3bfu2e6bkUvS0GXzVm4vKzRqInUq6sLFP AAwjfr6yZd5sMmYOAzOTnX19K5ef/KvKe5atoORxemvb3K7KSy1rynwCz+yK6Bk0xQlk= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This uses the deprecated time_t type but is write-only, so we can just remove it. Reviewed-by: Jan Kara Signed-off-by: Arnd Bergmann --- v2: no changes --- fs/reiserfs/journal.c | 1 - fs/reiserfs/reiserfs.h | 1 - 2 files changed, 2 deletions(-) -- 2.9.0 diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 52eb5d293a34..1e7f733b2a12 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c @@ -4110,7 +4110,6 @@ static int do_journal_end(struct reiserfs_transaction_handle *th, int flags) atomic_set(&jl->j_older_commits_done, 0); jl->j_trans_id = journal->j_trans_id; - jl->j_timestamp = journal->j_trans_start_time; jl->j_commit_bh = c_bh; jl->j_start = journal->j_start; jl->j_len = journal->j_len; diff --git a/fs/reiserfs/reiserfs.h b/fs/reiserfs/reiserfs.h index ae4811fecc1f..1536ebbaf6ab 100644 --- a/fs/reiserfs/reiserfs.h +++ b/fs/reiserfs/reiserfs.h @@ -271,7 +271,6 @@ struct reiserfs_journal_list { struct mutex j_commit_mutex; unsigned int j_trans_id; - time_t j_timestamp; struct reiserfs_list_bitmap *j_list_bitmap; struct buffer_head *j_commit_bh; /* commit buffer head */ struct reiserfs_journal_cnode *j_realblock; From patchwork Wed Jun 20 14:25:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 139348 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp857361lji; Wed, 20 Jun 2018 07:25:55 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIo2Q0pAXzcBhw6N8WKKmZHveu1tUTpysvBQNtJkmm2nMrjqxf1pkEguedZMxVyWXI1n/TM X-Received: by 2002:a17:902:7202:: with SMTP id ba2-v6mr23603632plb.119.1529504754877; Wed, 20 Jun 2018 07:25:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529504754; cv=none; d=google.com; s=arc-20160816; b=AEbtEmrjgisIfI3B6qo9cI0UgNJZxP9b0z5VcyPrc56ikzuKkiotc26fff2nL7jE7Y 9/JAV9HjAPCU+vbK4KCIKGm1YinLSF3uVGBkpZwggoXTE6pX0ZFHW0Sdr3XpdisdAapb 1FtVeBMyhKU7Izwc8v7umIXdALlQVmZBcGdrOv1amzO4mxsJaw6hooFuMZFQ7RHslfU4 9OkkmJMZAj4646Q8PMDxbMlcr4TsMRHFA0XqV+JRhAaD7Qt6+vpXfHanJ82OajvOamSg 17ULLgjeVzFpINF2ad+/wAA4v3cvt/c7Bd+5SQgAIAQHSUzHaRLeg/IPyt5HiYwc55L7 YFyw== 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=0QHiVRwr2zLC2zgtJlHksZTMDvca1OOH7hFVAprOlyg=; b=DaNpZM5IBEaT9gv1ryzLM6a5Gca32io5jwMsgr3UtT0rJq4QKm25k+M8Uth9IarWU9 LKQX4fw8pz5W05P0i5yNQhkpGLXyWspf+I7Mo42i7G2rsle7eXq3LmZCx1fU9kZBYMEA 84FbHQ3OdPUIVgOXmo0PFtspgeQNQVHXgjEdjxoGcnvyqyf/5K2OXQ2Zp9dvAZUFrMgd xRES4PIRmVTmD7iIGW76jgO9qK45r1i4j4X6kttDOI4iu+LMU5BSuGZpKPrNSbqKejyn XaeNzp9anaX2C9usWwiag35ED3CvD8nObRpn5WIuj1fSfK1aLcHNDNEiSlNQRYenInP/ HzQA== 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 h68-v6si2068305pgc.429.2018.06.20.07.25.54; Wed, 20 Jun 2018 07:25:54 -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 S932149AbeFTOZw (ORCPT + 30 others); Wed, 20 Jun 2018 10:25:52 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:53835 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752725AbeFTOZv (ORCPT ); Wed, 20 Jun 2018 10:25:51 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue004 [212.227.15.129]) with ESMTPA (Nemesis) id 0ME24x-1fPrYS49Lb-00HONR; Wed, 20 Jun 2018 16:25:48 +0200 From: Arnd Bergmann To: Andrew Morton Cc: y2038@lists.linaro.org, Al Viro , Jan Kara , Arnd Bergmann , reiserfs-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] [v2] reiserfs: use monotonic time for j_trans_start_time Date: Wed, 20 Jun 2018 16:25:03 +0200 Message-Id: <20180620142522.27639-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180620142522.27639-1-arnd@arndb.de> References: <20180620142522.27639-1-arnd@arndb.de> X-Provags-ID: V03:K1:W1JUts3BL3F5UNzhQ36vvXL2GrsEwYC9oioYyls/7/VWnkCmW7m +hKVB8Dmpm6x/+bx445hoiEPYS3eaYFyoQ7k70/mXv0ESJl7fTHUf/1DgaupZwcqTDchHvf IeFZ8cUAKATiAUy6YPcXTkr93pGuHci1Jk5DFwbzrYUoHQal0LZOmJZEOPn4hKohYmhJYh5 qy0FyQrR7CZ77Led6rHuQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:aoCcdoAY2oY=:TNIURq/auzo3sOEDfRTHYO Q+ApU3MqQ04l7aoAYax2yu0iGRDfYLiyK/ogo0rWVVul6H6hp5W2A2w5PIRBMhIcFonUuL4sj Gqq73PpGeR1lk4s8mw6Zh9+XrUprVQV3ZpIIuVVajzk5WGjTvu5g7G5vuwnRDuTch19l9yWiN poqf0Os2TyCiVRh/qduuk9X5Sgt36PTr/b8HowW6Dt1JmjREhGDuQOsJAA8P6JMi5LPHTYjnY TZXHUD+j5D05ojcWQW5Zy3Da1COyxc5DQQhUm+tuZ/p3tlIjxs+UQDVxqeC+UvGr9UcTpoaqN MpzzpSJ5TuWzNrwYgcRf1+ZmKZeDUHZ4QNeqrBN4pJbGBZrxm6IGuF+QtTmE2RnJ2RSComIvB DT4hdzS43QbXTuNVumaLRlih9yljAXtcWivicKX0oWWRP0VdCgBXM6RtSesyDNIJpHJaW+4eq 5lBKWzlWeZMfb8VZg4Z1qhpw+ddVyRYEVNQXlAmZSRd/vp9WqKDpRPlGQM+eJ7YL5zzmzl6vK KrQezjwPRA6xnKcEbNAGT5MSkXt3sSNNQ0/bc9uleN/COogVmzLBVHmxpa8M4VVRu+4s2YU32 irsxOr0OqWQxd9qRYQFejyjrpWPgt3vjMIjpIWAwTBp4CH0kK3ROX9oV6IvXUgDVfsQMahwxJ QMrzvS7Y6lgR/uXHYTLd/JolHwSznc5Vn61fDCvGaSlWdpTOHI0IL6NLuU9LTFWk9Hf8= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Using CLOCK_REALTIME time_t timestamps breaks on 32-bit systems in 2038, and gives surprising results with a concurrent settimeofday(). This changes the reiserfs journal timestamps to use ktime_get_seconds() instead, which makes it use a 64-bit CLOCK_MONOTONIC stamp. In the procfs output, the monotonic timestamp needs to be converted back to CLOCK_REALTIME to keep the existing ABI. Reviewed-by: Jan Kara Signed-off-by: Arnd Bergmann --- v2: I split out the conversion from monotonic to real time into a separate function for readability, though I decided against making it a global function. I looked at almost all uses of CLOCK_REALTIME in the kernel several times and don't remember any other file that would benefit from making it a generic helper, and it can be slightly inaccurate because of the double rounding. --- fs/reiserfs/journal.c | 22 +++++++++++----------- fs/reiserfs/procfs.c | 11 +++++++++-- fs/reiserfs/reiserfs.h | 2 +- 3 files changed, 21 insertions(+), 14 deletions(-) -- 2.9.0 diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 1e7f733b2a12..e809da912c00 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c @@ -2381,7 +2381,7 @@ static int journal_read(struct super_block *sb) struct reiserfs_journal_desc *desc; unsigned int oldest_trans_id = 0; unsigned int oldest_invalid_trans_id = 0; - time_t start; + time64_t start; unsigned long oldest_start = 0; unsigned long cur_dblock = 0; unsigned long newest_mount_id = 9; @@ -2395,7 +2395,7 @@ static int journal_read(struct super_block *sb) cur_dblock = SB_ONDISK_JOURNAL_1st_BLOCK(sb); reiserfs_info(sb, "checking transaction log (%pg)\n", journal->j_dev_bd); - start = get_seconds(); + start = ktime_get_seconds(); /* * step 1, read in the journal header block. Check the transaction @@ -2556,7 +2556,7 @@ static int journal_read(struct super_block *sb) if (replay_count > 0) { reiserfs_info(sb, "replayed %d transactions in %lu seconds\n", - replay_count, get_seconds() - start); + replay_count, ktime_get_seconds() - start); } /* needed to satisfy the locking in _update_journal_header_block */ reiserfs_write_lock(sb); @@ -2914,7 +2914,7 @@ int journal_transaction_should_end(struct reiserfs_transaction_handle *th, int new_alloc) { struct reiserfs_journal *journal = SB_JOURNAL(th->t_super); - time_t now = get_seconds(); + time64_t now = ktime_get_seconds(); /* cannot restart while nested */ BUG_ON(!th->t_trans_id); if (th->t_refcount > 1) @@ -3023,7 +3023,7 @@ static int do_journal_begin_r(struct reiserfs_transaction_handle *th, struct super_block *sb, unsigned long nblocks, int join) { - time_t now = get_seconds(); + time64_t now = ktime_get_seconds(); unsigned int old_trans_id; struct reiserfs_journal *journal = SB_JOURNAL(sb); struct reiserfs_transaction_handle myth; @@ -3056,7 +3056,7 @@ static int do_journal_begin_r(struct reiserfs_transaction_handle *th, PROC_INFO_INC(sb, journal.journal_relock_writers); goto relock; } - now = get_seconds(); + now = ktime_get_seconds(); /* * if there is no room in the journal OR @@ -3119,7 +3119,7 @@ static int do_journal_begin_r(struct reiserfs_transaction_handle *th, } /* we are the first writer, set trans_id */ if (journal->j_trans_start_time == 0) { - journal->j_trans_start_time = get_seconds(); + journal->j_trans_start_time = ktime_get_seconds(); } atomic_inc(&journal->j_wcount); journal->j_len_alloc += nblocks; @@ -3559,11 +3559,11 @@ static void flush_async_commits(struct work_struct *work) */ void reiserfs_flush_old_commits(struct super_block *sb) { - time_t now; + time64_t now; struct reiserfs_transaction_handle th; struct reiserfs_journal *journal = SB_JOURNAL(sb); - now = get_seconds(); + now = ktime_get_seconds(); /* * safety check so we don't flush while we are replaying the log during * mount @@ -3613,7 +3613,7 @@ void reiserfs_flush_old_commits(struct super_block *sb) static int check_journal_end(struct reiserfs_transaction_handle *th, int flags) { - time_t now; + time64_t now; int flush = flags & FLUSH_ALL; int commit_now = flags & COMMIT_NOW; int wait_on_commit = flags & WAIT; @@ -3694,7 +3694,7 @@ static int check_journal_end(struct reiserfs_transaction_handle *th, int flags) } /* deal with old transactions where we are the last writers */ - now = get_seconds(); + now = ktime_get_seconds(); if ((now - journal->j_trans_start_time) > journal->j_max_trans_age) { commit_now = 1; journal->j_next_async_flush = 1; diff --git a/fs/reiserfs/procfs.c b/fs/reiserfs/procfs.c index e39b3910d24d..f2cf3441fdfc 100644 --- a/fs/reiserfs/procfs.c +++ b/fs/reiserfs/procfs.c @@ -297,6 +297,13 @@ static int show_oidmap(struct seq_file *m, void *unused) return 0; } +static time64_t ktime_mono_to_real_seconds(time64_t mono) +{ + ktime_t kt = ktime_set(mono, NSEC_PER_SEC/2); + + return ktime_divns(ktime_mono_to_real(kt), NSEC_PER_SEC); +} + static int show_journal(struct seq_file *m, void *unused) { struct super_block *sb = m->private; @@ -325,7 +332,7 @@ static int show_journal(struct seq_file *m, void *unused) "j_bcount: \t%lu\n" "j_first_unflushed_offset: \t%lu\n" "j_last_flush_trans_id: \t%u\n" - "j_trans_start_time: \t%li\n" + "j_trans_start_time: \t%lli\n" "j_list_bitmap_index: \t%i\n" "j_must_wait: \t%i\n" "j_next_full_flush: \t%i\n" @@ -366,7 +373,7 @@ static int show_journal(struct seq_file *m, void *unused) JF(j_bcount), JF(j_first_unflushed_offset), JF(j_last_flush_trans_id), - JF(j_trans_start_time), + ktime_mono_to_real_seconds(JF(j_trans_start_time)), JF(j_list_bitmap_index), JF(j_must_wait), JF(j_next_full_flush), diff --git a/fs/reiserfs/reiserfs.h b/fs/reiserfs/reiserfs.h index 1536ebbaf6ab..d0fc829bd760 100644 --- a/fs/reiserfs/reiserfs.h +++ b/fs/reiserfs/reiserfs.h @@ -330,7 +330,7 @@ struct reiserfs_journal { struct buffer_head *j_header_bh; - time_t j_trans_start_time; /* time this transaction started */ + time64_t j_trans_start_time; /* time this transaction started */ struct mutex j_mutex; struct mutex j_flush_mutex; From patchwork Wed Jun 20 14:25:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 139349 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp857526lji; Wed, 20 Jun 2018 07:26:05 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKPIBYpWk2YS9wNmtpjiEhOFmsY2yk9Q26A70zZua57xsqGrbRN6vAi4tAcusxLUCKOSxY8 X-Received: by 2002:a62:642:: with SMTP id 63-v6mr23260425pfg.222.1529504765374; Wed, 20 Jun 2018 07:26:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529504765; cv=none; d=google.com; s=arc-20160816; b=IXEymxoeCDu1tfMNAGIyeNPJ+t0QnZq4e0cha1hS1ZlL9fk73zf+b9+CRsgk4FW3Oe R0l4aRbL9kPd1gfw0sGM9AUtZF9xSVsr6eIT1YxdaLJKtmdtzdDfMZPQ5zqL8tR51PBb mOIbsQoqBzMW7wzb5Mg090q3RqAat9/dKwWNnOwNRabv6VZx89UjmbjEibNdHGDAJgcl 0X6bIPiHQXqWbdczL3c30k2X5BoNSXKHmi/YZONVAnG1tF0q+A8YDCNsGhqclIN0BA1E UYXdoOmN0sjhbFswEGqhqc1rNjEJ6xdIVOi0S8OCGiWFhdWCQAThj89ppbA+tQWjRh9X kmSA== 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=gINflYBHRXL7qPOxcePJw0r9UYE6djjuRwuTCNOKedg=; b=UOG83QPSJZktgLCZY25CT/hF3kfuy2SBhJf/gD3U5SuaZtSWin8DJRGkLWM9PYLFJB CwO82631v9Ra517unQZ1uwFcX816eGCfRwKb8wtVwQtGJvTVdqE5jil/CQ1snq8zyK/k NP8orf/1Qstsl78wE0DYE2xeNVlXm/uG/r5UzmjnoedQi2PqLZj06AWXjvwJ+OEK6Qr5 dnmRmzdbT8FXGOCdGVxDcoGMnWvTFFysJ0mK5IS6ypthSm7uvu0hkQKNpZYoIgoGqoHd LIOBS5r+vw3baLi4TZYMwYwmzqiUx60Ag8xq/xXvJyXgKrEsYT7VyVi7Z55a8b1W1CuX ay3w== 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 f5-v6si2778400pln.414.2018.06.20.07.26.05; Wed, 20 Jun 2018 07:26:05 -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 S1754168AbeFTO0C (ORCPT + 30 others); Wed, 20 Jun 2018 10:26:02 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:42841 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932153AbeFTO0A (ORCPT ); Wed, 20 Jun 2018 10:26:00 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue004 [212.227.15.129]) with ESMTPA (Nemesis) id 0Lla4p-1g5o1K1gKF-00bO8L; Wed, 20 Jun 2018 16:25:57 +0200 From: Arnd Bergmann To: Andrew Morton Cc: y2038@lists.linaro.org, Al Viro , Jan Kara , Arnd Bergmann , reiserfs-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] [v2] reiserfs: remove obsolete print_time function Date: Wed, 20 Jun 2018 16:25:04 +0200 Message-Id: <20180620142522.27639-3-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180620142522.27639-1-arnd@arndb.de> References: <20180620142522.27639-1-arnd@arndb.de> X-Provags-ID: V03:K1:XNdbzTUm0j4bJiREs4SG+baP1izgegMxGgbrOBNplV4eiSG81xR RnYfrNZ6VPQKEjgZssURiXMfJzPGRiofkPIUTRvANeFZZ9WwGIbjzzCHrMPs6iEwi1L1O33 +lGRk9hdGnDAr+zvml6R4RSujX9FF04kH5AvlQf0CP1c5oO37PE6UvKINp0axdAundSEdRf dNVmseMyawoWoYjmcrL+Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:A6aV3BrMv6s=:UFBNs0Q9gMo/5pdYFEE279 UOL6v/9N5Ln5BpyOL9jUkrhkMg6YIxFAX14/xF00dqwXLexYgCTDsUENLxkaWBdjOkl+91s7M s+8d/pIvgv71hHW1yTNfv+EQySTR2v25ynAndzfEXjY5+DM0yJwuS9nb/RzEJrkKGF8qt/a4U 0TGjwbyHjp0IR60Fdvu6ajId4LMvixLsTDuDdLJGP8EOKjOXpeLXVHX9eVeUgF1ucdSGDGQdo eFKqAsxcrt/7sLPbV2x8oRW7+59TpSsfKABRUxIQCyMgAT9s2Hgl/aSX/rmfeuACs8A5pzVTg yHwkZz/cO/lCWUKFIokqPHYXLdTMmusnib7RNWO6jrPC/NOy2WkuJHCsoS4sBKzKqafg1j3xY dmbbK/I5uQWpwFzlSVOoqcdzSv2oq5BuFZsuvHf7ZQtZIpXZ4JIkLDRXqy8jjwIlikUSuCxBR RzawwUj6Q54TAy2XkMoCvy7+LFso9Qf1ngImpDC+YGcoYB2AnofPS93DAyqQ66SIzKYfVQwOt UsgP0faxu0tNSVe2xjg+KT1TYNOKQbk5J6N/bCcWS2MfLAbGlKjwP8UR+A0Kj3FVv+SgKQdCF lcHGKV0xlviaKQNrQALVi492DezQwKDdMv87b3L+pXePJbbD4yUqL7cHFIM+qVhSi8J3f/JRo y359Jm0fkBp5ypwoi6xaHnzW1Tv/nfhwIkdrwAgN0HV0sgc6Mwjw0QWcP185QGFuRVKo= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Before linux-2.4.6, print_time() was used to pretty-print an inode time when running reiserfs in user space, after that it has become obsolete and is still a bit incorrect: It behaves differently on 32-bit and 64-bit machines, and uses a static buffer to hold a string, which could lead to undefined behavior if we ever called this from multiple places simultaneously. Since we always want to treat the timestamps as 'unsigned' anyway, simply printing them as an integer is both simpler and safer while avoiding the deprecated time_t type. Signed-off-by: Arnd Bergmann --- v2: after a second look, I decided to remove it instead of fixing it. --- fs/reiserfs/item_ops.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) -- 2.9.0 Reviewed-by: Jan Kara diff --git a/fs/reiserfs/item_ops.c b/fs/reiserfs/item_ops.c index e3c558d1b78c..3a5a752d96c7 100644 --- a/fs/reiserfs/item_ops.c +++ b/fs/reiserfs/item_ops.c @@ -33,30 +33,22 @@ static int sd_is_left_mergeable(struct reiserfs_key *key, unsigned long bsize) return 0; } -static char *print_time(time_t t) -{ - static char timebuf[256]; - - sprintf(timebuf, "%ld", t); - return timebuf; -} - static void sd_print_item(struct item_head *ih, char *item) { printk("\tmode | size | nlinks | first direct | mtime\n"); if (stat_data_v1(ih)) { struct stat_data_v1 *sd = (struct stat_data_v1 *)item; - printk("\t0%-6o | %6u | %2u | %d | %s\n", sd_v1_mode(sd), + printk("\t0%-6o | %6u | %2u | %d | %u\n", sd_v1_mode(sd), sd_v1_size(sd), sd_v1_nlink(sd), sd_v1_first_direct_byte(sd), - print_time(sd_v1_mtime(sd))); + sd_v1_mtime(sd)); } else { struct stat_data *sd = (struct stat_data *)item; - printk("\t0%-6o | %6llu | %2u | %d | %s\n", sd_v2_mode(sd), + printk("\t0%-6o | %6llu | %2u | %d | %u\n", sd_v2_mode(sd), (unsigned long long)sd_v2_size(sd), sd_v2_nlink(sd), - sd_v2_rdev(sd), print_time(sd_v2_mtime(sd))); + sd_v2_rdev(sd), sd_v2_mtime(sd)); } }