From patchwork Mon Oct 26 23:34:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11859037 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ED98F1130 for ; Mon, 26 Oct 2020 23:34:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D3D1620809 for ; Mon, 26 Oct 2020 23:34:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="QCcXm7/n" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406525AbgJZXeS (ORCPT ); Mon, 26 Oct 2020 19:34:18 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:54510 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406524AbgJZXeS (ORCPT ); Mon, 26 Oct 2020 19:34:18 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNOXtw164631; Mon, 26 Oct 2020 23:34:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=if1DYqCY5KhI0Jb00e/NLuRHf6w26OFpObqSR27PkC0=; b=QCcXm7/n2NCPq+GVuykbTHgq0cYQgdTQGVABtqIe3frWdmx+LSzUVolzIpIajYkZ4cRO tKAUQHZ9XGJtq18ookZHpEug6mPjeAEpsV6y1j/kjo5GWF5FyUqAXUHPB20VusU60IHw 5+ANasDDRUMMI/uzFO7f5fAismB37gppGMO3pVcE5bxLm9efgu40/2RjidyYVqzDghMp AsTZcfSoJoRKGRYzzbcci0piBjQQ0LX0da/Dudy9/ndmHw0v0nqw4KY/KHAaTdTcykYB ISvPYx/floHAKAK0GmjUDpnOSwFmhp9Y/UcpFY9hCQ0zrzQBqdqjZyWmY5teUo5+iS8a +w== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 34dgm3vup9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Oct 2020 23:34:15 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNQFa3032559; Mon, 26 Oct 2020 23:34:15 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3020.oracle.com with ESMTP id 34cx1q2b8x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Oct 2020 23:34:14 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 09QNYECX005480; Mon, 26 Oct 2020 23:34:14 GMT Received: from localhost (/10.159.145.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Oct 2020 16:34:13 -0700 Subject: [PATCH 01/26] libxfs: create a real struct timespec64 From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: Amir Goldstein , linux-xfs@vger.kernel.org Date: Mon, 26 Oct 2020 16:34:13 -0700 Message-ID: <160375525297.881414.4918118774537695755.stgit@magnolia> In-Reply-To: <160375524618.881414.16347303401529121282.stgit@magnolia> References: <160375524618.881414.16347303401529121282.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 bulkscore=0 suspectscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 impostorscore=0 adultscore=0 bulkscore=0 spamscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 clxscore=1015 mlxscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Create a real struct timespec64 that supports 64-bit seconds counts. The C library struct timespec doesn't support this on 32-bit architectures and we cannot lose the upper bits in the incore inode. Signed-off-by: Darrick J. Wong Reviewed-by: Amir Goldstein Reviewed-by: Christoph Hellwig --- include/libxfs.h | 1 - include/xfs_fs_compat.h | 8 ++++++++ include/xfs_inode.h | 22 +++++++++++----------- libxfs/libxfs_priv.h | 2 -- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/include/libxfs.h b/include/libxfs.h index b9370139becc..2667d3b77084 100644 --- a/include/libxfs.h +++ b/include/libxfs.h @@ -41,7 +41,6 @@ struct iomap; #define __round_mask(x, y) ((__typeof__(x))((y)-1)) #define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) #define unlikely(x) (x) -#define timespec64 timespec /* * This mirrors the kernel include for xfs_buf.h - it's implicitly included in diff --git a/include/xfs_fs_compat.h b/include/xfs_fs_compat.h index 154a802d9aed..d0ffc9775875 100644 --- a/include/xfs_fs_compat.h +++ b/include/xfs_fs_compat.h @@ -85,4 +85,12 @@ struct xfs_extent_data { #define XFS_IOC_CLONE_RANGE _IOW (0x94, 13, struct xfs_clone_args) #define XFS_IOC_FILE_EXTENT_SAME _IOWR(0x94, 54, struct xfs_extent_data) +/* 64-bit seconds counter that works independently of the C library time_t. */ +typedef long long int time64_t; + +struct timespec64 { + time64_t tv_sec; /* seconds */ + long tv_nsec; /* nanoseconds */ +}; + #endif /* __XFS_FS_COMPAT_H__ */ diff --git a/include/xfs_inode.h b/include/xfs_inode.h index 588d8c7258f4..12676cb30bf2 100644 --- a/include/xfs_inode.h +++ b/include/xfs_inode.h @@ -31,17 +31,17 @@ struct xfs_inode_log_item; * metadata. */ struct inode { - mode_t i_mode; - uint32_t i_uid; - uint32_t i_gid; - uint32_t i_nlink; - xfs_dev_t i_rdev; /* This actually holds xfs_dev_t */ - unsigned long i_state; /* Not actually used in userspace */ - uint32_t i_generation; - uint64_t i_version; - struct timespec i_atime; - struct timespec i_mtime; - struct timespec i_ctime; + mode_t i_mode; + uint32_t i_uid; + uint32_t i_gid; + uint32_t i_nlink; + xfs_dev_t i_rdev; /* This actually holds xfs_dev_t */ + unsigned long i_state; /* Not actually used in userspace */ + uint32_t i_generation; + uint64_t i_version; + struct timespec64 i_atime; + struct timespec64 i_mtime; + struct timespec64 i_ctime; }; static inline uint32_t i_uid_read(struct inode *inode) diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h index bd724c32c263..e92269f0bdae 100644 --- a/libxfs/libxfs_priv.h +++ b/libxfs/libxfs_priv.h @@ -64,8 +64,6 @@ extern kmem_zone_t *xfs_buf_zone; extern kmem_zone_t *xfs_inode_zone; extern kmem_zone_t *xfs_trans_zone; -#define timespec64 timespec - /* fake up iomap, (not) used in xfs_bmap.[ch] */ #define IOMAP_F_SHARED 0x04 #define xfs_bmbt_to_iomap(a, b, c, d) ((void) 0) From patchwork Mon Oct 26 23:34:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11859039 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3361F921 for ; Mon, 26 Oct 2020 23:34:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1A85020874 for ; Mon, 26 Oct 2020 23:34:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="czczXiWX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406536AbgJZXeX (ORCPT ); Mon, 26 Oct 2020 19:34:23 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:36486 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406526AbgJZXeX (ORCPT ); Mon, 26 Oct 2020 19:34:23 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNP7Bb157988; Mon, 26 Oct 2020 23:34:21 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=0OyZ49m3GaKDSrxF9Mb8uPLTrz8w9VSpOFamaA6647o=; b=czczXiWXZnOtw7iJRIx4Gb8sjE0Bx440zu2+kAtArXeNu5bGChZL8YnPFASKL8AC97DJ RwfkIsQy3kuEsdRV0dI+jY6i3ehWyW7iNjEFw+6//03cmPMIAxt16t9gNC34IXuygwZ4 xtLabmTcvwPdxc3P9UjOsGCkDhL6eOZhdsMMQy+XpJltYEFPNiOPRfCjxoIimfGyVGTp 4r+RIzrdL+IqDPxTUYI19foGB8/kvr7XYN5sp1J0nS0KgccwpR9gUJrpuNY8xLkZVoEN FhEtnaOUu9PezGh17WRicseg42ORR5d3VlyspoKeUJFzzOYwVrX4HKo0U526NHIN/R5z oA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 34cc7kq8hh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Oct 2020 23:34:21 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNQNWH058417; Mon, 26 Oct 2020 23:34:20 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 34cwukr8cy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Oct 2020 23:34:20 +0000 Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 09QNYKxr012515; Mon, 26 Oct 2020 23:34:20 GMT Received: from localhost (/10.159.145.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Oct 2020 16:34:20 -0700 Subject: [PATCH 02/26] libxfs: refactor NSEC_PER_SEC From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: Amir Goldstein , linux-xfs@vger.kernel.org Date: Mon, 26 Oct 2020 16:34:19 -0700 Message-ID: <160375525913.881414.1818734123140314548.stgit@magnolia> In-Reply-To: <160375524618.881414.16347303401529121282.stgit@magnolia> References: <160375524618.881414.16347303401529121282.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 bulkscore=0 spamscore=0 adultscore=0 malwarescore=0 mlxlogscore=999 suspectscore=9 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 adultscore=0 malwarescore=0 spamscore=0 clxscore=1015 mlxscore=0 suspectscore=9 priorityscore=1501 impostorscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Clean up all the open-coded and duplicate definitions of time unit conversion factors. Signed-off-by: Darrick J. Wong Reviewed-by: Amir Goldstein Reviewed-by: Christoph Hellwig --- include/platform_defs.h.in | 3 +++ repair/dinode.c | 2 +- scrub/common.c | 2 -- scrub/progress.c | 1 - 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/platform_defs.h.in b/include/platform_defs.h.in index 1f7ceafb1fbc..a11b58719380 100644 --- a/include/platform_defs.h.in +++ b/include/platform_defs.h.in @@ -80,4 +80,7 @@ typedef unsigned short umode_t; extern int platform_nproc(void); +#define NSEC_PER_SEC (1000000000ULL) +#define NSEC_PER_USEC (1000ULL) + #endif /* __XFS_PLATFORM_DEFS_H__ */ diff --git a/repair/dinode.c b/repair/dinode.c index 028a23cd5c8c..95e57b5318b5 100644 --- a/repair/dinode.c +++ b/repair/dinode.c @@ -2170,7 +2170,7 @@ check_nsec( struct xfs_timestamp *t, int *dirty) { - if (be32_to_cpu(t->t_nsec) < 1000000000) + if (be32_to_cpu(t->t_nsec) < NSEC_PER_SEC) return; do_warn( diff --git a/scrub/common.c b/scrub/common.c index c4699b6ad1e3..49a87f412c4d 100644 --- a/scrub/common.c +++ b/scrub/common.c @@ -288,8 +288,6 @@ scrub_nproc_workqueue( * Sleep for 100us * however many -b we got past the initial one. * This is an (albeit clumsy) way to throttle scrub activity. */ -#define NSEC_PER_SEC 1000000000ULL -#define NSEC_PER_USEC 1000ULL void background_sleep(void) { diff --git a/scrub/progress.c b/scrub/progress.c index d8130ca5f93c..15247b7c6d1b 100644 --- a/scrub/progress.c +++ b/scrub/progress.c @@ -110,7 +110,6 @@ progress_report( fflush(pt.fp); } -#define NSEC_PER_SEC (1000000000) static void * progress_report_thread(void *arg) { From patchwork Mon Oct 26 23:34:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11859093 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BAB751130 for ; Mon, 26 Oct 2020 23:36:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9F7C320809 for ; Mon, 26 Oct 2020 23:36:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="DD/CqeZy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407159AbgJZXg3 (ORCPT ); Mon, 26 Oct 2020 19:36:29 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:37828 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407157AbgJZXg3 (ORCPT ); Mon, 26 Oct 2020 19:36:29 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNPKDn158046; Mon, 26 Oct 2020 23:36:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=/dW2Sjur6ZsWxFDaX5/0GbgCLnwJKu0goJnYRUzWcAc=; b=DD/CqeZynanOrl7Eaxvw8GP79pNL50lvzY37Z30cYqgo9UobH+im4rxVBQ5rrvhBqM61 6qLv0MXh9HYb+UgHOYU88QZkGC7xo+p9x8Zmr0blmVtkpNz0TPdHtsILzMUDqhrXrm98 TG/FEIz4OPhOuWZqPoXsfIahwASE4nZZJrcH2lnv5XnqXEQBCX0wgmA5+Bt6AaUFCWZP d4lIYfQX09QC+KV+UCYIOoifkfLHcpIIc3a6zJ23uwEeTvfG2OHmlkBN6X5i1Hi7QC+J Ptr65bB47hucwBwsO5bdCzvNJe4PkKMRC3hpsKw8dFjs58vnSSj/OwGWqattBlFQssL7 CQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 34cc7kq8np-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Oct 2020 23:36:27 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNPxGh110443; Mon, 26 Oct 2020 23:34:26 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 34cx5wfrw7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Oct 2020 23:34:26 +0000 Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 09QNYQQ1007428; Mon, 26 Oct 2020 23:34:26 GMT Received: from localhost (/10.159.145.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Oct 2020 16:34:26 -0700 Subject: [PATCH 03/26] libfrog: define LIBFROG_BULKSTAT_CHUNKSIZE to remove dependence on XFS_INODES_PER_CHUNK From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 26 Oct 2020 16:34:25 -0700 Message-ID: <160375526530.881414.1004347326416234607.stgit@magnolia> In-Reply-To: <160375524618.881414.16347303401529121282.stgit@magnolia> References: <160375524618.881414.16347303401529121282.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 adultscore=0 malwarescore=0 spamscore=0 clxscore=1015 mlxscore=0 suspectscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong "Online" XFS programs like scrub have no business importing the internal disk format headers to discover things like the optimum number of inodes to request through a bulkstat request. That number can be derived from the ioctl definition, so define a new constant in terms of that instead of pulling in the ondisk format unnecessarily. Note: This patch will be needed to work around new definitions in the bigtime patchset that will break scrub builds, so clean this up instead of adding more #includes to the two scrub source files. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- include/xfs.h | 2 ++ libfrog/bulkstat.h | 4 ++++ scrub/fscounters.c | 1 - scrub/inodes.c | 5 ++--- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/xfs.h b/include/xfs.h index af0d36cef361..e97158c8d223 100644 --- a/include/xfs.h +++ b/include/xfs.h @@ -38,6 +38,8 @@ extern int xfs_assert_largefile[sizeof(off_t)-8]; #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) #endif +#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER)) + #include /* Include deprecated/compat pre-vfs xfs-specific symbols */ #include diff --git a/libfrog/bulkstat.h b/libfrog/bulkstat.h index 56ef7f9a8237..2f440b14f93d 100644 --- a/libfrog/bulkstat.h +++ b/libfrog/bulkstat.h @@ -6,6 +6,10 @@ #ifndef __LIBFROG_BULKSTAT_H__ #define __LIBFROG_BULKSTAT_H__ +/* This is the minimum reasonable size of a bulkstat request. */ +#define LIBFROG_BULKSTAT_CHUNKSIZE \ + (NBBY * sizeof_field(struct xfs_inumbers, xi_allocmask)) + /* Bulkstat wrappers */ struct xfs_bstat; int xfrog_bulkstat_single(struct xfs_fd *xfd, uint64_t ino, unsigned int flags, diff --git a/scrub/fscounters.c b/scrub/fscounters.c index 9a240d49477b..f21b24e0935c 100644 --- a/scrub/fscounters.c +++ b/scrub/fscounters.c @@ -9,7 +9,6 @@ #include #include "platform_defs.h" #include "xfs_arch.h" -#include "xfs_format.h" #include "libfrog/paths.h" #include "libfrog/workqueue.h" #include "xfs_scrub.h" diff --git a/scrub/inodes.c b/scrub/inodes.c index 5ef752fe39d3..bdc12df31479 100644 --- a/scrub/inodes.c +++ b/scrub/inodes.c @@ -10,7 +10,6 @@ #include #include "platform_defs.h" #include "xfs_arch.h" -#include "xfs_format.h" #include "handle.h" #include "libfrog/paths.h" #include "libfrog/workqueue.h" @@ -74,7 +73,7 @@ bulkstat_for_inumbers( * Check each of the stats we got back to make sure we got the inodes * we asked for. */ - for (i = 0, bs = bstat; i < XFS_INODES_PER_CHUNK; i++) { + for (i = 0, bs = bstat; i < LIBFROG_BULKSTAT_CHUNKSIZE; i++) { if (!(inumbers->xi_allocmask & (1ULL << i))) continue; if (bs->bs_ino == inumbers->xi_startino + i) { @@ -134,7 +133,7 @@ scan_ag_inodes( sizeof(handle.ha_fid.fid_len); handle.ha_fid.fid_pad = 0; - error = -xfrog_bulkstat_alloc_req(XFS_INODES_PER_CHUNK, 0, &breq); + error = -xfrog_bulkstat_alloc_req(LIBFROG_BULKSTAT_CHUNKSIZE, 0, &breq); if (error) { str_liberror(ctx, error, descr); si->aborted = true; From patchwork Mon Oct 26 23:34:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11859045 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CEE19921 for ; Mon, 26 Oct 2020 23:34:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A676B20872 for ; Mon, 26 Oct 2020 23:34:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="tf7GNhc9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406572AbgJZXeg (ORCPT ); Mon, 26 Oct 2020 19:34:36 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:36612 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406563AbgJZXef (ORCPT ); Mon, 26 Oct 2020 19:34:35 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNP0Sv157931; Mon, 26 Oct 2020 23:34:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=UkgJw6KwOqEuNAnxNFJo3okazcZL+JLu4M4Z/sasVkk=; b=tf7GNhc9W+ZHc0p3eiLNXhpOqvsXUcs4kJ2Ox+UU6SFqN1tcpm+aC7wK4Tjp4ZWurYSW 39U3O/qp73/9SUu/2VQSrEotc5xSNB6wQkMC77CV+LU8mDxh3HF/OMg/dfbWu2N7zXMD 0ws5KT3/m5SE/2ECuVNktTGXb0lygeyX72pye84hmtYMM4DCVLPnM0aq95HA/bWn+FSO b0/FpjliO04yedLZscmoaVcGY8C1x9nuI4yWyfOQfrA8v/5LBrNW2YgW6tHsY/DOtwwQ ccSjGz49J8Tv2nUTYfI/ydZr00eJNCbErlRZz1AmrcS2suN13HQBrVubl/fzsrUe3t7E dw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 34cc7kq8hx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Oct 2020 23:34:34 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNQNvE058345; Mon, 26 Oct 2020 23:34:33 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 34cwukr8fy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Oct 2020 23:34:33 +0000 Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 09QNYXsZ012566; Mon, 26 Oct 2020 23:34:33 GMT Received: from localhost (/10.159.145.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Oct 2020 16:34:33 -0700 Subject: [PATCH 04/26] libfrog: convert cvttime to return time64_t From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 26 Oct 2020 16:34:31 -0700 Message-ID: <160375527139.881414.6476607474654532506.stgit@magnolia> In-Reply-To: <160375524618.881414.16347303401529121282.stgit@magnolia> References: <160375524618.881414.16347303401529121282.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 bulkscore=0 spamscore=0 adultscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 adultscore=0 malwarescore=0 spamscore=0 clxscore=1015 mlxscore=0 suspectscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Change the cvttime function to return 64-bit time values so that we can put them to use with the bigtime feature. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- libfrog/convert.c | 6 +++--- libfrog/convert.h | 2 +- quota/edit.c | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libfrog/convert.c b/libfrog/convert.c index 6b8ff30de24a..0ceeb389682a 100644 --- a/libfrog/convert.c +++ b/libfrog/convert.c @@ -271,14 +271,14 @@ cvtstr( #define DAYS_TO_SECONDS(d) ((d) * HOURS_TO_SECONDS(24)) #define WEEKS_TO_SECONDS(w) ((w) * DAYS_TO_SECONDS(7)) -unsigned long +time64_t cvttime( char *s) { - unsigned long i; + time64_t i; char *sp; - i = strtoul(s, &sp, 0); + i = strtoll(s, &sp, 0); if (i == 0 && sp == s) return 0; if (*sp == '\0') diff --git a/libfrog/convert.h b/libfrog/convert.h index b307d31ce955..3e5fbe055986 100644 --- a/libfrog/convert.h +++ b/libfrog/convert.h @@ -16,7 +16,7 @@ extern uint16_t cvt_u16(char *s, int base); extern long long cvtnum(size_t blocksize, size_t sectorsize, const char *s); extern void cvtstr(double value, char *str, size_t sz); -extern unsigned long cvttime(char *s); +extern time64_t cvttime(char *s); extern uid_t uid_from_string(char *user); extern gid_t gid_from_string(char *group); diff --git a/quota/edit.c b/quota/edit.c index 01d358f740c8..b3cad024b1f1 100644 --- a/quota/edit.c +++ b/quota/edit.c @@ -419,13 +419,13 @@ restore_f( static void set_timer( - uint32_t id, - uint type, - uint mask, - char *dev, - uint value) + uint32_t id, + uint type, + uint mask, + char *dev, + time64_t value) { - fs_disk_quota_t d; + struct fs_disk_quota d; memset(&d, 0, sizeof(d)); @@ -476,7 +476,7 @@ timer_f( int argc, char **argv) { - uint value; + time64_t value; char *name = NULL; uint32_t id = 0; int c, flags = 0, type = 0, mask = 0; From patchwork Mon Oct 26 23:34:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11859097 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E10481130 for ; Mon, 26 Oct 2020 23:36:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BBFCD20878 for ; Mon, 26 Oct 2020 23:36:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Lodyuqdi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407166AbgJZXgo (ORCPT ); Mon, 26 Oct 2020 19:36:44 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:37940 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407169AbgJZXgn (ORCPT ); Mon, 26 Oct 2020 19:36:43 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNPvfk158460; Mon, 26 Oct 2020 23:36:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=ZerwMX0Hxjn2gy1M5CRf1LP4nx0hAGtGVPshVu2nczA=; b=LodyuqdiXNWoMVVGuOe8vw/N997NgaErRkXWqBe8oPht3JY0Ps9SqRPFpitLkrJQiNq2 XFCeYejSybD6UepnP+PxG7NNk4/WO63IIFfNpU3OVpkLpEkY0shv96C10MWeJP9qCBEz jHTvOyuzTomg5yXJpI2XqkOHqLIcRd37h+yDRX0WPjj3JFFgiTz3P+OgTf9bF4B1XjnO yG5PEbkLCeaGcfu9mrwieEqaoMpa4ZkdmwUMQV1qaQ/32389wBGGqfdGGOHSo5lxn8Xp z1QVdDDMjCUwu+D0nbtNP5gKGuw6tV91Cgci44xot8U8Z18xkn1DbJO2nf57xv15m87W Kg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 34cc7kq8p5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Oct 2020 23:36:41 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNQE2a032449; Mon, 26 Oct 2020 23:34:40 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3020.oracle.com with ESMTP id 34cx1q2bec-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Oct 2020 23:34:40 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 09QNYd9L012578; Mon, 26 Oct 2020 23:34:39 GMT Received: from localhost (/10.159.145.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Oct 2020 16:34:39 -0700 Subject: [PATCH 05/26] xfs_quota: convert time_to_string to use time64_t From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 26 Oct 2020 16:34:38 -0700 Message-ID: <160375527834.881414.2581158648212089750.stgit@magnolia> In-Reply-To: <160375524618.881414.16347303401529121282.stgit@magnolia> References: <160375524618.881414.16347303401529121282.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 bulkscore=0 suspectscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 adultscore=0 malwarescore=0 spamscore=0 clxscore=1015 mlxscore=0 suspectscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Rework the time_to_string helper to be capable of dealing with 64-bit timestamps. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen --- quota/quota.c | 16 ++++++++++------ quota/quota.h | 2 +- quota/report.c | 16 ++++++++++------ quota/util.c | 5 +++-- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/quota/quota.c b/quota/quota.c index 9545cc430a93..8ba0995d9174 100644 --- a/quota/quota.c +++ b/quota/quota.c @@ -48,6 +48,7 @@ quota_mount( uint flags) { fs_disk_quota_t d; + time64_t timer; char *dev = mount->fs_name; char c[8], h[8], s[8]; uint qflags; @@ -100,6 +101,7 @@ quota_mount( } if (form & XFS_BLOCK_QUOTA) { + timer = d.d_btimer; qflags = (flags & HUMAN_FLAG); if (d.d_blk_hardlimit && d.d_bcount > d.d_blk_hardlimit) qflags |= LIMIT_FLAG; @@ -111,16 +113,17 @@ quota_mount( bbs_to_string(d.d_blk_softlimit, s, sizeof(s)), bbs_to_string(d.d_blk_hardlimit, h, sizeof(h)), d.d_bwarns, - time_to_string(d.d_btimer, qflags)); + time_to_string(timer, qflags)); else fprintf(fp, " %10llu %10llu %10llu %02d %9s ", (unsigned long long)d.d_bcount >> 1, (unsigned long long)d.d_blk_softlimit >> 1, (unsigned long long)d.d_blk_hardlimit >> 1, d.d_bwarns, - time_to_string(d.d_btimer, qflags)); + time_to_string(timer, qflags)); } if (form & XFS_INODE_QUOTA) { + timer = d.d_itimer; qflags = (flags & HUMAN_FLAG); if (d.d_ino_hardlimit && d.d_icount > d.d_ino_hardlimit) qflags |= LIMIT_FLAG; @@ -132,16 +135,17 @@ quota_mount( num_to_string(d.d_ino_softlimit, s, sizeof(s)), num_to_string(d.d_ino_hardlimit, h, sizeof(h)), d.d_iwarns, - time_to_string(d.d_itimer, qflags)); + time_to_string(timer, qflags)); else fprintf(fp, " %10llu %10llu %10llu %02d %9s ", (unsigned long long)d.d_icount, (unsigned long long)d.d_ino_softlimit, (unsigned long long)d.d_ino_hardlimit, d.d_iwarns, - time_to_string(d.d_itimer, qflags)); + time_to_string(timer, qflags)); } if (form & XFS_RTBLOCK_QUOTA) { + timer = d.d_rtbtimer; qflags = (flags & HUMAN_FLAG); if (d.d_rtb_hardlimit && d.d_rtbcount > d.d_rtb_hardlimit) qflags |= LIMIT_FLAG; @@ -153,14 +157,14 @@ quota_mount( bbs_to_string(d.d_rtb_softlimit, s, sizeof(s)), bbs_to_string(d.d_rtb_hardlimit, h, sizeof(h)), d.d_rtbwarns, - time_to_string(d.d_rtbtimer, qflags)); + time_to_string(timer, qflags)); else fprintf(fp, " %10llu %10llu %10llu %02d %9s ", (unsigned long long)d.d_rtbcount >> 1, (unsigned long long)d.d_rtb_softlimit >> 1, (unsigned long long)d.d_rtb_hardlimit >> 1, d.d_rtbwarns, - time_to_string(d.d_rtbtimer, qflags)); + time_to_string(timer, qflags)); } fprintf(fp, "%s\n", mount->fs_dir); return 1; diff --git a/quota/quota.h b/quota/quota.h index 025d887726d8..11f62b208e6a 100644 --- a/quota/quota.h +++ b/quota/quota.h @@ -40,7 +40,7 @@ enum { */ extern char *type_to_string(uint __type); extern char *form_to_string(uint __form); -extern char *time_to_string(time_t __time, uint __flags); +extern char *time_to_string(time64_t __time, uint __flags); extern char *bbs_to_string(uint64_t __v, char *__c, uint __size); extern char *num_to_string(uint64_t __v, char *__c, uint __size); extern char *pct_to_string(uint64_t __v, uint64_t __t, char *__c, uint __s); diff --git a/quota/report.c b/quota/report.c index e6def916b827..2d5024e95177 100644 --- a/quota/report.c +++ b/quota/report.c @@ -330,6 +330,7 @@ report_mount( uint flags) { fs_disk_quota_t d; + time64_t timer; char *dev = mount->fs_name; char c[8], h[8], s[8]; uint qflags; @@ -397,6 +398,7 @@ report_mount( } if (form & XFS_BLOCK_QUOTA) { + timer = d.d_btimer; qflags = (flags & HUMAN_FLAG); if (d.d_blk_hardlimit && d.d_bcount > d.d_blk_hardlimit) qflags |= LIMIT_FLAG; @@ -408,16 +410,17 @@ report_mount( bbs_to_string(d.d_blk_softlimit, s, sizeof(s)), bbs_to_string(d.d_blk_hardlimit, h, sizeof(h)), d.d_bwarns, - time_to_string(d.d_btimer, qflags)); + time_to_string(timer, qflags)); else fprintf(fp, " %10llu %10llu %10llu %02d %9s", (unsigned long long)d.d_bcount >> 1, (unsigned long long)d.d_blk_softlimit >> 1, (unsigned long long)d.d_blk_hardlimit >> 1, d.d_bwarns, - time_to_string(d.d_btimer, qflags)); + time_to_string(timer, qflags)); } if (form & XFS_INODE_QUOTA) { + timer = d.d_itimer; qflags = (flags & HUMAN_FLAG); if (d.d_ino_hardlimit && d.d_icount > d.d_ino_hardlimit) qflags |= LIMIT_FLAG; @@ -429,16 +432,17 @@ report_mount( num_to_string(d.d_ino_softlimit, s, sizeof(s)), num_to_string(d.d_ino_hardlimit, h, sizeof(h)), d.d_iwarns, - time_to_string(d.d_itimer, qflags)); + time_to_string(timer, qflags)); else fprintf(fp, " %10llu %10llu %10llu %02d %9s", (unsigned long long)d.d_icount, (unsigned long long)d.d_ino_softlimit, (unsigned long long)d.d_ino_hardlimit, d.d_iwarns, - time_to_string(d.d_itimer, qflags)); + time_to_string(timer, qflags)); } if (form & XFS_RTBLOCK_QUOTA) { + timer = d.d_rtbtimer; qflags = (flags & HUMAN_FLAG); if (d.d_rtb_hardlimit && d.d_rtbcount > d.d_rtb_hardlimit) qflags |= LIMIT_FLAG; @@ -450,14 +454,14 @@ report_mount( bbs_to_string(d.d_rtb_softlimit, s, sizeof(s)), bbs_to_string(d.d_rtb_hardlimit, h, sizeof(h)), d.d_rtbwarns, - time_to_string(d.d_rtbtimer, qflags)); + time_to_string(timer, qflags)); else fprintf(fp, " %10llu %10llu %10llu %02d %9s", (unsigned long long)d.d_rtbcount >> 1, (unsigned long long)d.d_rtb_softlimit >> 1, (unsigned long long)d.d_rtb_hardlimit >> 1, d.d_rtbwarns, - time_to_string(d.d_rtbtimer, qflags)); + time_to_string(timer, qflags)); } fputc('\n', fp); return 1; diff --git a/quota/util.c b/quota/util.c index 50470aba7b05..361d2a8ef5c6 100644 --- a/quota/util.c +++ b/quota/util.c @@ -18,11 +18,12 @@ char * time_to_string( - time_t origin, + time64_t origin, uint flags) { static char timestamp[32]; - time_t now, timer; + time64_t timer; + time_t now; uint days, hours, minutes, seconds; if (flags & ABSOLUTE_FLAG) { From patchwork Mon Oct 26 23:34:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11859049 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6A991921 for ; Mon, 26 Oct 2020 23:34:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4F44520809 for ; Mon, 26 Oct 2020 23:34:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="YV0W90+6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406682AbgJZXet (ORCPT ); Mon, 26 Oct 2020 19:34:49 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:36754 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406568AbgJZXet (ORCPT ); Mon, 26 Oct 2020 19:34:49 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNP0PG157924; Mon, 26 Oct 2020 23:34:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=EwtoCEdhQaz5AJIq9l8EaCP+xv/bRJI8tQSLYf5AI7E=; b=YV0W90+6GjEuP5Bz1NouEQ/H3J9YWrdN7/fIO4R8DGHKCoGHHW0YzRkkYcXTjEw8DVI5 P0XNIvkT9/ARdryO3lIKzO8Sp8AxyenELjDEkvK57xigh3rca4tFCr+cjF2L8Z8fcxdD W8Lj5mqgtwkLamIoSg/G1ZB7VFQ2VdL/VrMnTkbgnOGkmX4jH3/HP2UZ73rORkG/mX7L MHvGGAhyXuKKZDrBegt4iwnne7P9KiebTUg+QqTt4H/R/e1dWbKQvmNcZTRpcpxHvn4O SZWviHBXiRqxoyFmdxjJ4eASnZLfXwKTD8XyZBWdEfhGHiSZ+dL/Ji/uFJuJIPEkH+fZ Sg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 34cc7kq8js-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Oct 2020 23:34:47 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNQE78032534; Mon, 26 Oct 2020 23:34:46 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3020.oracle.com with ESMTP id 34cx1q2bfe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Oct 2020 23:34:46 +0000 Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 09QNYjao007612; Mon, 26 Oct 2020 23:34:45 GMT Received: from localhost (/10.159.145.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Oct 2020 16:34:45 -0700 Subject: [PATCH 06/26] xfs_db: refactor timestamp printing From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 26 Oct 2020 16:34:44 -0700 Message-ID: <160375528453.881414.12498523896617282388.stgit@magnolia> In-Reply-To: <160375524618.881414.16347303401529121282.stgit@magnolia> References: <160375524618.881414.16347303401529121282.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 bulkscore=0 suspectscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 adultscore=0 malwarescore=0 spamscore=0 clxscore=1015 mlxscore=0 suspectscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Introduce type-specific printing functions to xfs_db to print an xfs_timestamp instead of open-coding the timestamp decoding. This is needed to stay ahead of changes that we're going to make to xfs_timestamp_t in the following patches. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- db/field.c | 8 ++++--- db/fprint.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++------------- db/fprint.h | 2 ++ db/inode.c | 5 ++-- 4 files changed, 60 insertions(+), 22 deletions(-) diff --git a/db/field.c b/db/field.c index aa0154d82eb7..f0316aeb4a86 100644 --- a/db/field.c +++ b/db/field.c @@ -334,8 +334,8 @@ const ftattr_t ftattrtab[] = { FTARG_SIGNED, NULL, NULL }, { FLDT_INT8D, "int8d", fp_num, "%d", SI(bitsz(int8_t)), FTARG_SIGNED, NULL, NULL }, - { FLDT_NSEC, "nsec", fp_num, "%09d", SI(bitsz(int32_t)), FTARG_SIGNED, - NULL, NULL }, + { FLDT_NSEC, "nsec", fp_nsec, NULL, SI(bitsz(xfs_timestamp_t)), + FTARG_SIGNED, NULL, NULL }, { FLDT_QCNT, "qcnt", fp_num, "%llu", SI(bitsz(xfs_qcnt_t)), 0, NULL, NULL }, { FLDT_QWARNCNT, "qwarncnt", fp_num, "%u", SI(bitsz(xfs_qwarncnt_t)), 0, @@ -347,8 +347,8 @@ const ftattr_t ftattrtab[] = { { FLDT_SYMLINK_CRC, "symlink", NULL, (char *)symlink_crc_flds, symlink_size, FTARG_SIZE, NULL, symlink_crc_flds }, - { FLDT_TIME, "time", fp_time, NULL, SI(bitsz(int32_t)), FTARG_SIGNED, - NULL, NULL }, + { FLDT_TIME, "time", fp_time, NULL, SI(bitsz(xfs_timestamp_t)), + FTARG_SIGNED, NULL, NULL }, { FLDT_TIMESTAMP, "timestamp", NULL, (char *)timestamp_flds, SI(bitsz(xfs_timestamp_t)), 0, NULL, timestamp_flds }, { FLDT_UINT1, "uint1", fp_num, "%u", SI(1), 0, NULL, NULL }, diff --git a/db/fprint.c b/db/fprint.c index c9d07e1bca7e..feec02c5de99 100644 --- a/db/fprint.c +++ b/db/fprint.c @@ -112,22 +112,22 @@ fp_sarray( return 1; } -/*ARGSUSED*/ int fp_time( - void *obj, - int bit, - int count, - char *fmtstr, - int size, - int arg, - int base, - int array) + void *obj, + int bit, + int count, + char *fmtstr, + int size, + int arg, + int base, + int array) { - int bitpos; - char *c; - int i; - time_t t; + xfs_timestamp_t *ts; + int bitpos; + char *c; + int i; + time_t t; ASSERT(bitoffs(bit) == 0); for (i = 0, bitpos = bit; @@ -135,10 +135,47 @@ fp_time( i++, bitpos += size) { if (array) dbprintf("%d:", i + base); - t = (time_t)getbitval((char *)obj + byteize(bitpos), 0, - sizeof(int32_t) * 8, BVSIGNED); + + ts = obj + byteize(bitpos); + t = (int)be32_to_cpu(ts->t_sec); + c = ctime(&t); dbprintf("%24.24s", c); + + if (i < count - 1) + dbprintf(" "); + } + return 1; +} + +int +fp_nsec( + void *obj, + int bit, + int count, + char *fmtstr, + int size, + int arg, + int base, + int array) +{ + xfs_timestamp_t *ts; + unsigned int nsec; + int bitpos; + int i; + + ASSERT(bitoffs(bit) == 0); + for (i = 0, bitpos = bit; + i < count && !seenint(); + i++, bitpos += size) { + if (array) + dbprintf("%d:", i + base); + + ts = obj + byteize(bitpos); + nsec = (int)be32_to_cpu(ts->t_nsec); + + dbprintf("%u", nsec); + if (i < count - 1) dbprintf(" "); } diff --git a/db/fprint.h b/db/fprint.h index c958dca0ed92..bfeed15ca7c4 100644 --- a/db/fprint.h +++ b/db/fprint.h @@ -15,6 +15,8 @@ extern int fp_sarray(void *obj, int bit, int count, char *fmtstr, int size, int arg, int base, int array); extern int fp_time(void *obj, int bit, int count, char *fmtstr, int size, int arg, int base, int array); +extern int fp_nsec(void *obj, int bit, int count, char *fmtstr, int size, + int arg, int base, int array); extern int fp_uuid(void *obj, int bit, int count, char *fmtstr, int size, int arg, int base, int array); extern int fp_crc(void *obj, int bit, int count, char *fmtstr, int size, diff --git a/db/inode.c b/db/inode.c index f13150c96aa9..cc0e680aadea 100644 --- a/db/inode.c +++ b/db/inode.c @@ -179,10 +179,9 @@ const field_t inode_v3_flds[] = { }; -#define TOFF(f) bitize(offsetof(xfs_timestamp_t, t_ ## f)) const field_t timestamp_flds[] = { - { "sec", FLDT_TIME, OI(TOFF(sec)), C1, 0, TYP_NONE }, - { "nsec", FLDT_NSEC, OI(TOFF(nsec)), C1, 0, TYP_NONE }, + { "sec", FLDT_TIME, OI(0), C1, 0, TYP_NONE }, + { "nsec", FLDT_NSEC, OI(0), C1, 0, TYP_NONE }, { NULL } }; From patchwork Mon Oct 26 23:34:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11859051 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DA748921 for ; Mon, 26 Oct 2020 23:34:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BFC3920872 for ; Mon, 26 Oct 2020 23:34:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="KBviMPBt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406859AbgJZXez (ORCPT ); Mon, 26 Oct 2020 19:34:55 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:54944 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406857AbgJZXez (ORCPT ); Mon, 26 Oct 2020 19:34:55 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNOajr164649; Mon, 26 Oct 2020 23:34:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=dlcLvRhsQhPllJH2ujBxQ8hkw7JYFdhsMw+mkYoS+nc=; b=KBviMPBt4d0sTqb6fdxY6Ze/NYQRlBFL8N3ckgwQqcl2rx1qe5HNbker4owFWF1Uq+cm m4MYeWmnkjH+hJznZZ0qWw+p7qIDWospbYfo2xnqtVMYO9yfG9bagoB6aEVp/RMpaOcp a3KxL1aghok73Rssv3/ra+GLkbKWRIfeN2OBwKqAtUlnjbdmkcGpuqiT9IXtE6IvwsuY oSU/jrkItmZhxqM52OVeFJiqGrNRcXPwR5apZh5qcW9CpnEoi7zsn8iRV7yucDsQFbIN 5PKwxiuJS/bCnQ2/2oYrZ+VkFi4DzR3jcsos0rj8DzIBUaItNSrTQklvk4GGhiftLqVE TA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 34dgm3vuqx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Oct 2020 23:34:52 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNPxkQ110463; Mon, 26 Oct 2020 23:34:52 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 34cx5wfs3r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Oct 2020 23:34:52 +0000 Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 09QNYpCw007621; Mon, 26 Oct 2020 23:34:51 GMT Received: from localhost (/10.159.145.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Oct 2020 16:34:51 -0700 Subject: [PATCH 07/26] xfs_db: refactor quota timer printing From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 26 Oct 2020 16:34:50 -0700 Message-ID: <160375529066.881414.13277074782068895997.stgit@magnolia> In-Reply-To: <160375524618.881414.16347303401529121282.stgit@magnolia> References: <160375524618.881414.16347303401529121282.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 impostorscore=0 adultscore=0 bulkscore=0 spamscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 clxscore=1015 mlxscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Introduce type-specific printing functions to xfs_db to print a quota timer instead of printing a raw int32 value. This is needed to stay ahead of changes that we're going to make to the quota timer format in the following patches. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- db/dquot.c | 6 +++--- db/field.c | 2 ++ db/field.h | 1 + db/fprint.c | 34 ++++++++++++++++++++++++++++++++++ db/fprint.h | 2 ++ 5 files changed, 42 insertions(+), 3 deletions(-) diff --git a/db/dquot.c b/db/dquot.c index 1392aa1673ae..e52000f2e6ee 100644 --- a/db/dquot.c +++ b/db/dquot.c @@ -60,8 +60,8 @@ const field_t disk_dquot_flds[] = { TYP_NONE }, { "bcount", FLDT_QCNT, OI(DOFF(bcount)), C1, 0, TYP_NONE }, { "icount", FLDT_QCNT, OI(DOFF(icount)), C1, 0, TYP_NONE }, - { "itimer", FLDT_INT32D, OI(DOFF(itimer)), C1, 0, TYP_NONE }, - { "btimer", FLDT_INT32D, OI(DOFF(btimer)), C1, 0, TYP_NONE }, + { "itimer", FLDT_QTIMER, OI(DOFF(itimer)), C1, 0, TYP_NONE }, + { "btimer", FLDT_QTIMER, OI(DOFF(btimer)), C1, 0, TYP_NONE }, { "iwarns", FLDT_QWARNCNT, OI(DOFF(iwarns)), C1, 0, TYP_NONE }, { "bwarns", FLDT_QWARNCNT, OI(DOFF(bwarns)), C1, 0, TYP_NONE }, { "pad0", FLDT_UINT32X, OI(DOFF(pad0)), C1, FLD_SKIPALL, TYP_NONE }, @@ -70,7 +70,7 @@ const field_t disk_dquot_flds[] = { { "rtb_softlimit", FLDT_QCNT, OI(DOFF(rtb_softlimit)), C1, 0, TYP_NONE }, { "rtbcount", FLDT_QCNT, OI(DOFF(rtbcount)), C1, 0, TYP_NONE }, - { "rtbtimer", FLDT_INT32D, OI(DOFF(rtbtimer)), C1, 0, TYP_NONE }, + { "rtbtimer", FLDT_QTIMER, OI(DOFF(rtbtimer)), C1, 0, TYP_NONE }, { "rtbwarns", FLDT_QWARNCNT, OI(DOFF(rtbwarns)), C1, 0, TYP_NONE }, { "pad", FLDT_UINT16X, OI(DOFF(pad)), C1, FLD_SKIPALL, TYP_NONE }, { NULL } diff --git a/db/field.c b/db/field.c index f0316aeb4a86..51268938a9d3 100644 --- a/db/field.c +++ b/db/field.c @@ -351,6 +351,8 @@ const ftattr_t ftattrtab[] = { FTARG_SIGNED, NULL, NULL }, { FLDT_TIMESTAMP, "timestamp", NULL, (char *)timestamp_flds, SI(bitsz(xfs_timestamp_t)), 0, NULL, timestamp_flds }, + { FLDT_QTIMER, "qtimer", fp_qtimer, NULL, SI(bitsz(uint32_t)), 0, + NULL, NULL }, { FLDT_UINT1, "uint1", fp_num, "%u", SI(1), 0, NULL, NULL }, { FLDT_UINT16D, "uint16d", fp_num, "%u", SI(bitsz(uint16_t)), 0, NULL, NULL }, diff --git a/db/field.h b/db/field.h index 15065373de39..387c189ec87a 100644 --- a/db/field.h +++ b/db/field.h @@ -170,6 +170,7 @@ typedef enum fldt { FLDT_TIME, FLDT_TIMESTAMP, + FLDT_QTIMER, FLDT_UINT1, FLDT_UINT16D, FLDT_UINT16O, diff --git a/db/fprint.c b/db/fprint.c index feec02c5de99..996e9325ddcc 100644 --- a/db/fprint.c +++ b/db/fprint.c @@ -182,6 +182,40 @@ fp_nsec( return 1; } +int +fp_qtimer( + void *obj, + int bit, + int count, + char *fmtstr, + int size, + int arg, + int base, + int array) +{ + uint32_t sec; + __be32 *t; + int bitpos; + int i; + + ASSERT(bitoffs(bit) == 0); + for (i = 0, bitpos = bit; + i < count && !seenint(); + i++, bitpos += size) { + if (array) + dbprintf("%d:", i + base); + + t = obj + byteize(bitpos); + sec = be32_to_cpu(*t); + + dbprintf("%u", sec); + + if (i < count - 1) + dbprintf(" "); + } + return 1; +} + /*ARGSUSED*/ int fp_uuid( diff --git a/db/fprint.h b/db/fprint.h index bfeed15ca7c4..a1ea935ca531 100644 --- a/db/fprint.h +++ b/db/fprint.h @@ -17,6 +17,8 @@ extern int fp_time(void *obj, int bit, int count, char *fmtstr, int size, int arg, int base, int array); extern int fp_nsec(void *obj, int bit, int count, char *fmtstr, int size, int arg, int base, int array); +extern int fp_qtimer(void *obj, int bit, int count, char *fmtstr, int size, + int arg, int base, int array); extern int fp_uuid(void *obj, int bit, int count, char *fmtstr, int size, int arg, int base, int array); extern int fp_crc(void *obj, int bit, int count, char *fmtstr, int size, From patchwork Mon Oct 26 23:34:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11859055 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1517F921 for ; Mon, 26 Oct 2020 23:35:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F001620872 for ; Mon, 26 Oct 2020 23:35:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="SsBJwFJQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406857AbgJZXfA (ORCPT ); Mon, 26 Oct 2020 19:35:00 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:43400 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406870AbgJZXfA (ORCPT ); Mon, 26 Oct 2020 19:35:00 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNPKe8177114; Mon, 26 Oct 2020 23:34:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=3NHXP+4JQh0wW9IIKowC3aBlxok8mkTroINvGvduzAA=; b=SsBJwFJQn0TLtsPISPz1TDwcIUc3atN+pwkTBeTo1GXCDNZNBFHOnZ8dfeQbUgnlHPhF YeMSzMFv0CKfEWF/Vv8q1l9f/Fh0OZgM0t2kMszGTK7oVYOXtkKmeuxAkFQqoMwu9kmy nUetJ0stz9QoAaSrsqBLIqLhg9m5WaSkSNvtzSdD0JY7QBydPwyziyDmLJaIPO6CQK75 RPX4EYdAffkfbYOxNUrsdchuSYhI/FPzB0GSUglUeSWSBVzCWQ7JaPfS8RdYoSAVr9/L QRrltdAolxjukN6CgT0c2Wl2BR8wBphS98EqfX/lzzmqCRq57paDAJmYDj0MAaxXgwkR aw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 34c9saqd49-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Oct 2020 23:34:58 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNPxFN110502; Mon, 26 Oct 2020 23:34:58 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 34cx5wfs59-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Oct 2020 23:34:58 +0000 Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 09QNYv84007631; Mon, 26 Oct 2020 23:34:57 GMT Received: from localhost (/10.159.145.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Oct 2020 16:34:57 -0700 Subject: [PATCH 08/26] xfs_logprint: refactor timestamp printing From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 26 Oct 2020 16:34:56 -0700 Message-ID: <160375529676.881414.3983778876306819986.stgit@magnolia> In-Reply-To: <160375524618.881414.16347303401529121282.stgit@magnolia> References: <160375524618.881414.16347303401529121282.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 impostorscore=0 mlxlogscore=999 malwarescore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 spamscore=0 phishscore=0 clxscore=1015 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Introduce type-specific printing functions to xfs_logprint to print an xfs_timestamp instead of open-coding the timestamp decoding. This is needed to stay ahead of changes that we're going to make to xfs_timestamp_t in the following patches. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- logprint/log_misc.c | 18 ++++++++++++++++-- logprint/log_print_all.c | 3 +-- logprint/logprint.h | 2 ++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/logprint/log_misc.c b/logprint/log_misc.c index af927cbfa792..a747cbd360af 100644 --- a/logprint/log_misc.c +++ b/logprint/log_misc.c @@ -435,6 +435,21 @@ xlog_print_trans_qoff(char **ptr, uint len) } } /* xlog_print_trans_qoff */ +void +xlog_print_dinode_ts( + struct xfs_log_dinode *ldip, + bool compact) +{ + const char *fmt; + + if (compact) + fmt = _("atime 0x%x mtime 0x%x ctime 0x%x\n"); + else + fmt = _(" atime:%d mtime:%d ctime:%d\n"); + + printf(fmt, ldip->di_atime.t_sec, ldip->di_mtime.t_sec, + ldip->di_ctime.t_sec); +} static void xlog_print_trans_inode_core( @@ -446,8 +461,7 @@ xlog_print_trans_inode_core( (int)ip->di_format); printf(_("nlink %hd uid %d gid %d\n"), ip->di_nlink, ip->di_uid, ip->di_gid); - printf(_("atime 0x%x mtime 0x%x ctime 0x%x\n"), - ip->di_atime.t_sec, ip->di_mtime.t_sec, ip->di_ctime.t_sec); + xlog_print_dinode_ts(ip, true); printf(_("size 0x%llx nblocks 0x%llx extsize 0x%x nextents 0x%x\n"), (unsigned long long)ip->di_size, (unsigned long long)ip->di_nblocks, ip->di_extsize, ip->di_nextents); diff --git a/logprint/log_print_all.c b/logprint/log_print_all.c index 1924a0af70b6..fae531d3e030 100644 --- a/logprint/log_print_all.c +++ b/logprint/log_print_all.c @@ -249,8 +249,7 @@ xlog_recover_print_inode_core( printf(_(" uid:%d gid:%d nlink:%d projid:0x%04x%04x\n"), di->di_uid, di->di_gid, di->di_nlink, di->di_projid_hi, di->di_projid_lo); - printf(_(" atime:%d mtime:%d ctime:%d\n"), - di->di_atime.t_sec, di->di_mtime.t_sec, di->di_ctime.t_sec); + xlog_print_dinode_ts(di, false); printf(_(" flushiter:%d\n"), di->di_flushiter); printf(_(" size:0x%llx nblks:0x%llx exsize:%d " "nextents:%d anextents:%d\n"), (unsigned long long) diff --git a/logprint/logprint.h b/logprint/logprint.h index ee85bfe5f21f..6639e1cf5862 100644 --- a/logprint/logprint.h +++ b/logprint/logprint.h @@ -29,6 +29,8 @@ extern void print_xlog_record_line(void); extern void print_xlog_op_line(void); extern void print_stars(void); +void xlog_print_dinode_ts(struct xfs_log_dinode *ldip, bool compact); + extern struct xfs_inode_log_format * xfs_inode_item_format_convert(char *, uint, struct xfs_inode_log_format *); From patchwork Mon Oct 26 23:35:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11859059 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9B469921 for ; Mon, 26 Oct 2020 23:35:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8034820872 for ; Mon, 26 Oct 2020 23:35:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="LxNGtTQg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406887AbgJZXfP (ORCPT ); Mon, 26 Oct 2020 19:35:15 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:55178 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406881AbgJZXfO (ORCPT ); Mon, 26 Oct 2020 19:35:14 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNOv73164755; Mon, 26 Oct 2020 23:35:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=r40eINVASr8+c4GBu3wmtjDfWYb4wSpOoALZh3yl228=; b=LxNGtTQg3//d3hwf+kQGxr+KdD6N0H29icK0xe3KstqGQi5hKV6fV1SCpmEchSA56S4F 88VR3wcD/tjMB/SczDi6BBNgFKJH9PYlBIrqsruaYUS7LdNgnaotsSvA8mJnSgDVkwrz nArZuZZje3UhkeXS/9nrvlxxjNsv+19dordb9BsVXhGJ7APqtUPcAn6Fn5gb98Fo0rju JM7AiGE0Cn2NY4k2Fso9Fkb1/Q+ReDOduY1w4GR7B33lRdRtYR0g9BzvXydOSk00LTir SBYI8Y7HET4TutSUcfdKk6sCTBUhT7k48H+hv+ox/Q4WARjnjXE9WkntpZVRtrIqMme8 bw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 34dgm3vurj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Oct 2020 23:35:07 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNQN85058358; Mon, 26 Oct 2020 23:35:06 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3030.oracle.com with ESMTP id 34cwukr8ry-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Oct 2020 23:35:06 +0000 Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 09QNZ4mh005813; Mon, 26 Oct 2020 23:35:04 GMT Received: from localhost (/10.159.145.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Oct 2020 16:35:04 -0700 Subject: [PATCH 09/26] xfs: explicitly define inode timestamp range From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: Amir Goldstein , Christoph Hellwig , Allison Collins , Gao Xiang , Dave Chinner , linux-xfs@vger.kernel.org Date: Mon, 26 Oct 2020 16:35:02 -0700 Message-ID: <160375530283.881414.14161839557866465200.stgit@magnolia> In-Reply-To: <160375524618.881414.16347303401529121282.stgit@magnolia> References: <160375524618.881414.16347303401529121282.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 bulkscore=0 spamscore=0 adultscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 impostorscore=0 adultscore=0 bulkscore=0 spamscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 clxscore=1015 mlxscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Source kernel commit: 876fdc7c4f366a709ac272ef3336ae7dce58f2af Formally define the inode timestamp ranges that existing filesystems support, and switch the vfs timetamp ranges to use it. Signed-off-by: Darrick J. Wong Reviewed-by: Amir Goldstein Reviewed-by: Christoph Hellwig Reviewed-by: Allison Collins Reviewed-by: Gao Xiang Reviewed-by: Dave Chinner Signed-off-by: Darrick J. Wong --- include/xfs_fs_compat.h | 4 ++++ libxfs/xfs_format.h | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/include/xfs_fs_compat.h b/include/xfs_fs_compat.h index d0ffc9775875..0077f00cb949 100644 --- a/include/xfs_fs_compat.h +++ b/include/xfs_fs_compat.h @@ -93,4 +93,8 @@ struct timespec64 { long tv_nsec; /* nanoseconds */ }; +#define U32_MAX ((uint32_t)~0U) +#define S32_MAX ((int32_t)(U32_MAX >> 1)) +#define S32_MIN ((int32_t)(-S32_MAX - 1)) + #endif /* __XFS_FS_COMPAT_H__ */ diff --git a/libxfs/xfs_format.h b/libxfs/xfs_format.h index 5a183b6658e6..4a106b6713ad 100644 --- a/libxfs/xfs_format.h +++ b/libxfs/xfs_format.h @@ -848,11 +848,33 @@ struct xfs_agfl { ASSERT(xfs_daddr_to_agno(mp, d) == \ xfs_daddr_to_agno(mp, (d) + (len) - 1))) +/* + * XFS Timestamps + * ============== + * + * Traditional ondisk inode timestamps consist of signed 32-bit counters for + * seconds and nanoseconds; time zero is the Unix epoch, Jan 1 00:00:00 UTC + * 1970, which means that the timestamp epoch is the same as the Unix epoch. + * Therefore, the ondisk min and max defined here can be used directly to + * constrain the incore timestamps on a Unix system. + */ typedef struct xfs_timestamp { __be32 t_sec; /* timestamp seconds */ __be32 t_nsec; /* timestamp nanoseconds */ } xfs_timestamp_t; +/* + * Smallest possible ondisk seconds value with traditional timestamps. This + * corresponds exactly with the incore timestamp Dec 13 20:45:52 UTC 1901. + */ +#define XFS_LEGACY_TIME_MIN ((int64_t)S32_MIN) + +/* + * Largest possible ondisk seconds value with traditional timestamps. This + * corresponds exactly with the incore timestamp Jan 19 03:14:07 UTC 2038. + */ +#define XFS_LEGACY_TIME_MAX ((int64_t)S32_MAX) + /* * On-disk inode structure. * From patchwork Mon Oct 26 23:35:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11859063 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2AABF921 for ; Mon, 26 Oct 2020 23:35:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 11D7F20872 for ; Mon, 26 Oct 2020 23:35:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="vvXf55/9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406891AbgJZXfT (ORCPT ); Mon, 26 Oct 2020 19:35:19 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:43654 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406870AbgJZXfT (ORCPT ); Mon, 26 Oct 2020 19:35:19 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNPA6j177080; Mon, 26 Oct 2020 23:35:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=WfJHmdhMLOv4RZsjQZdgI83NGHF84pPhBHn0I6Idbtc=; b=vvXf55/9Js7wCeIdX62qbefFApJQyFHOFdlC35Pm3OaKSd5h9T0XTrz6DhA9XF5G9UnZ 2BpB7N+8GT1jtVZCvG8dfqj+sUY9Iz7+LWOuEsUdxRyzPXmuDo2nKARY/fxTIGKidGPf sGWCgIzyUP4QkNku8/mpSf5EPthM+w7ozCR0wuohtzINxdI1C4xvDNG0ChO2qvvi+h19 MILd+ZMWVWrkXkZAjLR60gtCEYYJdROcamvQ9HNY2l5j4M8cFhWlNhniZqx0VmG5tbEq 7hhxmPlDZRjRdX01o14mZpmVJkFePFMtj9Lb/Cm09CNTvg/vcCimoFqBMZ0weYeBIpTh rQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 34c9saqd4y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Oct 2020 23:35:14 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNPGLW121087; Mon, 26 Oct 2020 23:35:13 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3030.oracle.com with ESMTP id 34cx6va63r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Oct 2020 23:35:13 +0000 Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 09QNZCjf007776; Mon, 26 Oct 2020 23:35:12 GMT Received: from localhost (/10.159.145.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Oct 2020 16:35:12 -0700 Subject: [PATCH 10/26] xfs: refactor quota expiration timer modification From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: Christoph Hellwig , Allison Collins , Dave Chinner , linux-xfs@vger.kernel.org Date: Mon, 26 Oct 2020 16:35:09 -0700 Message-ID: <160375530933.881414.2110709777506459447.stgit@magnolia> In-Reply-To: <160375524618.881414.16347303401529121282.stgit@magnolia> References: <160375524618.881414.16347303401529121282.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 spamscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 impostorscore=0 mlxlogscore=999 malwarescore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 spamscore=0 phishscore=0 clxscore=1015 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Source kernel commit: 11d8a9190275855f79d62093d789e962cc7228fb Define explicit limits on the range of quota grace period expiration timeouts and refactor the code that modifies the timeouts into helpers that clamp the values appropriately. Note that we'll refactor the default grace period timer separately. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Reviewed-by: Allison Collins Reviewed-by: Dave Chinner Signed-off-by: Darrick J. Wong --- libxfs/xfs_format.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/libxfs/xfs_format.h b/libxfs/xfs_format.h index 4a106b6713ad..afc068944be9 100644 --- a/libxfs/xfs_format.h +++ b/libxfs/xfs_format.h @@ -1199,6 +1199,30 @@ static inline void xfs_dinode_put_rdev(struct xfs_dinode *dip, xfs_dev_t rdev) #define XFS_DQTYPE_ANY (XFS_DQTYPE_REC_MASK) +/* + * XFS Quota Timers + * ================ + * + * Traditional quota grace period expiration timers are an unsigned 32-bit + * seconds counter; time zero is the Unix epoch, Jan 1 00:00:01 UTC 1970. + * Note that an expiration value of zero means that the quota limit has not + * been reached, and therefore no expiration has been set. Therefore, the + * ondisk min and max defined here can be used directly to constrain the incore + * quota expiration timestamps on a Unix system. + */ + +/* + * Smallest possible ondisk quota expiration value with traditional timestamps. + * This corresponds exactly with the incore expiration Jan 1 00:00:01 UTC 1970. + */ +#define XFS_DQ_LEGACY_EXPIRY_MIN ((int64_t)1) + +/* + * Largest possible ondisk quota expiration value with traditional timestamps. + * This corresponds exactly with the incore expiration Feb 7 06:28:15 UTC 2106. + */ +#define XFS_DQ_LEGACY_EXPIRY_MAX ((int64_t)U32_MAX) + /* * This is the main portion of the on-disk representation of quota information * for a user. We pad this with some more expansion room to construct the on From patchwork Mon Oct 26 23:35:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11859067 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B0293921 for ; Mon, 26 Oct 2020 23:35:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 961CC20872 for ; Mon, 26 Oct 2020 23:35:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="tBVwG5wH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406901AbgJZXf2 (ORCPT ); Mon, 26 Oct 2020 19:35:28 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:55312 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406870AbgJZXf2 (ORCPT ); Mon, 26 Oct 2020 19:35:28 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNOXtF164622; Mon, 26 Oct 2020 23:35:21 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=0ZzealUtYQiVOROjVcsz7hy0ZBAX50vjuvZAszJfsLA=; b=tBVwG5wH6NBMgnJWqO4qupq3wUmto/wkI4A5t3+asIxsbaaQlYgy32SM9STiNm1eoCTW nCZzrV0yqjOramh/RYpErN3iFd6LqQrUt2ZRfsn++uOEeB4l2kBp83wRxcjxrr19pUo6 DuL2Zrr97IurUVlNwf6VHZ++qj3FgFtNBGZHyRsNnEKX4ebfcMki9N3/Nm9d7YVH8hDn BPJfYCPQAoXkuyM0WZxBBsAouy61AwHWtK3iLvKPuvpEjXxLtM0eUaW6r8ozPKcxeTah zkBeX4zgkoBsdPnGTAGNENe6jCFCQTBsS4zMCNSN0GQxDxgommWjUoUDVGC8TGv/Prfw Xg== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 34dgm3vus5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Oct 2020 23:35:21 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNQNih058377; Mon, 26 Oct 2020 23:35:20 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3030.oracle.com with ESMTP id 34cwukr8xr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Oct 2020 23:35:20 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 09QNZIS3029190; Mon, 26 Oct 2020 23:35:18 GMT Received: from localhost (/10.159.145.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Oct 2020 16:35:18 -0700 Subject: [PATCH 11/26] xfs: refactor default quota grace period setting code From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: Amir Goldstein , Christoph Hellwig , Allison Collins , Dave Chinner , linux-xfs@vger.kernel.org Date: Mon, 26 Oct 2020 16:35:17 -0700 Message-ID: <160375531739.881414.2197619973398254898.stgit@magnolia> In-Reply-To: <160375524618.881414.16347303401529121282.stgit@magnolia> References: <160375524618.881414.16347303401529121282.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 bulkscore=0 spamscore=0 adultscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 impostorscore=0 adultscore=0 bulkscore=0 spamscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 clxscore=1015 mlxscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Source kernel commit: ccc8e771aa7a80eb047fc263780816ca76dd02a6 Refactor the code that sets the default quota grace period into a helper function so that we can override the ondisk behavior later. Signed-off-by: Darrick J. Wong Reviewed-by: Amir Goldstein Reviewed-by: Christoph Hellwig Reviewed-by: Allison Collins Reviewed-by: Dave Chinner Signed-off-by: Darrick J. Wong --- libxfs/xfs_format.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libxfs/xfs_format.h b/libxfs/xfs_format.h index afc068944be9..a5bf27afdd44 100644 --- a/libxfs/xfs_format.h +++ b/libxfs/xfs_format.h @@ -1209,6 +1209,11 @@ static inline void xfs_dinode_put_rdev(struct xfs_dinode *dip, xfs_dev_t rdev) * been reached, and therefore no expiration has been set. Therefore, the * ondisk min and max defined here can be used directly to constrain the incore * quota expiration timestamps on a Unix system. + * + * The grace period for each quota type is stored in the root dquot (id = 0) + * and is applied to a non-root dquot when it exceeds the soft or hard limits. + * The length of quota grace periods are unsigned 32-bit quantities measured in + * units of seconds. A value of zero means to use the default period. */ /* @@ -1223,6 +1228,14 @@ static inline void xfs_dinode_put_rdev(struct xfs_dinode *dip, xfs_dev_t rdev) */ #define XFS_DQ_LEGACY_EXPIRY_MAX ((int64_t)U32_MAX) +/* + * Default quota grace periods, ranging from zero (use the compiled defaults) + * to ~136 years. These are applied to a non-root dquot that has exceeded + * either limit. + */ +#define XFS_DQ_GRACE_MIN ((int64_t)0) +#define XFS_DQ_GRACE_MAX ((int64_t)U32_MAX) + /* * This is the main portion of the on-disk representation of quota information * for a user. We pad this with some more expansion room to construct the on From patchwork Mon Oct 26 23:35:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11859109 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9272F921 for ; Mon, 26 Oct 2020 23:37:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6CE8D20874 for ; Mon, 26 Oct 2020 23:37:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="KZ+FCifS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407219AbgJZXh4 (ORCPT ); Mon, 26 Oct 2020 19:37:56 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:56770 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407215AbgJZXhz (ORCPT ); Mon, 26 Oct 2020 19:37:55 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNPI0Q164844; Mon, 26 Oct 2020 23:35:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=F9m7sawRhBD5jVzAbPIkd/Uqpy4z7jSDHApzJLLh408=; b=KZ+FCifSs9y6kUcNKD21EjnhlDa9kpipP3A1mSc+wEKrN27pg1PfBkQfcso38p33Ua02 /F7CePNMRhdsCV4ojkkf5mtxWj0TYIvs8YoQDZ+Mu66VtnTIQEJGaZL8zHKbddYC5K7S UtXHOzpH0HHuk7W5V085IzH0qfQHDhzt3McOSJIpmQ9f0B76roazeGZFwYCoh5fCo6MS OkYuE7RFT4FVFwvkfKV91+JsGZugNUFbpTxAU3g5lx3qGzRfbdKUyFAbicKnHKK9BR12 ZnQMBAnoMndgtNYkA8PYnAee+Bdu+3aWS9T0ez/ueL0Dljod9qaeRqZiltkpeH/S02xP 9A== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 34dgm3vus9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Oct 2020 23:35:27 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNQQs0058525; Mon, 26 Oct 2020 23:35:26 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3030.oracle.com with ESMTP id 34cwukr906-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Oct 2020 23:35:26 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 09QNZPGE029199; Mon, 26 Oct 2020 23:35:25 GMT Received: from localhost (/10.159.145.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Oct 2020 16:35:24 -0700 Subject: [PATCH 12/26] xfs: refactor quota timestamp coding From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: Amir Goldstein , Christoph Hellwig , Allison Collins , Dave Chinner , linux-xfs@vger.kernel.org Date: Mon, 26 Oct 2020 16:35:23 -0700 Message-ID: <160375532379.881414.13000848689582360937.stgit@magnolia> In-Reply-To: <160375524618.881414.16347303401529121282.stgit@magnolia> References: <160375524618.881414.16347303401529121282.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 bulkscore=0 spamscore=0 adultscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 impostorscore=0 adultscore=0 bulkscore=0 spamscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 clxscore=1015 mlxscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Source kernel commit: 9f99c8fe551a056c0929dff13cbce62b6b150156 Refactor quota timestamp encoding and decoding into helper functions so that we can add extra behavior in the next patch. Signed-off-by: Darrick J. Wong Reviewed-by: Amir Goldstein Reviewed-by: Christoph Hellwig Reviewed-by: Allison Collins Reviewed-by: Dave Chinner Signed-off-by: Darrick J. Wong --- libxfs/xfs_dquot_buf.c | 18 ++++++++++++++++++ libxfs/xfs_quota_defs.h | 5 +++++ 2 files changed, 23 insertions(+) diff --git a/libxfs/xfs_dquot_buf.c b/libxfs/xfs_dquot_buf.c index b5adb840d015..04f62e31019d 100644 --- a/libxfs/xfs_dquot_buf.c +++ b/libxfs/xfs_dquot_buf.c @@ -286,3 +286,21 @@ const struct xfs_buf_ops xfs_dquot_buf_ra_ops = { .verify_read = xfs_dquot_buf_readahead_verify, .verify_write = xfs_dquot_buf_write_verify, }; + +/* Convert an on-disk timer value into an incore timer value. */ +time64_t +xfs_dquot_from_disk_ts( + struct xfs_disk_dquot *ddq, + __be32 dtimer) +{ + return be32_to_cpu(dtimer); +} + +/* Convert an incore timer value into an on-disk timer value. */ +__be32 +xfs_dquot_to_disk_ts( + struct xfs_dquot *dqp, + time64_t timer) +{ + return cpu_to_be32(timer); +} diff --git a/libxfs/xfs_quota_defs.h b/libxfs/xfs_quota_defs.h index 076bdc7037ee..9a99910d857e 100644 --- a/libxfs/xfs_quota_defs.h +++ b/libxfs/xfs_quota_defs.h @@ -143,4 +143,9 @@ extern int xfs_calc_dquots_per_chunk(unsigned int nbblks); extern void xfs_dqblk_repair(struct xfs_mount *mp, struct xfs_dqblk *dqb, xfs_dqid_t id, xfs_dqtype_t type); +struct xfs_dquot; +time64_t xfs_dquot_from_disk_ts(struct xfs_disk_dquot *ddq, + __be32 dtimer); +__be32 xfs_dquot_to_disk_ts(struct xfs_dquot *ddq, time64_t timer); + #endif /* __XFS_QUOTA_H__ */ From patchwork Mon Oct 26 23:35:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11859069 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 366BD1130 for ; Mon, 26 Oct 2020 23:35:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1848520809 for ; Mon, 26 Oct 2020 23:35:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="QxojL+yY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407073AbgJZXfm (ORCPT ); Mon, 26 Oct 2020 19:35:42 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:43890 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407035AbgJZXfk (ORCPT ); Mon, 26 Oct 2020 19:35:40 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNPI5x177109; Mon, 26 Oct 2020 23:35:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=trgPWoN7J+69A4WHD0RJKUSjEec2ZBQwMmv4NyxzI8o=; b=QxojL+yYQ328YH7swZwPobW8g2V5xiJRHGg6MyjkrDu3JG2qGycU/hbSRSNQu0BJly/E /z/ZCPDEAqPrc/LeYSYMDofVio7kPTpfJkmRKbze38tOsfG5EeZYQex4dAMY1z7DQZ0V nqMAycivyNIFR6PcnvZePG9t3Bnd7H5BrsviwSR2NGkXD/eegyWGwjanhiF9BNiBRrxs ylWyMPykX7oNrrcF78DAgv6sAAbGVCEhGUz83FUNFWTPLyh8gORQjAJe+B+BXL78ioh6 mfy+9dpQKvsfi+t3CbJ8Lt5NBlSNVzBuDZ1EcG/sosmGbldT0xgcZzs8AIgMDrMox4EI hw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 34c9saqd5n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Oct 2020 23:35:34 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNPGjP121019; Mon, 26 Oct 2020 23:35:33 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3030.oracle.com with ESMTP id 34cx6va69r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Oct 2020 23:35:33 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 09QNZW9b007895; Mon, 26 Oct 2020 23:35:32 GMT Received: from localhost (/10.159.145.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Oct 2020 16:35:32 -0700 Subject: [PATCH 13/26] xfs: move xfs_log_dinode_to_disk to the log recovery code From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: Christoph Hellwig , Allison Collins , Gao Xiang , Dave Chinner , linux-xfs@vger.kernel.org Date: Mon, 26 Oct 2020 16:35:30 -0700 Message-ID: <160375533023.881414.1214589420081650952.stgit@magnolia> In-Reply-To: <160375524618.881414.16347303401529121282.stgit@magnolia> References: <160375524618.881414.16347303401529121282.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 spamscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 impostorscore=0 mlxlogscore=999 malwarescore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 spamscore=0 phishscore=0 clxscore=1015 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Source kernel commit: 88947ea0ba713c9b74b212755b3b58242f0e7a56 Move this function to xfs_inode_item_recover.c since there's only one caller of it. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Reviewed-by: Allison Collins Reviewed-by: Gao Xiang Reviewed-by: Dave Chinner Signed-off-by: Darrick J. Wong --- libxfs/xfs_inode_buf.c | 52 ------------------------------------------------ libxfs/xfs_inode_buf.h | 2 -- 2 files changed, 54 deletions(-) diff --git a/libxfs/xfs_inode_buf.c b/libxfs/xfs_inode_buf.c index a1732e509640..e3fdd71a0c63 100644 --- a/libxfs/xfs_inode_buf.c +++ b/libxfs/xfs_inode_buf.c @@ -307,58 +307,6 @@ xfs_inode_to_disk( } } -void -xfs_log_dinode_to_disk( - struct xfs_log_dinode *from, - struct xfs_dinode *to) -{ - to->di_magic = cpu_to_be16(from->di_magic); - to->di_mode = cpu_to_be16(from->di_mode); - to->di_version = from->di_version; - to->di_format = from->di_format; - to->di_onlink = 0; - to->di_uid = cpu_to_be32(from->di_uid); - to->di_gid = cpu_to_be32(from->di_gid); - to->di_nlink = cpu_to_be32(from->di_nlink); - to->di_projid_lo = cpu_to_be16(from->di_projid_lo); - to->di_projid_hi = cpu_to_be16(from->di_projid_hi); - memcpy(to->di_pad, from->di_pad, sizeof(to->di_pad)); - - to->di_atime.t_sec = cpu_to_be32(from->di_atime.t_sec); - to->di_atime.t_nsec = cpu_to_be32(from->di_atime.t_nsec); - to->di_mtime.t_sec = cpu_to_be32(from->di_mtime.t_sec); - to->di_mtime.t_nsec = cpu_to_be32(from->di_mtime.t_nsec); - to->di_ctime.t_sec = cpu_to_be32(from->di_ctime.t_sec); - to->di_ctime.t_nsec = cpu_to_be32(from->di_ctime.t_nsec); - - to->di_size = cpu_to_be64(from->di_size); - to->di_nblocks = cpu_to_be64(from->di_nblocks); - to->di_extsize = cpu_to_be32(from->di_extsize); - to->di_nextents = cpu_to_be32(from->di_nextents); - to->di_anextents = cpu_to_be16(from->di_anextents); - to->di_forkoff = from->di_forkoff; - to->di_aformat = from->di_aformat; - to->di_dmevmask = cpu_to_be32(from->di_dmevmask); - to->di_dmstate = cpu_to_be16(from->di_dmstate); - to->di_flags = cpu_to_be16(from->di_flags); - to->di_gen = cpu_to_be32(from->di_gen); - - if (from->di_version == 3) { - to->di_changecount = cpu_to_be64(from->di_changecount); - to->di_crtime.t_sec = cpu_to_be32(from->di_crtime.t_sec); - to->di_crtime.t_nsec = cpu_to_be32(from->di_crtime.t_nsec); - to->di_flags2 = cpu_to_be64(from->di_flags2); - to->di_cowextsize = cpu_to_be32(from->di_cowextsize); - to->di_ino = cpu_to_be64(from->di_ino); - to->di_lsn = cpu_to_be64(from->di_lsn); - memcpy(to->di_pad2, from->di_pad2, sizeof(to->di_pad2)); - uuid_copy(&to->di_uuid, &from->di_uuid); - to->di_flushiter = 0; - } else { - to->di_flushiter = cpu_to_be16(from->di_flushiter); - } -} - static xfs_failaddr_t xfs_dinode_verify_fork( struct xfs_dinode *dip, diff --git a/libxfs/xfs_inode_buf.h b/libxfs/xfs_inode_buf.h index 6b08b9d060c2..89f7bea8efd6 100644 --- a/libxfs/xfs_inode_buf.h +++ b/libxfs/xfs_inode_buf.h @@ -49,8 +49,6 @@ void xfs_dinode_calc_crc(struct xfs_mount *, struct xfs_dinode *); void xfs_inode_to_disk(struct xfs_inode *ip, struct xfs_dinode *to, xfs_lsn_t lsn); int xfs_inode_from_disk(struct xfs_inode *ip, struct xfs_dinode *from); -void xfs_log_dinode_to_disk(struct xfs_log_dinode *from, - struct xfs_dinode *to); xfs_failaddr_t xfs_dinode_verify(struct xfs_mount *mp, xfs_ino_t ino, struct xfs_dinode *dip); From patchwork Mon Oct 26 23:35:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11859113 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 69626921 for ; Mon, 26 Oct 2020 23:38:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 42B3520B1F for ; Mon, 26 Oct 2020 23:38:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Ykhaoguy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407229AbgJZXiI (ORCPT ); Mon, 26 Oct 2020 19:38:08 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:56886 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407215AbgJZXiI (ORCPT ); Mon, 26 Oct 2020 19:38:08 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNOgRf164668; Mon, 26 Oct 2020 23:35:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=TKBib9/qsBYoEdZdqfK3VY8z6eHwVjQpfxdHJvcvZmw=; b=Ykhaoguyv6L2yw6befXUzxXEY2goqRQGAuf6BUDVgDhrH2QX7/4a1RvpDwCv5YYj3N+a /CqWvTvMM743vs3bjW4tZDpl7K1+qlqSk9/8YjFgCSWaWpaxNuTs1b91Cg07ZlIt9FBY /mvL+DIHWB10mnBhqEfSHjD64GRQFJGWh+BBUZ0jUyEbHxwq+UU44U1mscDiMaEIM7f/ Ow15LJJ/jiOzGrI+jmXD6DeedqaKyzeP+cNcJGqecSrNmnVuaet80t88NrnKZvKv/1dW ttHtugAYGRrhuy7dgjTx8CMJRgHnn73ruBIvzTeFWUvZ0YTaTaJ5AYfjoI5QlsuWFlaV 8A== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 34dgm3vusp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Oct 2020 23:35:40 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNPxC5110498; Mon, 26 Oct 2020 23:35:39 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 34cx5wfsk0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Oct 2020 23:35:39 +0000 Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 09QNZdgE007906; Mon, 26 Oct 2020 23:35:39 GMT Received: from localhost (/10.159.145.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Oct 2020 16:35:39 -0700 Subject: [PATCH 14/26] xfs: redefine xfs_timestamp_t From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: Christoph Hellwig , Gao Xiang , Dave Chinner , linux-xfs@vger.kernel.org Date: Mon, 26 Oct 2020 16:35:37 -0700 Message-ID: <160375533788.881414.4015452916742062688.stgit@magnolia> In-Reply-To: <160375524618.881414.16347303401529121282.stgit@magnolia> References: <160375524618.881414.16347303401529121282.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 impostorscore=0 adultscore=0 bulkscore=0 spamscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 clxscore=1015 mlxscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Source kernel commit: 5a0bb066f60fa02f453d7721844eae59f505c06e Redefine xfs_timestamp_t as a __be64 typedef in preparation for the bigtime functionality. Preserve the legacy structure format so that we can let the compiler take care of masking and shifting. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Reviewed-by: Gao Xiang Reviewed-by: Dave Chinner Signed-off-by: Darrick J. Wong --- db/fprint.c | 10 +++++---- libxfs/libxfs_api_defs.h | 1 + libxfs/xfs_format.h | 10 ++++++--- libxfs/xfs_inode_buf.c | 54 ++++++++++++++++++++++++++++++++-------------- libxfs/xfs_inode_buf.h | 2 ++ repair/dinode.c | 5 +++- 6 files changed, 58 insertions(+), 24 deletions(-) diff --git a/db/fprint.c b/db/fprint.c index 996e9325ddcc..1e8a7b49efe6 100644 --- a/db/fprint.c +++ b/db/fprint.c @@ -123,6 +123,7 @@ fp_time( int base, int array) { + struct timespec64 tv; xfs_timestamp_t *ts; int bitpos; char *c; @@ -137,7 +138,8 @@ fp_time( dbprintf("%d:", i + base); ts = obj + byteize(bitpos); - t = (int)be32_to_cpu(ts->t_sec); + tv = libxfs_inode_from_disk_ts(*ts); + t = tv.tv_sec; c = ctime(&t); dbprintf("%24.24s", c); @@ -159,8 +161,8 @@ fp_nsec( int base, int array) { + struct timespec64 tv; xfs_timestamp_t *ts; - unsigned int nsec; int bitpos; int i; @@ -172,9 +174,9 @@ fp_nsec( dbprintf("%d:", i + base); ts = obj + byteize(bitpos); - nsec = (int)be32_to_cpu(ts->t_nsec); + tv = libxfs_inode_from_disk_ts(*ts); - dbprintf("%u", nsec); + dbprintf("%u", tv.tv_nsec); if (i < count - 1) dbprintf(" "); diff --git a/libxfs/libxfs_api_defs.h b/libxfs/libxfs_api_defs.h index 7029d0e7daf7..40da71ab3163 100644 --- a/libxfs/libxfs_api_defs.h +++ b/libxfs/libxfs_api_defs.h @@ -116,6 +116,7 @@ #define xfs_inobt_maxrecs libxfs_inobt_maxrecs #define xfs_inobt_stage_cursor libxfs_inobt_stage_cursor #define xfs_inode_from_disk libxfs_inode_from_disk +#define xfs_inode_from_disk_ts libxfs_inode_from_disk_ts #define xfs_inode_to_disk libxfs_inode_to_disk #define xfs_inode_validate_cowextsize libxfs_inode_validate_cowextsize #define xfs_inode_validate_extsize libxfs_inode_validate_extsize diff --git a/libxfs/xfs_format.h b/libxfs/xfs_format.h index a5bf27afdd44..ca11a3eb56dd 100644 --- a/libxfs/xfs_format.h +++ b/libxfs/xfs_format.h @@ -856,12 +856,16 @@ struct xfs_agfl { * seconds and nanoseconds; time zero is the Unix epoch, Jan 1 00:00:00 UTC * 1970, which means that the timestamp epoch is the same as the Unix epoch. * Therefore, the ondisk min and max defined here can be used directly to - * constrain the incore timestamps on a Unix system. + * constrain the incore timestamps on a Unix system. Note that we actually + * encode a __be64 value on disk. */ -typedef struct xfs_timestamp { +typedef __be64 xfs_timestamp_t; + +/* Legacy timestamp encoding format. */ +struct xfs_legacy_timestamp { __be32 t_sec; /* timestamp seconds */ __be32 t_nsec; /* timestamp nanoseconds */ -} xfs_timestamp_t; +}; /* * Smallest possible ondisk seconds value with traditional timestamps. This diff --git a/libxfs/xfs_inode_buf.c b/libxfs/xfs_inode_buf.c index e3fdd71a0c63..1b9f63ebe9f9 100644 --- a/libxfs/xfs_inode_buf.c +++ b/libxfs/xfs_inode_buf.c @@ -154,6 +154,21 @@ xfs_imap_to_bp( return 0; } +/* Convert an ondisk timestamp to an incore timestamp. */ +struct timespec64 +xfs_inode_from_disk_ts( + const xfs_timestamp_t ts) +{ + struct timespec64 tv; + struct xfs_legacy_timestamp *lts; + + lts = (struct xfs_legacy_timestamp *)&ts; + tv.tv_sec = (int)be32_to_cpu(lts->t_sec); + tv.tv_nsec = (int)be32_to_cpu(lts->t_nsec); + + return tv; +} + int xfs_inode_from_disk( struct xfs_inode *ip, @@ -208,12 +223,9 @@ xfs_inode_from_disk( * a time before epoch is converted to a time long after epoch * on 64 bit systems. */ - inode->i_atime.tv_sec = (int)be32_to_cpu(from->di_atime.t_sec); - inode->i_atime.tv_nsec = (int)be32_to_cpu(from->di_atime.t_nsec); - inode->i_mtime.tv_sec = (int)be32_to_cpu(from->di_mtime.t_sec); - inode->i_mtime.tv_nsec = (int)be32_to_cpu(from->di_mtime.t_nsec); - inode->i_ctime.tv_sec = (int)be32_to_cpu(from->di_ctime.t_sec); - inode->i_ctime.tv_nsec = (int)be32_to_cpu(from->di_ctime.t_nsec); + inode->i_atime = xfs_inode_from_disk_ts(from->di_atime); + inode->i_mtime = xfs_inode_from_disk_ts(from->di_mtime); + inode->i_ctime = xfs_inode_from_disk_ts(from->di_ctime); to->di_size = be64_to_cpu(from->di_size); to->di_nblocks = be64_to_cpu(from->di_nblocks); @@ -226,8 +238,7 @@ xfs_inode_from_disk( if (xfs_sb_version_has_v3inode(&ip->i_mount->m_sb)) { inode_set_iversion_queried(inode, be64_to_cpu(from->di_changecount)); - to->di_crtime.tv_sec = be32_to_cpu(from->di_crtime.t_sec); - to->di_crtime.tv_nsec = be32_to_cpu(from->di_crtime.t_nsec); + to->di_crtime = xfs_inode_from_disk_ts(from->di_crtime); to->di_flags2 = be64_to_cpu(from->di_flags2); to->di_cowextsize = be32_to_cpu(from->di_cowextsize); } @@ -249,6 +260,21 @@ xfs_inode_from_disk( return error; } +/* Convert an incore timestamp to an ondisk timestamp. */ +static inline xfs_timestamp_t +xfs_inode_to_disk_ts( + const struct timespec64 tv) +{ + struct xfs_legacy_timestamp *lts; + xfs_timestamp_t ts; + + lts = (struct xfs_legacy_timestamp *)&ts; + lts->t_sec = cpu_to_be32(tv.tv_sec); + lts->t_nsec = cpu_to_be32(tv.tv_nsec); + + return ts; +} + void xfs_inode_to_disk( struct xfs_inode *ip, @@ -268,12 +294,9 @@ xfs_inode_to_disk( to->di_projid_hi = cpu_to_be16(from->di_projid >> 16); memset(to->di_pad, 0, sizeof(to->di_pad)); - to->di_atime.t_sec = cpu_to_be32(inode->i_atime.tv_sec); - to->di_atime.t_nsec = cpu_to_be32(inode->i_atime.tv_nsec); - to->di_mtime.t_sec = cpu_to_be32(inode->i_mtime.tv_sec); - to->di_mtime.t_nsec = cpu_to_be32(inode->i_mtime.tv_nsec); - to->di_ctime.t_sec = cpu_to_be32(inode->i_ctime.tv_sec); - to->di_ctime.t_nsec = cpu_to_be32(inode->i_ctime.tv_nsec); + to->di_atime = xfs_inode_to_disk_ts(inode->i_atime); + to->di_mtime = xfs_inode_to_disk_ts(inode->i_mtime); + to->di_ctime = xfs_inode_to_disk_ts(inode->i_ctime); to->di_nlink = cpu_to_be32(inode->i_nlink); to->di_gen = cpu_to_be32(inode->i_generation); to->di_mode = cpu_to_be16(inode->i_mode); @@ -292,8 +315,7 @@ xfs_inode_to_disk( if (xfs_sb_version_has_v3inode(&ip->i_mount->m_sb)) { to->di_version = 3; to->di_changecount = cpu_to_be64(inode_peek_iversion(inode)); - to->di_crtime.t_sec = cpu_to_be32(from->di_crtime.tv_sec); - to->di_crtime.t_nsec = cpu_to_be32(from->di_crtime.tv_nsec); + to->di_crtime = xfs_inode_to_disk_ts(from->di_crtime); to->di_flags2 = cpu_to_be64(from->di_flags2); to->di_cowextsize = cpu_to_be32(from->di_cowextsize); to->di_ino = cpu_to_be64(ip->i_ino); diff --git a/libxfs/xfs_inode_buf.h b/libxfs/xfs_inode_buf.h index 89f7bea8efd6..3060ecd24a2e 100644 --- a/libxfs/xfs_inode_buf.h +++ b/libxfs/xfs_inode_buf.h @@ -58,4 +58,6 @@ xfs_failaddr_t xfs_inode_validate_cowextsize(struct xfs_mount *mp, uint32_t cowextsize, uint16_t mode, uint16_t flags, uint64_t flags2); +struct timespec64 xfs_inode_from_disk_ts(const xfs_timestamp_t ts); + #endif /* __XFS_INODE_BUF_H__ */ diff --git a/repair/dinode.c b/repair/dinode.c index 95e57b5318b5..c1d9d9727d62 100644 --- a/repair/dinode.c +++ b/repair/dinode.c @@ -2167,9 +2167,12 @@ static void check_nsec( const char *name, xfs_ino_t lino, - struct xfs_timestamp *t, + xfs_timestamp_t *ts, int *dirty) { + struct xfs_legacy_timestamp *t; + + t = (struct xfs_legacy_timestamp *)ts; if (be32_to_cpu(t->t_nsec) < NSEC_PER_SEC) return; From patchwork Mon Oct 26 23:35:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11859077 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4AC0A921 for ; Mon, 26 Oct 2020 23:35:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2FF0D20872 for ; Mon, 26 Oct 2020 23:35:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="HFtLRP/z" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407110AbgJZXfw (ORCPT ); Mon, 26 Oct 2020 19:35:52 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:37466 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407107AbgJZXfw (ORCPT ); Mon, 26 Oct 2020 19:35:52 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNPunu158448; Mon, 26 Oct 2020 23:35:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=Rl//5LkZj4CZq8MLMo//Fp+MMP6Gy30JtK81YYwNn30=; b=HFtLRP/zOgwfqICrzOPXSs4LwYPx+Cign6wmLwZJ0ZqjKJlolR36v3xzynoTgGkuFWAF wbtYavhSS7rFKspr6wBTUX+4T0hZxNAd41L7dMZO1de6KEKmIJjzitdvn58AQasXegUn UpAgO43oO/czYNfLjiMnXqYtdBCjI7MFw2MbcqzFYj7DyrmdWh6lQ8ctyhU7arqHwwk7 Hr+TIUSc0re+jMZ32bCzD8rN+Tydv8omdvsRksSYCd6WfhhM/0tP/oThlqCkb1xyyy+U nd4z3/zPTBMrUzAgZb/0tTpzdw06u5GlU7jMx2mzbbTp7wWmo6HYZ+dDPJ1zgsYk98EK Pg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 34cc7kq8mv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Oct 2020 23:35:47 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNQEfG032501; Mon, 26 Oct 2020 23:35:46 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3020.oracle.com with ESMTP id 34cx1q2c3n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Oct 2020 23:35:46 +0000 Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 09QNZjEE006094; Mon, 26 Oct 2020 23:35:45 GMT Received: from localhost (/10.159.145.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Oct 2020 16:35:45 -0700 Subject: [PATCH 15/26] xfs: redefine xfs_ictimestamp_t From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: Christoph Hellwig , Gao Xiang , Dave Chinner , linux-xfs@vger.kernel.org Date: Mon, 26 Oct 2020 16:35:44 -0700 Message-ID: <160375534433.881414.13405550882427665693.stgit@magnolia> In-Reply-To: <160375524618.881414.16347303401529121282.stgit@magnolia> References: <160375524618.881414.16347303401529121282.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 bulkscore=0 suspectscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 adultscore=0 malwarescore=0 spamscore=0 clxscore=1015 mlxscore=0 suspectscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Source kernel commit: 30e05599219f3c15bd5f24190af0e33cdb4a00e5 Redefine xfs_ictimestamp_t as a uint64_t typedef in preparation for the bigtime functionality. Preserve the legacy structure format so that we can let the compiler take care of the masking and shifting. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Reviewed-by: Gao Xiang Reviewed-by: Dave Chinner Signed-off-by: Darrick J. Wong --- libxfs/xfs_log_format.h | 7 +++++-- logprint/log_misc.c | 19 +++++++++++++++---- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/libxfs/xfs_log_format.h b/libxfs/xfs_log_format.h index e3400c9c71cd..8bd00da6d2a4 100644 --- a/libxfs/xfs_log_format.h +++ b/libxfs/xfs_log_format.h @@ -368,10 +368,13 @@ static inline int xfs_ilog_fdata(int w) * directly mirrors the xfs_dinode structure as it must contain all the same * information. */ -typedef struct xfs_ictimestamp { +typedef uint64_t xfs_ictimestamp_t; + +/* Legacy timestamp encoding format. */ +struct xfs_legacy_ictimestamp { int32_t t_sec; /* timestamp seconds */ int32_t t_nsec; /* timestamp nanoseconds */ -} xfs_ictimestamp_t; +}; /* * Define the format of the inode core that is logged. This structure must be diff --git a/logprint/log_misc.c b/logprint/log_misc.c index a747cbd360af..47976cdf328a 100644 --- a/logprint/log_misc.c +++ b/logprint/log_misc.c @@ -435,6 +435,16 @@ xlog_print_trans_qoff(char **ptr, uint len) } } /* xlog_print_trans_qoff */ +static inline time64_t +xlog_extract_dinode_ts( + const xfs_ictimestamp_t its) +{ + struct xfs_legacy_ictimestamp *lits; + + lits = (struct xfs_legacy_ictimestamp *)&its; + return (time64_t)lits->t_sec; +} + void xlog_print_dinode_ts( struct xfs_log_dinode *ldip, @@ -443,12 +453,13 @@ xlog_print_dinode_ts( const char *fmt; if (compact) - fmt = _("atime 0x%x mtime 0x%x ctime 0x%x\n"); + fmt = _("atime 0x%llx mtime 0x%llx ctime 0x%llx\n"); else - fmt = _(" atime:%d mtime:%d ctime:%d\n"); + fmt = _(" atime:%lld mtime:%lld ctime:%lld\n"); - printf(fmt, ldip->di_atime.t_sec, ldip->di_mtime.t_sec, - ldip->di_ctime.t_sec); + printf(fmt, xlog_extract_dinode_ts(ldip->di_atime), + xlog_extract_dinode_ts(ldip->di_mtime), + xlog_extract_dinode_ts(ldip->di_ctime)); } static void From patchwork Mon Oct 26 23:35:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11859083 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DB4E0921 for ; Mon, 26 Oct 2020 23:36:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B44DD20872 for ; Mon, 26 Oct 2020 23:36:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="dcIFPVNK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407127AbgJZXgC (ORCPT ); Mon, 26 Oct 2020 19:36:02 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:37592 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407121AbgJZXgC (ORCPT ); Mon, 26 Oct 2020 19:36:02 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNP028157929; Mon, 26 Oct 2020 23:35:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=n4RJBMSqDEU1q1h6RYXSGPl1mrI4tLeb1nhaq6x5hEs=; b=dcIFPVNKM+e3uPRQyUJvwKghE7CTvCFFcp+/Z5+2x6HFCrUrlifKkwtIl5X4TKLevRlE MEW6eAanaO/NZ1DveoSpMe+GjPEoFiagquSVrjjlHeRkn+IwV4pG6BmUccPT1PEBv15f 6czA0aSIHyOmFRew4ypuLNxP3YP66z/Abfwo1MvP4zc9qZIKzTQvgVXgnZ8JQFl+zgzl Z7cJx6eoiuexwQwHAkefIRtCwb/e0zashRXqjSVHBmRbcbjZl6xxFxdU7mjzkz5tV/BN /Ssj80FgsEUWwyTu1lDgnBqygCs/B/CYU3IKyy9/k+MVf9QGGMXzWoKoDoy+/bpeyGh0 pQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 34cc7kq8n5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Oct 2020 23:35:54 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNQNkE058374; Mon, 26 Oct 2020 23:35:53 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3030.oracle.com with ESMTP id 34cwukr98m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Oct 2020 23:35:53 +0000 Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 09QNZqnx006201; Mon, 26 Oct 2020 23:35:52 GMT Received: from localhost (/10.159.145.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Oct 2020 16:35:51 -0700 Subject: [PATCH 16/26] xfs: widen ondisk inode timestamps to deal with y2038+ From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: Christoph Hellwig , Gao Xiang , Dave Chinner , linux-xfs@vger.kernel.org Date: Mon, 26 Oct 2020 16:35:50 -0700 Message-ID: <160375535063.881414.15265400787138494976.stgit@magnolia> In-Reply-To: <160375524618.881414.16347303401529121282.stgit@magnolia> References: <160375524618.881414.16347303401529121282.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 bulkscore=0 spamscore=0 adultscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 adultscore=0 malwarescore=0 spamscore=0 clxscore=1015 mlxscore=0 suspectscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Source kernel commit: f93e5436f0ee5a85eaa3a86d2614d215873fb18b Redesign the ondisk inode timestamps to be a simple unsigned 64-bit counter of nanoseconds since 14 Dec 1901 (i.e. the minimum time in the 32-bit unix time epoch). This enables us to handle dates up to 2486, which solves the y2038 problem. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Reviewed-by: Gao Xiang Reviewed-by: Dave Chinner Signed-off-by: Darrick J. Wong --- db/fprint.c | 4 +-- include/xfs_inode.h | 5 +++ libxfs/xfs_format.h | 70 +++++++++++++++++++++++++++++++++++++++++++++- libxfs/xfs_fs.h | 1 + libxfs/xfs_ialloc.c | 4 +++ libxfs/xfs_inode_buf.c | 40 +++++++++++++++++++++----- libxfs/xfs_inode_buf.h | 13 ++++++++- libxfs/xfs_sb.c | 2 + libxfs/xfs_shared.h | 3 ++ libxfs/xfs_trans_inode.c | 11 +++++++ 10 files changed, 141 insertions(+), 12 deletions(-) diff --git a/db/fprint.c b/db/fprint.c index 1e8a7b49efe6..7ceab29cc608 100644 --- a/db/fprint.c +++ b/db/fprint.c @@ -138,7 +138,7 @@ fp_time( dbprintf("%d:", i + base); ts = obj + byteize(bitpos); - tv = libxfs_inode_from_disk_ts(*ts); + tv = libxfs_inode_from_disk_ts(obj, *ts); t = tv.tv_sec; c = ctime(&t); @@ -174,7 +174,7 @@ fp_nsec( dbprintf("%d:", i + base); ts = obj + byteize(bitpos); - tv = libxfs_inode_from_disk_ts(*ts); + tv = libxfs_inode_from_disk_ts(obj, *ts); dbprintf("%u", tv.tv_nsec); diff --git a/include/xfs_inode.h b/include/xfs_inode.h index 12676cb30bf2..40310df6a785 100644 --- a/include/xfs_inode.h +++ b/include/xfs_inode.h @@ -140,6 +140,11 @@ static inline bool xfs_is_reflink_inode(struct xfs_inode *ip) return ip->i_d.di_flags2 & XFS_DIFLAG2_REFLINK; } +static inline bool xfs_inode_has_bigtime(struct xfs_inode *ip) +{ + return ip->i_d.di_flags2 & XFS_DIFLAG2_BIGTIME; +} + typedef struct cred { uid_t cr_uid; gid_t cr_gid; diff --git a/libxfs/xfs_format.h b/libxfs/xfs_format.h index ca11a3eb56dd..dbc7008e4498 100644 --- a/libxfs/xfs_format.h +++ b/libxfs/xfs_format.h @@ -467,6 +467,7 @@ xfs_sb_has_ro_compat_feature( #define XFS_SB_FEAT_INCOMPAT_FTYPE (1 << 0) /* filetype in dirent */ #define XFS_SB_FEAT_INCOMPAT_SPINODES (1 << 1) /* sparse inode chunks */ #define XFS_SB_FEAT_INCOMPAT_META_UUID (1 << 2) /* metadata UUID */ +#define XFS_SB_FEAT_INCOMPAT_BIGTIME (1 << 3) /* large timestamps */ #define XFS_SB_FEAT_INCOMPAT_ALL \ (XFS_SB_FEAT_INCOMPAT_FTYPE| \ XFS_SB_FEAT_INCOMPAT_SPINODES| \ @@ -565,6 +566,12 @@ static inline bool xfs_sb_version_hasreflink(struct xfs_sb *sbp) (sbp->sb_features_ro_compat & XFS_SB_FEAT_RO_COMPAT_REFLINK); } +static inline bool xfs_sb_version_hasbigtime(struct xfs_sb *sbp) +{ + return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 && + (sbp->sb_features_incompat & XFS_SB_FEAT_INCOMPAT_BIGTIME); +} + /* * Inode btree block counter. We record the number of inobt and finobt blocks * in the AGI header so that we can skip the finobt walk at mount time when @@ -858,6 +865,13 @@ struct xfs_agfl { * Therefore, the ondisk min and max defined here can be used directly to * constrain the incore timestamps on a Unix system. Note that we actually * encode a __be64 value on disk. + * + * When the bigtime feature is enabled, ondisk inode timestamps become an + * unsigned 64-bit nanoseconds counter. This means that the bigtime inode + * timestamp epoch is the start of the classic timestamp range, which is + * Dec 31 20:45:52 UTC 1901. Because the epochs are not the same, callers + * /must/ use the bigtime conversion functions when encoding and decoding raw + * timestamps. */ typedef __be64 xfs_timestamp_t; @@ -879,6 +893,50 @@ struct xfs_legacy_timestamp { */ #define XFS_LEGACY_TIME_MAX ((int64_t)S32_MAX) +/* + * Smallest possible ondisk seconds value with bigtime timestamps. This + * corresponds (after conversion to a Unix timestamp) with the traditional + * minimum timestamp of Dec 13 20:45:52 UTC 1901. + */ +#define XFS_BIGTIME_TIME_MIN ((int64_t)0) + +/* + * Largest supported ondisk seconds value with bigtime timestamps. This + * corresponds (after conversion to a Unix timestamp) with an incore timestamp + * of Jul 2 20:20:24 UTC 2486. + * + * We round down the ondisk limit so that the bigtime quota and inode max + * timestamps will be the same. + */ +#define XFS_BIGTIME_TIME_MAX ((int64_t)((-1ULL / NSEC_PER_SEC) & ~0x3ULL)) + +/* + * Bigtime epoch is set exactly to the minimum time value that a traditional + * 32-bit timestamp can represent when using the Unix epoch as a reference. + * Hence the Unix epoch is at a fixed offset into the supported bigtime + * timestamp range. + * + * The bigtime epoch also matches the minimum value an on-disk 32-bit XFS + * timestamp can represent so we will not lose any fidelity in converting + * to/from unix and bigtime timestamps. + * + * The following conversion factor converts a seconds counter from the Unix + * epoch to the bigtime epoch. + */ +#define XFS_BIGTIME_EPOCH_OFFSET (-(int64_t)S32_MIN) + +/* Convert a timestamp from the Unix epoch to the bigtime epoch. */ +static inline uint64_t xfs_unix_to_bigtime(time64_t unix_seconds) +{ + return (uint64_t)unix_seconds + XFS_BIGTIME_EPOCH_OFFSET; +} + +/* Convert a timestamp from the bigtime epoch to the Unix epoch. */ +static inline time64_t xfs_bigtime_to_unix(uint64_t ondisk_seconds) +{ + return (time64_t)ondisk_seconds - XFS_BIGTIME_EPOCH_OFFSET; +} + /* * On-disk inode structure. * @@ -1104,12 +1162,22 @@ static inline void xfs_dinode_put_rdev(struct xfs_dinode *dip, xfs_dev_t rdev) #define XFS_DIFLAG2_DAX_BIT 0 /* use DAX for this inode */ #define XFS_DIFLAG2_REFLINK_BIT 1 /* file's blocks may be shared */ #define XFS_DIFLAG2_COWEXTSIZE_BIT 2 /* copy on write extent size hint */ +#define XFS_DIFLAG2_BIGTIME_BIT 3 /* big timestamps */ + #define XFS_DIFLAG2_DAX (1 << XFS_DIFLAG2_DAX_BIT) #define XFS_DIFLAG2_REFLINK (1 << XFS_DIFLAG2_REFLINK_BIT) #define XFS_DIFLAG2_COWEXTSIZE (1 << XFS_DIFLAG2_COWEXTSIZE_BIT) +#define XFS_DIFLAG2_BIGTIME (1 << XFS_DIFLAG2_BIGTIME_BIT) #define XFS_DIFLAG2_ANY \ - (XFS_DIFLAG2_DAX | XFS_DIFLAG2_REFLINK | XFS_DIFLAG2_COWEXTSIZE) + (XFS_DIFLAG2_DAX | XFS_DIFLAG2_REFLINK | XFS_DIFLAG2_COWEXTSIZE | \ + XFS_DIFLAG2_BIGTIME) + +static inline bool xfs_dinode_has_bigtime(const struct xfs_dinode *dip) +{ + return dip->di_version >= 3 && + (dip->di_flags2 & cpu_to_be64(XFS_DIFLAG2_BIGTIME)); +} /* * Inode number format: diff --git a/libxfs/xfs_fs.h b/libxfs/xfs_fs.h index 84bcffa87753..2a2e3cfd94f0 100644 --- a/libxfs/xfs_fs.h +++ b/libxfs/xfs_fs.h @@ -249,6 +249,7 @@ typedef struct xfs_fsop_resblks { #define XFS_FSOP_GEOM_FLAGS_SPINODES (1 << 18) /* sparse inode chunks */ #define XFS_FSOP_GEOM_FLAGS_RMAPBT (1 << 19) /* reverse mapping btree */ #define XFS_FSOP_GEOM_FLAGS_REFLINK (1 << 20) /* files can share blocks */ +#define XFS_FSOP_GEOM_FLAGS_BIGTIME (1 << 21) /* 64-bit nsec timestamps */ /* * Minimum and maximum sizes need for growth checks. diff --git a/libxfs/xfs_ialloc.c b/libxfs/xfs_ialloc.c index 8adeb10e5d2e..d78f960c6d44 100644 --- a/libxfs/xfs_ialloc.c +++ b/libxfs/xfs_ialloc.c @@ -2802,6 +2802,10 @@ xfs_ialloc_setup_geometry( uint64_t icount; uint inodes; + igeo->new_diflags2 = 0; + if (xfs_sb_version_hasbigtime(&mp->m_sb)) + igeo->new_diflags2 |= XFS_DIFLAG2_BIGTIME; + /* Compute inode btree geometry. */ igeo->agino_log = sbp->sb_inopblog + sbp->sb_agblklog; igeo->inobt_mxr[0] = xfs_inobt_maxrecs(mp, sbp->sb_blocksize, 1); diff --git a/libxfs/xfs_inode_buf.c b/libxfs/xfs_inode_buf.c index 1b9f63ebe9f9..6722d5afddac 100644 --- a/libxfs/xfs_inode_buf.c +++ b/libxfs/xfs_inode_buf.c @@ -154,14 +154,29 @@ xfs_imap_to_bp( return 0; } +static inline struct timespec64 xfs_inode_decode_bigtime(uint64_t ts) +{ + struct timespec64 tv; + uint32_t n; + + tv.tv_sec = xfs_bigtime_to_unix(div_u64_rem(ts, NSEC_PER_SEC, &n)); + tv.tv_nsec = n; + + return tv; +} + /* Convert an ondisk timestamp to an incore timestamp. */ struct timespec64 xfs_inode_from_disk_ts( + struct xfs_dinode *dip, const xfs_timestamp_t ts) { struct timespec64 tv; struct xfs_legacy_timestamp *lts; + if (xfs_dinode_has_bigtime(dip)) + return xfs_inode_decode_bigtime(be64_to_cpu(ts)); + lts = (struct xfs_legacy_timestamp *)&ts; tv.tv_sec = (int)be32_to_cpu(lts->t_sec); tv.tv_nsec = (int)be32_to_cpu(lts->t_nsec); @@ -223,9 +238,9 @@ xfs_inode_from_disk( * a time before epoch is converted to a time long after epoch * on 64 bit systems. */ - inode->i_atime = xfs_inode_from_disk_ts(from->di_atime); - inode->i_mtime = xfs_inode_from_disk_ts(from->di_mtime); - inode->i_ctime = xfs_inode_from_disk_ts(from->di_ctime); + inode->i_atime = xfs_inode_from_disk_ts(from, from->di_atime); + inode->i_mtime = xfs_inode_from_disk_ts(from, from->di_mtime); + inode->i_ctime = xfs_inode_from_disk_ts(from, from->di_ctime); to->di_size = be64_to_cpu(from->di_size); to->di_nblocks = be64_to_cpu(from->di_nblocks); @@ -238,7 +253,7 @@ xfs_inode_from_disk( if (xfs_sb_version_has_v3inode(&ip->i_mount->m_sb)) { inode_set_iversion_queried(inode, be64_to_cpu(from->di_changecount)); - to->di_crtime = xfs_inode_from_disk_ts(from->di_crtime); + to->di_crtime = xfs_inode_from_disk_ts(from, from->di_crtime); to->di_flags2 = be64_to_cpu(from->di_flags2); to->di_cowextsize = be32_to_cpu(from->di_cowextsize); } @@ -263,11 +278,15 @@ xfs_inode_from_disk( /* Convert an incore timestamp to an ondisk timestamp. */ static inline xfs_timestamp_t xfs_inode_to_disk_ts( + struct xfs_inode *ip, const struct timespec64 tv) { struct xfs_legacy_timestamp *lts; xfs_timestamp_t ts; + if (xfs_inode_has_bigtime(ip)) + return cpu_to_be64(xfs_inode_encode_bigtime(tv)); + lts = (struct xfs_legacy_timestamp *)&ts; lts->t_sec = cpu_to_be32(tv.tv_sec); lts->t_nsec = cpu_to_be32(tv.tv_nsec); @@ -294,9 +313,9 @@ xfs_inode_to_disk( to->di_projid_hi = cpu_to_be16(from->di_projid >> 16); memset(to->di_pad, 0, sizeof(to->di_pad)); - to->di_atime = xfs_inode_to_disk_ts(inode->i_atime); - to->di_mtime = xfs_inode_to_disk_ts(inode->i_mtime); - to->di_ctime = xfs_inode_to_disk_ts(inode->i_ctime); + to->di_atime = xfs_inode_to_disk_ts(ip, inode->i_atime); + to->di_mtime = xfs_inode_to_disk_ts(ip, inode->i_mtime); + to->di_ctime = xfs_inode_to_disk_ts(ip, inode->i_ctime); to->di_nlink = cpu_to_be32(inode->i_nlink); to->di_gen = cpu_to_be32(inode->i_generation); to->di_mode = cpu_to_be16(inode->i_mode); @@ -315,7 +334,7 @@ xfs_inode_to_disk( if (xfs_sb_version_has_v3inode(&ip->i_mount->m_sb)) { to->di_version = 3; to->di_changecount = cpu_to_be64(inode_peek_iversion(inode)); - to->di_crtime = xfs_inode_to_disk_ts(from->di_crtime); + to->di_crtime = xfs_inode_to_disk_ts(ip, from->di_crtime); to->di_flags2 = cpu_to_be64(from->di_flags2); to->di_cowextsize = cpu_to_be32(from->di_cowextsize); to->di_ino = cpu_to_be64(ip->i_ino); @@ -535,6 +554,11 @@ xfs_dinode_verify( if (fa) return fa; + /* bigtime iflag can only happen on bigtime filesystems */ + if (xfs_dinode_has_bigtime(dip) && + !xfs_sb_version_hasbigtime(&mp->m_sb)) + return __this_address; + return NULL; } diff --git a/libxfs/xfs_inode_buf.h b/libxfs/xfs_inode_buf.h index 3060ecd24a2e..536666143fe7 100644 --- a/libxfs/xfs_inode_buf.h +++ b/libxfs/xfs_inode_buf.h @@ -32,6 +32,11 @@ struct xfs_icdinode { struct timespec64 di_crtime; /* time created */ }; +static inline bool xfs_icdinode_has_bigtime(const struct xfs_icdinode *icd) +{ + return icd->di_flags2 & XFS_DIFLAG2_BIGTIME; +} + /* * Inode location information. Stored in the inode and passed to * xfs_imap_to_bp() to get a buffer and dinode for a given inode. @@ -58,6 +63,12 @@ xfs_failaddr_t xfs_inode_validate_cowextsize(struct xfs_mount *mp, uint32_t cowextsize, uint16_t mode, uint16_t flags, uint64_t flags2); -struct timespec64 xfs_inode_from_disk_ts(const xfs_timestamp_t ts); +static inline uint64_t xfs_inode_encode_bigtime(struct timespec64 tv) +{ + return xfs_unix_to_bigtime(tv.tv_sec) * NSEC_PER_SEC + tv.tv_nsec; +} + +struct timespec64 xfs_inode_from_disk_ts(struct xfs_dinode *dip, + const xfs_timestamp_t ts); #endif /* __XFS_INODE_BUF_H__ */ diff --git a/libxfs/xfs_sb.c b/libxfs/xfs_sb.c index 7c7e56a8979c..fb2212b89912 100644 --- a/libxfs/xfs_sb.c +++ b/libxfs/xfs_sb.c @@ -1143,6 +1143,8 @@ xfs_fs_geometry( geo->flags |= XFS_FSOP_GEOM_FLAGS_RMAPBT; if (xfs_sb_version_hasreflink(sbp)) geo->flags |= XFS_FSOP_GEOM_FLAGS_REFLINK; + if (xfs_sb_version_hasbigtime(sbp)) + geo->flags |= XFS_FSOP_GEOM_FLAGS_BIGTIME; if (xfs_sb_version_hassector(sbp)) geo->logsectsize = sbp->sb_logsectsize; else diff --git a/libxfs/xfs_shared.h b/libxfs/xfs_shared.h index 708feb8eac76..c795ae47b3c9 100644 --- a/libxfs/xfs_shared.h +++ b/libxfs/xfs_shared.h @@ -176,6 +176,9 @@ struct xfs_ino_geometry { unsigned int ialloc_align; unsigned int agino_log; /* #bits for agino in inum */ + + /* precomputed value for di_flags2 */ + uint64_t new_diflags2; }; #endif /* __XFS_SHARED_H__ */ diff --git a/libxfs/xfs_trans_inode.c b/libxfs/xfs_trans_inode.c index a392fd293d25..66dadd8716ee 100644 --- a/libxfs/xfs_trans_inode.c +++ b/libxfs/xfs_trans_inode.c @@ -128,6 +128,17 @@ xfs_trans_log_inode( iversion_flags = XFS_ILOG_CORE; } + /* + * If we're updating the inode core or the timestamps and it's possible + * to upgrade this inode to bigtime format, do so now. + */ + if ((flags & (XFS_ILOG_CORE | XFS_ILOG_TIMESTAMP)) && + xfs_sb_version_hasbigtime(&ip->i_mount->m_sb) && + !xfs_inode_has_bigtime(ip)) { + ip->i_d.di_flags2 |= XFS_DIFLAG2_BIGTIME; + flags |= XFS_ILOG_CORE; + } + /* * Record the specific change for fdatasync optimisation. This allows * fdatasync to skip log forces for inodes that are only timestamp From patchwork Mon Oct 26 23:35:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11859085 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A699B921 for ; Mon, 26 Oct 2020 23:36:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 86A6620872 for ; Mon, 26 Oct 2020 23:36:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="y2IfHulZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407131AbgJZXgG (ORCPT ); Mon, 26 Oct 2020 19:36:06 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:44154 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407121AbgJZXgF (ORCPT ); Mon, 26 Oct 2020 19:36:05 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNPVom177130; Mon, 26 Oct 2020 23:36:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=Yn/hTMBZQvOFnTcFDUDyaYtgwsW2aQyUJinHNOioMfo=; b=y2IfHulZ8GXaXwtuH3UhznTBab2XI5zaP9+x9NGLXvf+/6x9T92ma1CHEvkg0uqS/kJU oxpf5mPc6k+ieS6nElo0VrehVmt3jl8a7fp/iPfdjudoYx55CueA34BHGZgMhnAjrmpn m5k+ioqYFBfV4MOhdAhpIKp85+0ffxihVriesKdcr2yDs4UAEfwkXF3s0V+k8wyNTcqg I/cLcoTm5dpzQe0NQGH84l29nAIHYc/sD0b39G5s4+5cuDkHV/rX1IMYwMx8FqQyFlgv H0uRpA8qFE5wn/peyXmWxSqFqy3JIXsQC/J3GcWPC6BIdWM7q9q4JWyEoo5i6gwat/eR IA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 34c9saqd6r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Oct 2020 23:36:00 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNPxFb110502; Mon, 26 Oct 2020 23:36:00 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 34cx5wfsty-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Oct 2020 23:36:00 +0000 Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 09QNZwto029389; Mon, 26 Oct 2020 23:35:59 GMT Received: from localhost (/10.159.145.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Oct 2020 16:35:58 -0700 Subject: [PATCH 17/26] xfs: widen ondisk quota expiration timestamps to handle y2038+ From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: Christoph Hellwig , Allison Collins , Dave Chinner , linux-xfs@vger.kernel.org Date: Mon, 26 Oct 2020 16:35:57 -0700 Message-ID: <160375535744.881414.13178507174865310834.stgit@magnolia> In-Reply-To: <160375524618.881414.16347303401529121282.stgit@magnolia> References: <160375524618.881414.16347303401529121282.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 impostorscore=0 mlxlogscore=999 malwarescore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 spamscore=0 phishscore=0 clxscore=1015 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Source kernel commit: 4ea1ff3b49681af45a4a8c14baf7f0b3d11aa74a Enable the bigtime feature for quota timers. We decrease the accuracy of the timers to ~4s in exchange for being able to set timers up to the bigtime maximum. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Reviewed-by: Allison Collins Reviewed-by: Dave Chinner Signed-off-by: Darrick J. Wong --- include/xfs_mount.h | 5 +++++ libxfs/xfs_dquot_buf.c | 21 ++++++++++++++++++-- libxfs/xfs_format.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++- libxfs/xfs_quota_defs.h | 3 ++- 4 files changed, 75 insertions(+), 4 deletions(-) diff --git a/include/xfs_mount.h b/include/xfs_mount.h index 20c8bfaf4fa8..be74a922b7a1 100644 --- a/include/xfs_mount.h +++ b/include/xfs_mount.h @@ -184,4 +184,9 @@ extern xfs_mount_t *libxfs_mount (xfs_mount_t *, xfs_sb_t *, int libxfs_umount(struct xfs_mount *mp); extern void libxfs_rtmount_destroy (xfs_mount_t *); +/* Dummy xfs_dquot so that libxfs compiles. */ +struct xfs_dquot { + int q_type; +}; + #endif /* __XFS_MOUNT_H__ */ diff --git a/libxfs/xfs_dquot_buf.c b/libxfs/xfs_dquot_buf.c index 04f62e31019d..0a5a237d2236 100644 --- a/libxfs/xfs_dquot_buf.c +++ b/libxfs/xfs_dquot_buf.c @@ -67,6 +67,13 @@ xfs_dquot_verify( ddq_type != XFS_DQTYPE_GROUP) return __this_address; + if ((ddq->d_type & XFS_DQTYPE_BIGTIME) && + !xfs_sb_version_hasbigtime(&mp->m_sb)) + return __this_address; + + if ((ddq->d_type & XFS_DQTYPE_BIGTIME) && !ddq->d_id) + return __this_address; + if (id != -1 && id != be32_to_cpu(ddq->d_id)) return __this_address; @@ -293,7 +300,12 @@ xfs_dquot_from_disk_ts( struct xfs_disk_dquot *ddq, __be32 dtimer) { - return be32_to_cpu(dtimer); + uint32_t t = be32_to_cpu(dtimer); + + if (t != 0 && (ddq->d_type & XFS_DQTYPE_BIGTIME)) + return xfs_dq_bigtime_to_unix(t); + + return t; } /* Convert an incore timer value into an on-disk timer value. */ @@ -302,5 +314,10 @@ xfs_dquot_to_disk_ts( struct xfs_dquot *dqp, time64_t timer) { - return cpu_to_be32(timer); + uint32_t t = timer; + + if (timer != 0 && (dqp->q_type & XFS_DQTYPE_BIGTIME)) + t = xfs_dq_unix_to_bigtime(timer); + + return cpu_to_be32(t); } diff --git a/libxfs/xfs_format.h b/libxfs/xfs_format.h index dbc7008e4498..0ab424cc25ca 100644 --- a/libxfs/xfs_format.h +++ b/libxfs/xfs_format.h @@ -1263,13 +1263,15 @@ static inline bool xfs_dinode_has_bigtime(const struct xfs_dinode *dip) #define XFS_DQTYPE_USER 0x01 /* user dquot record */ #define XFS_DQTYPE_PROJ 0x02 /* project dquot record */ #define XFS_DQTYPE_GROUP 0x04 /* group dquot record */ +#define XFS_DQTYPE_BIGTIME 0x80 /* large expiry timestamps */ /* bitmask to determine if this is a user/group/project dquot */ #define XFS_DQTYPE_REC_MASK (XFS_DQTYPE_USER | \ XFS_DQTYPE_PROJ | \ XFS_DQTYPE_GROUP) -#define XFS_DQTYPE_ANY (XFS_DQTYPE_REC_MASK) +#define XFS_DQTYPE_ANY (XFS_DQTYPE_REC_MASK | \ + XFS_DQTYPE_BIGTIME) /* * XFS Quota Timers @@ -1282,6 +1284,10 @@ static inline bool xfs_dinode_has_bigtime(const struct xfs_dinode *dip) * ondisk min and max defined here can be used directly to constrain the incore * quota expiration timestamps on a Unix system. * + * When bigtime is enabled, we trade two bits of precision to expand the + * expiration timeout range to match that of big inode timestamps. The min and + * max recorded here are the on-disk limits, not a Unix timestamp. + * * The grace period for each quota type is stored in the root dquot (id = 0) * and is applied to a non-root dquot when it exceeds the soft or hard limits. * The length of quota grace periods are unsigned 32-bit quantities measured in @@ -1300,6 +1306,48 @@ static inline bool xfs_dinode_has_bigtime(const struct xfs_dinode *dip) */ #define XFS_DQ_LEGACY_EXPIRY_MAX ((int64_t)U32_MAX) +/* + * Smallest possible ondisk quota expiration value with bigtime timestamps. + * This corresponds (after conversion to a Unix timestamp) with the incore + * expiration of Jan 1 00:00:04 UTC 1970. + */ +#define XFS_DQ_BIGTIME_EXPIRY_MIN (XFS_DQ_LEGACY_EXPIRY_MIN) + +/* + * Largest supported ondisk quota expiration value with bigtime timestamps. + * This corresponds (after conversion to a Unix timestamp) with an incore + * expiration of Jul 2 20:20:24 UTC 2486. + * + * The ondisk field supports values up to -1U, which corresponds to an incore + * expiration in 2514. This is beyond the maximum the bigtime inode timestamp, + * so we cap the maximum bigtime quota expiration to the max inode timestamp. + */ +#define XFS_DQ_BIGTIME_EXPIRY_MAX ((int64_t)4074815106U) + +/* + * The following conversion factors assist in converting a quota expiration + * timestamp between the incore and ondisk formats. + */ +#define XFS_DQ_BIGTIME_SHIFT (2) +#define XFS_DQ_BIGTIME_SLACK ((int64_t)(1ULL << XFS_DQ_BIGTIME_SHIFT) - 1) + +/* Convert an incore quota expiration timestamp to an ondisk bigtime value. */ +static inline uint32_t xfs_dq_unix_to_bigtime(time64_t unix_seconds) +{ + /* + * Round the expiration timestamp up to the nearest bigtime timestamp + * that we can store, to give users the most time to fix problems. + */ + return ((uint64_t)unix_seconds + XFS_DQ_BIGTIME_SLACK) >> + XFS_DQ_BIGTIME_SHIFT; +} + +/* Convert an ondisk bigtime quota expiration value to an incore timestamp. */ +static inline time64_t xfs_dq_bigtime_to_unix(uint32_t ondisk_seconds) +{ + return (time64_t)ondisk_seconds << XFS_DQ_BIGTIME_SHIFT; +} + /* * Default quota grace periods, ranging from zero (use the compiled defaults) * to ~136 years. These are applied to a non-root dquot that has exceeded diff --git a/libxfs/xfs_quota_defs.h b/libxfs/xfs_quota_defs.h index 9a99910d857e..0f0af4e35032 100644 --- a/libxfs/xfs_quota_defs.h +++ b/libxfs/xfs_quota_defs.h @@ -23,7 +23,8 @@ typedef uint8_t xfs_dqtype_t; #define XFS_DQTYPE_STRINGS \ { XFS_DQTYPE_USER, "USER" }, \ { XFS_DQTYPE_PROJ, "PROJ" }, \ - { XFS_DQTYPE_GROUP, "GROUP" } + { XFS_DQTYPE_GROUP, "GROUP" }, \ + { XFS_DQTYPE_BIGTIME, "BIGTIME" } /* * flags for q_flags field in the dquot. From patchwork Mon Oct 26 23:36:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11859111 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 35C8E1130 for ; Mon, 26 Oct 2020 23:38:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 187CF20872 for ; Mon, 26 Oct 2020 23:38:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="plaRbcye" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407232AbgJZXiI (ORCPT ); Mon, 26 Oct 2020 19:38:08 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:38838 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407229AbgJZXiI (ORCPT ); Mon, 26 Oct 2020 19:38:08 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNPIES158031; Mon, 26 Oct 2020 23:38:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=HVjg2mSHHCwFQf1ORE2L20oFwdfa7W4lnxRkMBVuVZc=; b=plaRbcyeZICAyPj6GGRPCHdFAsr657mJ781Gk3elsF/cFSdl2AyllOvwF/Os/z+9eoEl Qn3t+aGF+VqVoGcpM5oKruU0WPat/4XJZtgVfZGxo9WhsaFQRL+hPkdFEHUm5S6+XYu+ IyJP+0Q2uhPiBbu3COsMPrGibsb7BkJRfpAf2y4/RCGIe4Fqkdi01WqcY1rSAH0O4UX6 fj2ARawDt/VAlkBSZFI4xmza/cMt2GJMWkOrL7pPKnrRAoAjy9Y9/848QBWV04ZZhjWG fOYl85VD/UQA9NCNAghT1hl0Hw4xoqCqZlv2DKNS04pB95fCMhhL/CMX7FIOLEgUOOAP IQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 34cc7kq8rt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Oct 2020 23:38:06 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNQF7N032587; Mon, 26 Oct 2020 23:36:05 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3020.oracle.com with ESMTP id 34cx1q2ca4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Oct 2020 23:36:05 +0000 Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 09QNa55w006255; Mon, 26 Oct 2020 23:36:05 GMT Received: from localhost (/10.159.145.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Oct 2020 16:36:04 -0700 Subject: [PATCH 18/26] libxfs: propagate bigtime inode flag when allocating From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 26 Oct 2020 16:36:03 -0700 Message-ID: <160375536384.881414.3371469706002982157.stgit@magnolia> In-Reply-To: <160375524618.881414.16347303401529121282.stgit@magnolia> References: <160375524618.881414.16347303401529121282.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 bulkscore=0 suspectscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 adultscore=0 malwarescore=0 spamscore=0 clxscore=1015 mlxscore=0 suspectscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Ensure that we propagate the bigtime inode flag correctly when creating new inodes. There critical part here is to use the new_diflags2 field in the incore geometry just like we do in the kernel. We also modify xfs_flags2diflags2 to have the same behavior as the kernel. This isn't strictly needed here, but we aim to avoid letting userspace diverge from the kernel function when we can. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- libxfs/util.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libxfs/util.c b/libxfs/util.c index c78074a01dab..252cf91e851b 100644 --- a/libxfs/util.c +++ b/libxfs/util.c @@ -197,7 +197,8 @@ xfs_flags2diflags2( unsigned int xflags) { uint64_t di_flags2 = - (ip->i_d.di_flags2 & XFS_DIFLAG2_REFLINK); + (ip->i_d.di_flags2 & (XFS_DIFLAG2_REFLINK | + XFS_DIFLAG2_BIGTIME)); if (xflags & FS_XFLAG_DAX) di_flags2 |= XFS_DIFLAG2_DAX; @@ -307,8 +308,8 @@ libxfs_ialloc( ASSERT(ip->i_d.di_ino == ino); ASSERT(uuid_equal(&ip->i_d.di_uuid, &mp->m_sb.sb_meta_uuid)); VFS_I(ip)->i_version = 1; - ip->i_d.di_flags2 = pip ? 0 : xfs_flags2diflags2(ip, - fsx->fsx_xflags); + ip->i_d.di_flags2 = pip ? ip->i_mount->m_ino_geo.new_diflags2 : + xfs_flags2diflags2(ip, fsx->fsx_xflags); ip->i_d.di_crtime.tv_sec = (int32_t)VFS_I(ip)->i_mtime.tv_sec; ip->i_d.di_crtime.tv_nsec = (int32_t)VFS_I(ip)->i_mtime.tv_nsec; ip->i_d.di_cowextsize = pip ? 0 : fsx->fsx_cowextsize; From patchwork Mon Oct 26 23:36:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11859089 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0C7CD1130 for ; Mon, 26 Oct 2020 23:36:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E5F3120872 for ; Mon, 26 Oct 2020 23:36:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="w+rOZhGP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407144AbgJZXgO (ORCPT ); Mon, 26 Oct 2020 19:36:14 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:44248 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407121AbgJZXgO (ORCPT ); Mon, 26 Oct 2020 19:36:14 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNPR14177127; Mon, 26 Oct 2020 23:36:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=EhhIgA2MsuQt18BuRPWm72CQT2P50BXW6z9ecQn61jA=; b=w+rOZhGPa8QnPbp5eM0lB1AGwjnaLEv40iONjobsfAPas4UgtDHqaI6UEF6pfGmApR6l 85ufyn/FNtk0mBDorgutDB1z9+/l7ncAsBMc6NRHIX/YxCMxfWGvdIuImwwRoG9Kr2P7 wdwd8ggqEgtSOLlld8beCfFKUTGQjXG5w4ItcVdcxCej1iIRaAydjs2ab8PtjOSIFzsq uWXO8p1oXQ2DhJc5nmH2yjCV5TqLDToPIxHtMKNPO1rW+k1B3ph2p+VseHx3iGeGgPCe 7zxUUypI+giTvtrt1MkPq50Yhebsnoryn+uRkWcfO4SYzEP/wjTAX7oVkCl734cAWfOB bg== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 34c9saqd6w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Oct 2020 23:36:12 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNPxkC110446; Mon, 26 Oct 2020 23:36:12 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 34cx5wfsxe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Oct 2020 23:36:12 +0000 Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 09QNaBmS006264; Mon, 26 Oct 2020 23:36:11 GMT Received: from localhost (/10.159.145.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Oct 2020 16:36:10 -0700 Subject: [PATCH 19/26] libfrog: list the bigtime feature when reporting geometry From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 26 Oct 2020 16:36:10 -0700 Message-ID: <160375537005.881414.6068353624094235785.stgit@magnolia> In-Reply-To: <160375524618.881414.16347303401529121282.stgit@magnolia> References: <160375524618.881414.16347303401529121282.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 impostorscore=0 mlxlogscore=999 malwarescore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 spamscore=0 phishscore=0 clxscore=1015 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong When we're reporting on a filesystem's geometry, report if the bigtime feature is enabled on this filesystem. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- libfrog/fsgeom.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libfrog/fsgeom.c b/libfrog/fsgeom.c index bd93924ea795..14507668e41b 100644 --- a/libfrog/fsgeom.c +++ b/libfrog/fsgeom.c @@ -28,6 +28,7 @@ xfs_report_geom( int spinodes; int rmapbt_enabled; int reflink_enabled; + int bigtime_enabled; isint = geo->logstart > 0; lazycount = geo->flags & XFS_FSOP_GEOM_FLAGS_LAZYSB ? 1 : 0; @@ -43,12 +44,13 @@ xfs_report_geom( spinodes = geo->flags & XFS_FSOP_GEOM_FLAGS_SPINODES ? 1 : 0; rmapbt_enabled = geo->flags & XFS_FSOP_GEOM_FLAGS_RMAPBT ? 1 : 0; reflink_enabled = geo->flags & XFS_FSOP_GEOM_FLAGS_REFLINK ? 1 : 0; + bigtime_enabled = geo->flags & XFS_FSOP_GEOM_FLAGS_BIGTIME ? 1 : 0; printf(_( "meta-data=%-22s isize=%-6d agcount=%u, agsize=%u blks\n" " =%-22s sectsz=%-5u attr=%u, projid32bit=%u\n" " =%-22s crc=%-8u finobt=%u, sparse=%u, rmapbt=%u\n" -" =%-22s reflink=%u\n" +" =%-22s reflink=%-4u bigtime=%u\n" "data =%-22s bsize=%-6u blocks=%llu, imaxpct=%u\n" " =%-22s sunit=%-6u swidth=%u blks\n" "naming =version %-14u bsize=%-6u ascii-ci=%d, ftype=%d\n" @@ -58,7 +60,7 @@ xfs_report_geom( mntpoint, geo->inodesize, geo->agcount, geo->agblocks, "", geo->sectsize, attrversion, projid32bit, "", crcs_enabled, finobt_enabled, spinodes, rmapbt_enabled, - "", reflink_enabled, + "", reflink_enabled, bigtime_enabled, "", geo->blocksize, (unsigned long long)geo->datablocks, geo->imaxpct, "", geo->sunit, geo->swidth, From patchwork Mon Oct 26 23:36:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11859091 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 69B47921 for ; Mon, 26 Oct 2020 23:36:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4F87520874 for ; Mon, 26 Oct 2020 23:36:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="vq1dpRra" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407148AbgJZXgV (ORCPT ); Mon, 26 Oct 2020 19:36:21 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:55792 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407121AbgJZXgU (ORCPT ); Mon, 26 Oct 2020 19:36:20 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNOgRg164668; Mon, 26 Oct 2020 23:36:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=nqCnFM5BmqtHSGVzdmaNIWx/gKtgVGlf8/0UOFeHchs=; b=vq1dpRraZwhi2AvFpNnccO9yvrDKRQ1fgnWlUPWGte0An5+KTScJhnzu2zwtJW0MdSzb XvkFDJryeL2yYM3othuYTDL7dMyjMQMuepP2LQaclYQKPF89ZllIPUtSnlWJDTbOQs1z ups1iNlxd/eYFFMpbCOV4YgrPV6sjSh062JQ+yHgradmCTgGX0h7B4ras1Wo0coM/tT6 MDWKC3HW73FNn31kvG7EnNGnv7fYVfJRauE9wvp6idbjim0gwUVamXTxFKKEE0PU3Qpp HZajmP+karisg6FtTu6EXDne134glOdQJrSiZLPhzh2EDVOAG3muNkq4n5qWn1syaYjg gA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 34dgm3vutm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Oct 2020 23:36:18 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNPF6J120971; Mon, 26 Oct 2020 23:36:18 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3030.oracle.com with ESMTP id 34cx6va6r0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Oct 2020 23:36:18 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 09QNaHDg008153; Mon, 26 Oct 2020 23:36:17 GMT Received: from localhost (/10.159.145.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Oct 2020 16:36:17 -0700 Subject: [PATCH 20/26] xfs_db: report bigtime format timestamps From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 26 Oct 2020 16:36:16 -0700 Message-ID: <160375537615.881414.8162037930017365466.stgit@magnolia> In-Reply-To: <160375524618.881414.16347303401529121282.stgit@magnolia> References: <160375524618.881414.16347303401529121282.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 spamscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 impostorscore=0 adultscore=0 bulkscore=0 spamscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 clxscore=1015 mlxscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Report the large format timestamps. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen --- db/fprint.c | 66 ++++++++++++++++++++++++++++++++-------------- db/inode.c | 4 ++- db/sb.c | 2 + libxfs/libxfs_api_defs.h | 1 + 4 files changed, 52 insertions(+), 21 deletions(-) diff --git a/db/fprint.c b/db/fprint.c index 7ceab29cc608..48562f0c9518 100644 --- a/db/fprint.c +++ b/db/fprint.c @@ -112,23 +112,43 @@ fp_sarray( return 1; } -int -fp_time( - void *obj, - int bit, - int count, - char *fmtstr, - int size, - int arg, - int base, - int array) +static void +fp_time64( + time64_t sec) { - struct timespec64 tv; - xfs_timestamp_t *ts; - int bitpos; + time_t tt = sec; char *c; + + BUILD_BUG_ON(sizeof(long) != sizeof(time_t)); + + if (sec > LONG_MAX || sec < LONG_MIN) + goto raw; + + c = ctime(&tt); + if (!c) + goto raw; + + dbprintf("%24.24s", c); + return; +raw: + dbprintf("%lld", sec); +} + +int +fp_time( + void *obj, + int bit, + int count, + char *fmtstr, + int size, + int arg, + int base, + int array) +{ + struct timespec64 tv; + xfs_timestamp_t *ts; + int bitpos; int i; - time_t t; ASSERT(bitoffs(bit) == 0); for (i = 0, bitpos = bit; @@ -139,10 +159,8 @@ fp_time( ts = obj + byteize(bitpos); tv = libxfs_inode_from_disk_ts(obj, *ts); - t = tv.tv_sec; - c = ctime(&t); - dbprintf("%24.24s", c); + fp_time64(tv.tv_sec); if (i < count - 1) dbprintf(" "); @@ -195,7 +213,8 @@ fp_qtimer( int base, int array) { - uint32_t sec; + struct xfs_disk_dquot *ddq = obj; + time64_t sec; __be32 *t; int bitpos; int i; @@ -208,9 +227,16 @@ fp_qtimer( dbprintf("%d:", i + base); t = obj + byteize(bitpos); - sec = be32_to_cpu(*t); + sec = libxfs_dquot_from_disk_ts(ddq, *t); - dbprintf("%u", sec); + /* + * Display the raw value if it's the default grace expiration + * period (root dquot) or if the quota has not expired. + */ + if (ddq->d_id == 0 || sec == 0) + dbprintf("%lld", sec); + else + fp_time64(sec); if (i < count - 1) dbprintf(" "); diff --git a/db/inode.c b/db/inode.c index cc0e680aadea..f0e08ebf5ad9 100644 --- a/db/inode.c +++ b/db/inode.c @@ -175,10 +175,12 @@ const field_t inode_v3_flds[] = { { "dax", FLDT_UINT1, OI(COFF(flags2) + bitsz(uint64_t) - XFS_DIFLAG2_DAX_BIT - 1), C1, 0, TYP_NONE }, + { "bigtime", FLDT_UINT1, + OI(COFF(flags2) + bitsz(uint64_t) - XFS_DIFLAG2_BIGTIME_BIT - 1), C1, + 0, TYP_NONE }, { NULL } }; - const field_t timestamp_flds[] = { { "sec", FLDT_TIME, OI(0), C1, 0, TYP_NONE }, { "nsec", FLDT_NSEC, OI(0), C1, 0, TYP_NONE }, diff --git a/db/sb.c b/db/sb.c index b1033e5ef7f0..a04f36c73255 100644 --- a/db/sb.c +++ b/db/sb.c @@ -727,6 +727,8 @@ version_string( strcat(s, ",REFLINK"); if (xfs_sb_version_hasinobtcounts(sbp)) strcat(s, ",INOBTCNT"); + if (xfs_sb_version_hasbigtime(sbp)) + strcat(s, ",BIGTIME"); return s; } diff --git a/libxfs/libxfs_api_defs.h b/libxfs/libxfs_api_defs.h index 40da71ab3163..419e6d9888cf 100644 --- a/libxfs/libxfs_api_defs.h +++ b/libxfs/libxfs_api_defs.h @@ -99,6 +99,7 @@ #define xfs_dir_replace libxfs_dir_replace #define xfs_dqblk_repair libxfs_dqblk_repair +#define xfs_dquot_from_disk_ts libxfs_dquot_from_disk_ts #define xfs_dquot_verify libxfs_dquot_verify #define xfs_finobt_calc_reserves libxfs_finobt_calc_reserves From patchwork Mon Oct 26 23:36:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11859119 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 785D7921 for ; Mon, 26 Oct 2020 23:38:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5072220872 for ; Mon, 26 Oct 2020 23:38:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="MJUfFmCg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407246AbgJZXi1 (ORCPT ); Mon, 26 Oct 2020 19:38:27 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:57054 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407215AbgJZXi1 (ORCPT ); Mon, 26 Oct 2020 19:38:27 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNOsL4164741; Mon, 26 Oct 2020 23:38:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=bR4NVP8Qsnt0FcZ2kMLINjJnfpSDMQ9gSRI2t5PBPzE=; b=MJUfFmCg/dBa5oU7riOTvfLN5PHHpPKId99+39Cg7zrlKimxFOqon3EC56iOtgj1dViC w/CSJzVpFIK49JpnDlO2NWlcQb3FtcaRaOpOGcixa9vaH85ll6p53zMWG7WASzwdjWKq 9CfBCWo+lDoNfFD8Lp2XWhFhRX4RtsJubJc5FYo2rzvd05pesBBM7iLlsjP1wd2Arr32 SXbQqK0U+3BvppFfP9xoX1KoA80HDGKVoVTtWjt9gfxKcU1M5h25OGzq+2bbbWpyfcXx nBPPyLwoSwthXrHXX2Gq3bBLc1u7ao923su+8D3rUiGPMe7QW9DG/AFGqAxuEkPWLBet ag== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 34dgm3vuxd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Oct 2020 23:38:25 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNQNHf058416; Mon, 26 Oct 2020 23:36:24 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3030.oracle.com with ESMTP id 34cwukr9hh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Oct 2020 23:36:24 +0000 Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 09QNaNNQ006418; Mon, 26 Oct 2020 23:36:23 GMT Received: from localhost (/10.159.145.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Oct 2020 16:36:23 -0700 Subject: [PATCH 21/26] xfs_db: support printing time limits From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 26 Oct 2020 16:36:22 -0700 Message-ID: <160375538229.881414.12318967122326451609.stgit@magnolia> In-Reply-To: <160375524618.881414.16347303401529121282.stgit@magnolia> References: <160375524618.881414.16347303401529121282.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 bulkscore=0 spamscore=0 adultscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 impostorscore=0 adultscore=0 bulkscore=0 spamscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 clxscore=1015 mlxscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Support printing the minimum and maxium timestamp limits on this filesystem. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- db/Makefile | 3 + db/command.c | 1 db/command.h | 1 db/timelimit.c | 160 +++++++++++++++++++++++++++++++++++++++++++++++++++++ man/man8/xfs_db.8 | 23 ++++++++ 5 files changed, 187 insertions(+), 1 deletion(-) create mode 100644 db/timelimit.c diff --git a/db/Makefile b/db/Makefile index 67908a2c3c98..beafb1058269 100644 --- a/db/Makefile +++ b/db/Makefile @@ -14,7 +14,8 @@ HFILES = addr.h agf.h agfl.h agi.h attr.h attrshort.h bit.h block.h bmap.h \ io.h logformat.h malloc.h metadump.h output.h print.h quit.h sb.h \ sig.h strvec.h text.h type.h write.h attrset.h symlink.h fsmap.h \ fuzz.h -CFILES = $(HFILES:.h=.c) btdump.c btheight.c convert.c info.c namei.c +CFILES = $(HFILES:.h=.c) btdump.c btheight.c convert.c info.c namei.c \ + timelimit.c LSRCFILES = xfs_admin.sh xfs_ncheck.sh xfs_metadump.sh LLDLIBS = $(LIBXFS) $(LIBXLOG) $(LIBFROG) $(LIBUUID) $(LIBRT) $(LIBPTHREAD) diff --git a/db/command.c b/db/command.c index 053097742b12..02f778b9316b 100644 --- a/db/command.c +++ b/db/command.c @@ -140,4 +140,5 @@ init_commands(void) write_init(); dquot_init(); fuzz_init(); + timelimit_init(); } diff --git a/db/command.h b/db/command.h index bf130e63c85c..fd5cead9be78 100644 --- a/db/command.h +++ b/db/command.h @@ -33,3 +33,4 @@ extern void btdump_init(void); extern void info_init(void); extern void btheight_init(void); extern void namei_init(void); +extern void timelimit_init(void); diff --git a/db/timelimit.c b/db/timelimit.c new file mode 100644 index 000000000000..53a0a399a7f2 --- /dev/null +++ b/db/timelimit.c @@ -0,0 +1,160 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2020 Oracle. All Rights Reserved. + * Author: Darrick J. Wong + */ +#include "libxfs.h" +#include "command.h" +#include "output.h" +#include "init.h" + +enum show_what { + SHOW_AUTO, + SHOW_CLASSIC, + SHOW_BIGTIME, +}; + + +enum print_how { + PRINT_RAW, + PRINT_PRETTY, + PRINT_COMPACT, +}; + +static void +show_limit( + const char *tag, + int64_t limit, + enum print_how how) +{ + if (how == PRINT_COMPACT) { + dbprintf("%" PRId64 " ", limit); + return; + } + + if (how == PRINT_PRETTY && limit <= LONG_MAX && limit >= LONG_MIN) { + time_t tt = limit; + char *c; + + c = ctime(&tt); + if (c) { + dbprintf("%s = %24.24s\n", tag, c); + return; + } + } + + dbprintf("%s = %" PRId64 "\n", tag, limit); +} + +static void +show_limits( + enum show_what whatkind, + enum print_how how) +{ + enum print_how grace_how = how; + + switch (whatkind) { + case SHOW_AUTO: + /* should never get here */ + break; + case SHOW_CLASSIC: + show_limit("time.min", XFS_LEGACY_TIME_MIN, how); + show_limit("time.max", XFS_LEGACY_TIME_MAX, how); + show_limit("dqtimer.min", XFS_DQ_LEGACY_EXPIRY_MIN, how); + show_limit("dqtimer.max", XFS_DQ_LEGACY_EXPIRY_MAX, how); + break; + case SHOW_BIGTIME: + show_limit("time.min", + xfs_bigtime_to_unix(XFS_BIGTIME_TIME_MIN), how); + show_limit("time.max", + xfs_bigtime_to_unix(XFS_BIGTIME_TIME_MAX), how); + show_limit("dqtimer.min", + xfs_dq_bigtime_to_unix(XFS_DQ_BIGTIME_EXPIRY_MIN), + how); + show_limit("dqtimer.max", + xfs_dq_bigtime_to_unix(XFS_DQ_BIGTIME_EXPIRY_MAX), + how); + break; + } + + /* grace periods are always integers */ + if (grace_how != PRINT_COMPACT) + grace_how = PRINT_RAW; + show_limit("dqgrace.min", XFS_DQ_GRACE_MIN, grace_how); + show_limit("dqgrace.min", XFS_DQ_GRACE_MAX, grace_how); + + if (how == PRINT_COMPACT) + dbprintf("\n"); +} + +static int +timelimit_f( + int argc, + char **argv) +{ + enum show_what whatkind = SHOW_AUTO; + enum print_how how = PRINT_RAW; + int i; + + for (i = 1; i < argc; i++) { + if (!strcmp("--classic", argv[i])) + whatkind = SHOW_CLASSIC; + else if (!strcmp("--bigtime", argv[i])) + whatkind = SHOW_BIGTIME; + else if (!strcmp("--pretty", argv[i])) + how = PRINT_PRETTY; + else if (!strcmp("--compact", argv[i])) + how = PRINT_COMPACT; + else { + dbprintf(_("%s: bad option for timelimit command\n"), + argv[i]); + return 1; + } + } + + if (whatkind == SHOW_AUTO) { + if (xfs_sb_version_hasbigtime(&mp->m_sb)) + whatkind = SHOW_BIGTIME; + else + whatkind = SHOW_CLASSIC; + } + + show_limits(whatkind, how); + return 0; +} + +static void +timelimit_help(void) +{ + dbprintf(_( +"\n" +" Print the minimum and maximum supported values for inode timestamps,\n" +" disk quota expiration timers, and disk quota grace periods supported\n" +" by this filesystem.\n" +"\n" +" Options:\n" +" --classic -- Force printing of the classic time limits.\n" +" --bigtime -- Force printing of the bigtime limits.\n" +" --pretty -- Pretty-print the time limits.\n" +" --compact -- Print the limits in a single line.\n" +"\n" +)); + +} + +static const cmdinfo_t timelimit_cmd = { + .name = "timelimit", + .cfunc = timelimit_f, + .argmin = 0, + .argmax = -1, + .canpush = 0, + .args = N_("[--classic|--bigtime] [--pretty]"), + .oneline = N_("display timestamp limits"), + .help = timelimit_help, +}; + +void +timelimit_init(void) +{ + add_command(&timelimit_cmd); +} diff --git a/man/man8/xfs_db.8 b/man/man8/xfs_db.8 index fefe862b7564..f2520e9ad1ac 100644 --- a/man/man8/xfs_db.8 +++ b/man/man8/xfs_db.8 @@ -905,6 +905,29 @@ The possible data types are: .BR rtsummary ", " sb ", " symlink " and " text . See the TYPES section below for more information on these data types. .TP +.BI "timelimit [" OPTIONS ] +Print the minimum and maximum supported values for inode timestamps, +quota expiration timers, and quota grace periods supported by this +filesystem. +Options include: +.RS 1.0i +.TP 0.4i +.B \--bigtime +Print the time limits of an XFS filesystem with the +.B bigtime +feature enabled. +.TP 0.4i +.B \--classic +Print the time limits of a classic XFS filesystem. +.TP 0.4i +.B \--compact +Print all limits as raw values on a single line. +.TP 0.4i +.B \--pretty +Print the timestamps in the current locale's date and time format instead of +raw seconds since the Unix epoch. +.RE +.TP .BI "uuid [" uuid " | " generate " | " rewrite " | " restore ] Set the filesystem universally unique identifier (UUID). The filesystem UUID can be used by From patchwork Mon Oct 26 23:36:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11859095 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B36091130 for ; Mon, 26 Oct 2020 23:36:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 99E092087C for ; Mon, 26 Oct 2020 23:36:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="TGUWSm49" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407161AbgJZXgd (ORCPT ); Mon, 26 Oct 2020 19:36:33 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:55920 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407157AbgJZXgc (ORCPT ); Mon, 26 Oct 2020 19:36:32 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNOXtJ164622; Mon, 26 Oct 2020 23:36:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=eGZl6IsBHZwC4gxKqVYChM1np/iCuaavY5rYcrl56C0=; b=TGUWSm494f9EP9kJ+P9mcsPSHRjMikM8lgVVG1FkAYVbZAP3yzxeN+pIsJHJ3+VVOYzi i8NgZmsdL5yC3zrRd/xwpTlNTy8lg4zopRsQyecIam5CmbEMwjjci8nJpP4Q8keFKprL t810+tuMVsG/50KBPQeLbdgCjXKuV/98FUE+RqdeKsFwOO8HSW3I7qKL+V+QsytZZ7ds KPoe2OyG2xNqkLh0QHhKXeQAAdq1AZjc6dM/RM7wJiSqdwHHJfYFO2mO1kfZjtytoE/5 4eQ5Qm6i/yskECfWRDtF0gK06UaNIRRTNCgyR4iBCWLhbENTPtHSje7KPy64amB+BTBC Bw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 34dgm3vutu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Oct 2020 23:36:30 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNPxIl110453; Mon, 26 Oct 2020 23:36:30 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 34cx5wft1j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Oct 2020 23:36:29 +0000 Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 09QNaT2D013262; Mon, 26 Oct 2020 23:36:29 GMT Received: from localhost (/10.159.145.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Oct 2020 16:36:29 -0700 Subject: [PATCH 22/26] xfs_db: add bigtime upgrade path From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 26 Oct 2020 16:36:28 -0700 Message-ID: <160375538851.881414.17245799256703762517.stgit@magnolia> In-Reply-To: <160375524618.881414.16347303401529121282.stgit@magnolia> References: <160375524618.881414.16347303401529121282.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 impostorscore=0 adultscore=0 bulkscore=0 spamscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 clxscore=1015 mlxscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Enable users to upgrade their filesystems to bigtime support. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- db/sb.c | 15 +++++++++++++++ man/man8/xfs_admin.8 | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/db/sb.c b/db/sb.c index a04f36c73255..c77d7f038de2 100644 --- a/db/sb.c +++ b/db/sb.c @@ -781,6 +781,21 @@ version_f( } upgrade_ro_compat |= XFS_SB_FEAT_RO_COMPAT_INOBTCNT; + } else if (!strcasecmp(argv[1], "bigtime")) { + if (xfs_sb_version_hasbigtime(&mp->m_sb)) { + dbprintf( + _("bigtime feature is already enabled\n")); + exitcode = 1; + return 1; + } + if (!xfs_sb_version_hascrc(&mp->m_sb)) { + dbprintf( + _("bigtime feature cannot be enabled on pre-V5 filesystems\n")); + exitcode = 1; + return 1; + } + + upgrade_incompat |= XFS_SB_FEAT_INCOMPAT_BIGTIME; } else if (!strcasecmp(argv[1], "extflg")) { switch (XFS_SB_VERSION_NUM(&mp->m_sb)) { case XFS_SB_VERSION_1: diff --git a/man/man8/xfs_admin.8 b/man/man8/xfs_admin.8 index 65ca6afc1e12..c09fe62b6827 100644 --- a/man/man8/xfs_admin.8 +++ b/man/man8/xfs_admin.8 @@ -117,6 +117,11 @@ This reduces mount time by caching the size of the inode btrees in the allocation group metadata. Once enabled, the filesystem will not be writable by older kernels. The filesystem cannot be downgraded after this feature is enabled. +.TP +.B bigtime +Upgrade the filesystem to support larger timestamps up to the year 2486. +Once enabled, the filesystem will not be readable by older kernels. +The filesystem cannot be downgraded. .RE .TP .BI \-U " uuid" From patchwork Mon Oct 26 23:36:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11859125 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1F2D2921 for ; Mon, 26 Oct 2020 23:38:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F150720872 for ; Mon, 26 Oct 2020 23:38:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="robakn1D" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407255AbgJZXij (ORCPT ); Mon, 26 Oct 2020 19:38:39 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:57210 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407243AbgJZXij (ORCPT ); Mon, 26 Oct 2020 19:38:39 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNOXV4164621; Mon, 26 Oct 2020 23:38:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=pKzxnciog0z9E0H0JVaHdXbFEFEUWFlSHyBURI9Ej5o=; b=robakn1DRYW0RaNLZq8KqbWNOlFkMaGMLC3rVOEOe7uWElc2UGJHE3uFxDIXBy6r4iuC SVJiFsUSjBW4wlqUbG7jWXoZXaWqeDInBIhSfOwluRznJKKFFdu/jtm3GbkScafzITgN 4SYhG36OCuCbMrnrKgAGhTekfnYXYUfoyAoTJeRtlaJb5bsk7l68w6cjoWimB4KKJRvx +oOigWzKwxFeUTcI9AvO5gyQJecfOTcxNnJAW9Vem9Yszjjiz69P60qD3xzYcXmPVtaY F0nLnAvAeyQXqb02LKaYHDeaQwXkYe/P2h4ekrae0eVt2SEyz9E5jvc5H3mwQIlXEFxG gA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 34dgm3vuxt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Oct 2020 23:38:36 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNPGLj121126; Mon, 26 Oct 2020 23:36:36 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3030.oracle.com with ESMTP id 34cx6va6vm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Oct 2020 23:36:36 +0000 Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 09QNaZH4029640; Mon, 26 Oct 2020 23:36:35 GMT Received: from localhost (/10.159.145.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Oct 2020 16:36:35 -0700 Subject: [PATCH 23/26] xfs_quota: support editing and reporting quotas with bigtime From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 26 Oct 2020 16:36:34 -0700 Message-ID: <160375539460.881414.16375144747744518990.stgit@magnolia> In-Reply-To: <160375524618.881414.16347303401529121282.stgit@magnolia> References: <160375524618.881414.16347303401529121282.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 spamscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 impostorscore=0 adultscore=0 bulkscore=0 spamscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 clxscore=1015 mlxscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Enhance xfs_quota to detect and report grace period expirations past 2038. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- include/xqm.h | 20 ++++++++++++++++- quota/edit.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++----- quota/quota.c | 6 +++-- quota/quota.h | 7 ++++++ quota/report.c | 6 +++-- 5 files changed, 91 insertions(+), 13 deletions(-) diff --git a/include/xqm.h b/include/xqm.h index 8ab19072656e..573441db9860 100644 --- a/include/xqm.h +++ b/include/xqm.h @@ -47,7 +47,10 @@ typedef struct fs_disk_quota { __s32 d_btimer; /* similar to above; for disk blocks */ __u16 d_iwarns; /* # warnings issued wrt num inodes */ __u16 d_bwarns; /* # warnings issued wrt disk blocks */ - __s32 d_padding2; /* padding2 - for future use */ + __s8 d_itimer_hi; /* upper 8 bits of timer values */ + __s8 d_btimer_hi; + __s8 d_rtbtimer_hi; + __s8 d_padding2; /* padding2 - for future use */ __u64 d_rtb_hardlimit;/* absolute limit on realtime blks */ __u64 d_rtb_softlimit;/* preferred limit on RT disk blks */ __u64 d_rtbcount; /* # realtime blocks owned */ @@ -93,6 +96,21 @@ typedef struct fs_disk_quota { #define FS_DQ_RTBWARNS (1<<11) #define FS_DQ_WARNS_MASK (FS_DQ_BWARNS | FS_DQ_IWARNS | FS_DQ_RTBWARNS) +/* + * Accounting values. These can only be set for filesystem with + * non-transactional quotas that require quotacheck(8) in userspace. + */ +#define FS_DQ_BCOUNT (1<<12) +#define FS_DQ_ICOUNT (1<<13) +#define FS_DQ_RTBCOUNT (1<<14) +#define FS_DQ_ACCT_MASK (FS_DQ_BCOUNT | FS_DQ_ICOUNT | FS_DQ_RTBCOUNT) + +/* + * Quota expiration timestamps are 40-bit signed integers, with the upper 8 + * bits encoded in the _hi fields. + */ +#define FS_DQ_BIGTIME (1<<15) + /* * Various flags related to quotactl(2). Only relevant to XFS filesystems. */ diff --git a/quota/edit.c b/quota/edit.c index b3cad024b1f1..1a3b2d9f959b 100644 --- a/quota/edit.c +++ b/quota/edit.c @@ -417,6 +417,53 @@ restore_f( return 0; } +time64_t +decode_timer( + const struct fs_disk_quota *d, + __s32 timer_lo, + __s8 timer_hi) +{ + if (d->d_fieldmask & FS_DQ_BIGTIME) + return (uint32_t)timer_lo | (int64_t)timer_hi << 32; + return timer_lo; +} + +static inline void +encode_timer( + const struct fs_disk_quota *d, + __s32 *timer_lo, + __s8 *timer_hi, + time64_t timer) +{ + *timer_lo = timer; + if (d->d_fieldmask & FS_DQ_BIGTIME) + *timer_hi = timer >> 32; + else + *timer_hi = 0; +} + +static inline bool want_bigtime(time64_t timer) +{ + return timer > INT32_MAX || timer < INT32_MIN; +} + +static void +encode_timers( + struct fs_disk_quota *d, + time64_t btimer, + time64_t itimer, + time64_t rtbtimer) +{ + d->d_fieldmask &= ~FS_DQ_BIGTIME; + if (want_bigtime(btimer) || want_bigtime(itimer) || + want_bigtime(rtbtimer)) + d->d_fieldmask |= FS_DQ_BIGTIME; + + encode_timer(d, &d->d_btimer, &d->d_btimer_hi, btimer); + encode_timer(d, &d->d_itimer, &d->d_itimer_hi, itimer); + encode_timer(d, &d->d_rtbtimer, &d->d_rtbtimer_hi, rtbtimer); +} + static void set_timer( uint32_t id, @@ -426,6 +473,7 @@ set_timer( time64_t value) { struct fs_disk_quota d; + time64_t btimer, itimer, rtbtimer; memset(&d, 0, sizeof(d)); @@ -446,23 +494,28 @@ set_timer( time(&now); + btimer = decode_timer(&d, d.d_btimer, d.d_btimer_hi); + itimer = decode_timer(&d, d.d_itimer, d.d_itimer_hi); + rtbtimer = decode_timer(&d, d.d_rtbtimer, d.d_rtbtimer_hi); + /* Only set grace time if user is already past soft limit */ if (d.d_blk_softlimit && d.d_bcount > d.d_blk_softlimit) - d.d_btimer = now + value; + btimer = now + value; if (d.d_ino_softlimit && d.d_icount > d.d_ino_softlimit) - d.d_itimer = now + value; + itimer = now + value; if (d.d_rtb_softlimit && d.d_rtbcount > d.d_rtb_softlimit) - d.d_rtbtimer = now + value; + rtbtimer = now + value; } else { - d.d_btimer = value; - d.d_itimer = value; - d.d_rtbtimer = value; + btimer = value; + itimer = value; + rtbtimer = value; } d.d_version = FS_DQUOT_VERSION; d.d_flags = type; d.d_fieldmask = mask; d.d_id = id; + encode_timers(&d, btimer, itimer, rtbtimer); if (xfsquotactl(XFS_SETQLIM, dev, type, id, (void *)&d) < 0) { exitcode = 1; diff --git a/quota/quota.c b/quota/quota.c index 8ba0995d9174..0747cedcb8c2 100644 --- a/quota/quota.c +++ b/quota/quota.c @@ -101,7 +101,7 @@ quota_mount( } if (form & XFS_BLOCK_QUOTA) { - timer = d.d_btimer; + timer = decode_timer(&d, d.d_btimer, d.d_btimer_hi); qflags = (flags & HUMAN_FLAG); if (d.d_blk_hardlimit && d.d_bcount > d.d_blk_hardlimit) qflags |= LIMIT_FLAG; @@ -123,7 +123,7 @@ quota_mount( time_to_string(timer, qflags)); } if (form & XFS_INODE_QUOTA) { - timer = d.d_itimer; + timer = decode_timer(&d, d.d_itimer, d.d_itimer_hi); qflags = (flags & HUMAN_FLAG); if (d.d_ino_hardlimit && d.d_icount > d.d_ino_hardlimit) qflags |= LIMIT_FLAG; @@ -145,7 +145,7 @@ quota_mount( time_to_string(timer, qflags)); } if (form & XFS_RTBLOCK_QUOTA) { - timer = d.d_rtbtimer; + timer = decode_timer(&d, d.d_rtbtimer, d.d_rtbtimer_hi); qflags = (flags & HUMAN_FLAG); if (d.d_rtb_hardlimit && d.d_rtbcount > d.d_rtb_hardlimit) qflags |= LIMIT_FLAG; diff --git a/quota/quota.h b/quota/quota.h index 11f62b208e6a..78b0d66d2a4f 100644 --- a/quota/quota.h +++ b/quota/quota.h @@ -3,6 +3,8 @@ * Copyright (c) 2005 Silicon Graphics, Inc. * All Rights Reserved. */ +#ifndef XFS_QUOTA_QUOTA_H_ +#define XFS_QUOTA_QUOTA_H_ #include "xqm.h" #include "libfrog/paths.h" @@ -73,3 +75,8 @@ extern char *uid_to_name(uint32_t __uid); extern char *gid_to_name(uint32_t __gid); extern char *prid_to_name(uint32_t __prid); extern bool isdigits_only(const char *); + +time64_t decode_timer(const struct fs_disk_quota *d, __s32 timer_lo, + __s8 timer_hi); + +#endif /* XFS_QUOTA_QUOTA_H_ */ diff --git a/quota/report.c b/quota/report.c index 2d5024e95177..6ac5549097b7 100644 --- a/quota/report.c +++ b/quota/report.c @@ -398,7 +398,7 @@ report_mount( } if (form & XFS_BLOCK_QUOTA) { - timer = d.d_btimer; + timer = decode_timer(&d, d.d_btimer, d.d_btimer_hi); qflags = (flags & HUMAN_FLAG); if (d.d_blk_hardlimit && d.d_bcount > d.d_blk_hardlimit) qflags |= LIMIT_FLAG; @@ -420,7 +420,7 @@ report_mount( time_to_string(timer, qflags)); } if (form & XFS_INODE_QUOTA) { - timer = d.d_itimer; + timer = decode_timer(&d, d.d_itimer, d.d_itimer_hi); qflags = (flags & HUMAN_FLAG); if (d.d_ino_hardlimit && d.d_icount > d.d_ino_hardlimit) qflags |= LIMIT_FLAG; @@ -442,7 +442,7 @@ report_mount( time_to_string(timer, qflags)); } if (form & XFS_RTBLOCK_QUOTA) { - timer = d.d_rtbtimer; + timer = decode_timer(&d, d.d_rtbtimer, d.d_rtbtimer_hi); qflags = (flags & HUMAN_FLAG); if (d.d_rtb_hardlimit && d.d_rtbcount > d.d_rtb_hardlimit) qflags |= LIMIT_FLAG; From patchwork Mon Oct 26 23:36:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11859099 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 54BCF1130 for ; Mon, 26 Oct 2020 23:36:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3B13920874 for ; Mon, 26 Oct 2020 23:36:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="OgTWRI4t" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407169AbgJZXgp (ORCPT ); Mon, 26 Oct 2020 19:36:45 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:44560 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407195AbgJZXgo (ORCPT ); Mon, 26 Oct 2020 19:36:44 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNPvEL177195; Mon, 26 Oct 2020 23:36:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=beFxoQttikHNmMlLxp/7DOwiFr+KbsUrVZvEYc1mmvw=; b=OgTWRI4tdjcjo8O8p07r9Xa6jAhYweouNMOzoyDABDIiRQGrFlrIh+aY4QM4d8bEF8FQ bMEKtTZgCObabp1voS4brFvYekstFjr/OhO7EcQK6f9oWfBkGCWXjRbJNYa91PnC8eOH zMLaGlSpeaEey/1Wf8bVWkXwfRu5mJoSydew8hX20p4nGMouHYf1BLZMhPt+Z4oSXjCg Fps6gin5A0biNP9ZOLrNT/TUz9gn4jqpXotHCqgV7Edeqge1MHRFjq/+l3Oh+45KnEhl bqzveUd+8JE4hUy20D6hTfB9HLZvKyimENspyQFsC7WHh5jQahrztMmVDExpbYqBWjcp EQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 34c9saqd7k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Oct 2020 23:36:43 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNPxFh110502; Mon, 26 Oct 2020 23:36:43 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 34cx5wft4f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Oct 2020 23:36:43 +0000 Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 09QNafJ9006455; Mon, 26 Oct 2020 23:36:42 GMT Received: from localhost (/10.159.145.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Oct 2020 16:36:41 -0700 Subject: [PATCH 24/26] xfs_repair: support bigtime timestamp checking From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 26 Oct 2020 16:36:40 -0700 Message-ID: <160375540080.881414.4537898211020466512.stgit@magnolia> In-Reply-To: <160375524618.881414.16347303401529121282.stgit@magnolia> References: <160375524618.881414.16347303401529121282.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 impostorscore=0 mlxlogscore=999 malwarescore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 spamscore=0 phishscore=0 clxscore=1015 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Make sure that inodes don't have the bigtime flag set when the feature is disabled, and don't check for overflows in the nanoseconds when bigtime is enabled because that is no longer possible. Also make sure that quotas don't have bigtime set erroneously. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- repair/dinode.c | 33 +++++++++++++++++++++++++++++---- repair/quotacheck.c | 11 ++++++++++- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/repair/dinode.c b/repair/dinode.c index c1d9d9727d62..16f52c38a43a 100644 --- a/repair/dinode.c +++ b/repair/dinode.c @@ -2167,11 +2167,15 @@ static void check_nsec( const char *name, xfs_ino_t lino, + struct xfs_dinode *dip, xfs_timestamp_t *ts, int *dirty) { struct xfs_legacy_timestamp *t; + if (xfs_dinode_has_bigtime(dip)) + return; + t = (struct xfs_legacy_timestamp *)ts; if (be32_to_cpu(t->t_nsec) < NSEC_PER_SEC) return; @@ -2594,6 +2598,27 @@ _("bad (negative) size %" PRId64 " on inode %" PRIu64 "\n"), flags2 &= ~XFS_DIFLAG2_COWEXTSIZE; } + if (xfs_dinode_has_bigtime(dino) && + !xfs_sb_version_hasbigtime(&mp->m_sb)) { + if (!uncertain) { + do_warn( + _("inode %" PRIu64 " is marked bigtime but file system does not support large timestamps\n"), + lino); + } + flags2 &= ~XFS_DIFLAG2_BIGTIME; + + if (no_modify) { + do_warn(_("would zero timestamps.\n")); + } else { + do_warn(_("zeroing timestamps.\n")); + dino->di_atime = 0; + dino->di_mtime = 0; + dino->di_ctime = 0; + dino->di_crtime = 0; + *dirty = 1; + } + } + if (!verify_mode && flags2 != be64_to_cpu(dino->di_flags2)) { if (!no_modify) { do_warn(_("fixing bad flags2.\n")); @@ -2721,11 +2746,11 @@ _("Bad CoW extent size %u on inode %" PRIu64 ", "), } /* nsec fields cannot be larger than 1 billion */ - check_nsec("atime", lino, &dino->di_atime, dirty); - check_nsec("mtime", lino, &dino->di_mtime, dirty); - check_nsec("ctime", lino, &dino->di_ctime, dirty); + check_nsec("atime", lino, dino, &dino->di_atime, dirty); + check_nsec("mtime", lino, dino, &dino->di_mtime, dirty); + check_nsec("ctime", lino, dino, &dino->di_ctime, dirty); if (dino->di_version >= 3) - check_nsec("crtime", lino, &dino->di_crtime, dirty); + check_nsec("crtime", lino, dino, &dino->di_crtime, dirty); /* * general size/consistency checks: diff --git a/repair/quotacheck.c b/repair/quotacheck.c index 8cbbfa2e6978..55bcc048517d 100644 --- a/repair/quotacheck.c +++ b/repair/quotacheck.c @@ -237,6 +237,7 @@ quotacheck_adjust( /* Compare this on-disk dquot against whatever we observed. */ static void qc_check_dquot( + struct xfs_mount *mp, struct xfs_disk_dquot *ddq, struct qc_dquots *dquots) { @@ -273,6 +274,14 @@ qc_check_dquot( chkd_flags = 0; } + if ((ddq->d_type & XFS_DQTYPE_BIGTIME) && + !xfs_sb_version_hasbigtime(&mp->m_sb)) { + do_warn( + _("%s id %u is marked bigtime but file system does not support large timestamps\n"), + qflags_typestr(dquots->type), id); + chkd_flags = 0; + } + /* * Mark that we found the record on disk. Skip locking here because * we're checking the dquots serially. @@ -322,7 +331,7 @@ _("cannot read %s inode %"PRIu64", block %"PRIu64", disk block %"PRIu64", err=%d for (dqnr = 0; dqnr < dqperchunk && dqid <= UINT_MAX; dqnr++, dqb++, dqid++) - qc_check_dquot(&dqb->dd_diskdq, dquots); + qc_check_dquot(mp, &dqb->dd_diskdq, dquots); libxfs_buf_relse(bp); } From patchwork Mon Oct 26 23:36:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11859101 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1EB4A921 for ; Mon, 26 Oct 2020 23:36:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 04C8F20809 for ; Mon, 26 Oct 2020 23:36:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Ri3KN9+7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407200AbgJZXgv (ORCPT ); Mon, 26 Oct 2020 19:36:51 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:38034 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407198AbgJZXgv (ORCPT ); Mon, 26 Oct 2020 19:36:51 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNP0bT157948; Mon, 26 Oct 2020 23:36:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=Ra6gL4102Epn5DtVjS2Uy9lDNJ+KMhRBvHfo94RFZNw=; b=Ri3KN9+7Z7mncQfQingTjDEFU+jEyp1iLi9+svVxWNByXkZARwwBNxEzZqJbE+1b8T/l QXyUC9Wj7Qr+E31dwqx2W/FUjyxAf9YoSF/WSWge4gur0lFwd67LWL/3/uZw83hWwhlc M5tJOPcE5ZyEDgXVsqMDpDUnzlLB0Q5m+mhdS02/vR29wn72FzG7rj6rBC33vUkuQsWf WONsJT70+cwOfix3g+KZDXEkpdjePPKzoGZQp6j1BC6Lhk32yk3NNVkoZ3a6UQvAMw/E Hl8UPu2E37+GOtLo5Sp9s7vZxzO00gLqxnrhEJfcgwDDNF80G441z0Jgd15kf4lki5G7 9A== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 34cc7kq8pc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Oct 2020 23:36:49 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNPHSi121223; Mon, 26 Oct 2020 23:36:48 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3030.oracle.com with ESMTP id 34cx6va6xv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Oct 2020 23:36:48 +0000 Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 09QNalLU008341; Mon, 26 Oct 2020 23:36:47 GMT Received: from localhost (/10.159.145.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Oct 2020 16:36:47 -0700 Subject: [PATCH 25/26] mkfs: format bigtime filesystems From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 26 Oct 2020 16:36:46 -0700 Message-ID: <160375540688.881414.887151161169932986.stgit@magnolia> In-Reply-To: <160375524618.881414.16347303401529121282.stgit@magnolia> References: <160375524618.881414.16347303401529121282.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 spamscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 adultscore=0 malwarescore=0 spamscore=0 clxscore=1015 mlxscore=0 suspectscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Allow formatting with large timestamps. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- man/man8/mkfs.xfs.8 | 16 ++++++++++++++++ mkfs/xfs_mkfs.c | 24 +++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/man/man8/mkfs.xfs.8 b/man/man8/mkfs.xfs.8 index 1a6a5f93f0ea..9e72a841f868 100644 --- a/man/man8/mkfs.xfs.8 +++ b/man/man8/mkfs.xfs.8 @@ -150,6 +150,22 @@ valid are: .RS 1.2i .TP +.BI bigtime= value +This option enables filesystems that can handle inode timestamps from December +1901 to July 2486, and quota timer expirations from January 1970 to July 2486. +The value is either 0 to disable the feature, or 1 to enable large timestamps. +.IP +If this feature is not enabled, the filesystem can only handle timestamps from +December 1901 to January 2038, and quota timers from January 1970 to February +2106. +.IP +By default, +.B mkfs.xfs +will not enable this feature. +If the option +.B \-m crc=0 +is used, the large timestamp feature is not supported and is disabled. +.TP .BI crc= value This is used to create a filesystem which maintains and checks CRC information in all metadata objects on disk. The value is either 0 to disable the feature, diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 23e3077e0174..4cb79b695921 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -120,6 +120,7 @@ enum { M_RMAPBT, M_REFLINK, M_INOBTCNT, + M_BIGTIME, M_MAX_OPTS, }; @@ -662,6 +663,7 @@ static struct opt_params mopts = { [M_RMAPBT] = "rmapbt", [M_REFLINK] = "reflink", [M_INOBTCNT] = "inobtcount", + [M_BIGTIME] = "bigtime", }, .subopt_params = { { .index = M_CRC, @@ -698,6 +700,12 @@ static struct opt_params mopts = { .maxval = 1, .defaultval = 1, }, + { .index = M_BIGTIME, + .conflicts = { { NULL, LAST_CONFLICT } }, + .minval = 0, + .maxval = 1, + .defaultval = 1, + }, }, }; @@ -749,6 +757,7 @@ struct sb_feat_args { bool rmapbt; /* XFS_SB_FEAT_RO_COMPAT_RMAPBT */ bool reflink; /* XFS_SB_FEAT_RO_COMPAT_REFLINK */ bool inobtcnt; /* XFS_SB_FEAT_RO_COMPAT_INOBTCNT */ + bool bigtime; /* XFS_SB_FEAT_INCOMPAT_BIGTIME */ bool nodalign; bool nortalign; }; @@ -872,7 +881,7 @@ usage( void ) fprintf(stderr, _("Usage: %s\n\ /* blocksize */ [-b size=num]\n\ /* metadata */ [-m crc=0|1,finobt=0|1,uuid=xxx,rmapbt=0|1,reflink=0|1,\n\ - inobtcnt=0|1]\n\ + inobtcnt=0|1,bigtime=0|1]\n\ /* data subvol */ [-d agcount=n,agsize=n,file,name=xxx,size=num,\n\ (sunit=value,swidth=value|su=num,sw=num|noalign),\n\ sectsize=num\n\ @@ -1578,6 +1587,9 @@ meta_opts_parser( case M_INOBTCNT: cli->sb_feat.inobtcnt = getnum(value, opts, subopt); break; + case M_BIGTIME: + cli->sb_feat.bigtime = getnum(value, opts, subopt); + break; default: return -EINVAL; } @@ -2008,6 +2020,13 @@ _("inode btree counters not supported without CRC support\n")); usage(); } cli->sb_feat.inobtcnt = false; + + if (cli->sb_feat.bigtime && cli_opt_set(&mopts, M_BIGTIME)) { + fprintf(stderr, +_("timestamps later than 2038 not supported without CRC support\n")); + usage(); + } + cli->sb_feat.bigtime = false; } if (!cli->sb_feat.finobt) { @@ -2986,6 +3005,8 @@ sb_set_features( sbp->sb_features_ro_compat |= XFS_SB_FEAT_RO_COMPAT_REFLINK; if (fp->inobtcnt) sbp->sb_features_ro_compat |= XFS_SB_FEAT_RO_COMPAT_INOBTCNT; + if (fp->bigtime) + sbp->sb_features_incompat |= XFS_SB_FEAT_INCOMPAT_BIGTIME; /* * Sparse inode chunk support has two main inode alignment requirements. @@ -3652,6 +3673,7 @@ main( .parent_pointers = false, .nodalign = false, .nortalign = false, + .bigtime = false, }, }; From patchwork Mon Oct 26 23:36:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11859135 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7F69C1130 for ; Mon, 26 Oct 2020 23:39:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6525420872 for ; Mon, 26 Oct 2020 23:39:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="KQNYvVN0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407296AbgJZXjD (ORCPT ); Mon, 26 Oct 2020 19:39:03 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:57550 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407243AbgJZXjC (ORCPT ); Mon, 26 Oct 2020 19:39:02 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNPTjP165174; Mon, 26 Oct 2020 23:36:55 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=kVUZD9DDtUG2sjMGl1oVmHBWbFGHmNIkQqdwRrWEL0Q=; b=KQNYvVN0i0zF7EKpi2KXtwk98qJEAa3OmpTt4BFz+s4Bp7dRGjfkaHDnPG8ontrubIGN kP+8/rIzHF/y2KUB6zGx1dyqMuCprt8QT4TPhQuAZImdQq6TVOq9+zYRaKJEXGBVnQe1 rDGzRz/c9Xntep9GRJjmA8M0kkyNjIVvAl8Hc3/DZl2IUYT3dnV+iJGOOFoDs04pi5g0 BWgebohwljGXR6xRW8O9PSRZEueHylqjr7ErP5+goP6qhJ8HV19LMXsG7NOAC9jy1F5d CMzUN9dXi5deNi6p4+dmXZrOMjamyLR5LePWOiUQ1J8jOS2xVggsL9JW7GRpbP7AT3Tt kA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 34dgm3vuv3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Oct 2020 23:36:55 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09QNPGs3121018; Mon, 26 Oct 2020 23:36:55 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3030.oracle.com with ESMTP id 34cx6va715-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Oct 2020 23:36:55 +0000 Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 09QNas57006580; Mon, 26 Oct 2020 23:36:54 GMT Received: from localhost (/10.159.145.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Oct 2020 16:36:54 -0700 Subject: [PATCH 26/26] xfs: enable big timestamps From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: Amir Goldstein , Allison Collins , Christoph Hellwig , Gao Xiang , Dave Chinner , linux-xfs@vger.kernel.org Date: Mon, 26 Oct 2020 16:36:53 -0700 Message-ID: <160375541298.881414.10016258798360119628.stgit@magnolia> In-Reply-To: <160375524618.881414.16347303401529121282.stgit@magnolia> References: <160375524618.881414.16347303401529121282.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 spamscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9786 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 impostorscore=0 adultscore=0 bulkscore=0 spamscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 clxscore=1015 mlxscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010260153 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Source kernel commit: 29887a22713192509cfc6068ea3b200cdb8856da Enable the big timestamp feature. Signed-off-by: Darrick J. Wong Reviewed-by: Amir Goldstein Reviewed-by: Allison Collins Reviewed-by: Christoph Hellwig Reviewed-by: Gao Xiang Reviewed-by: Dave Chinner Signed-off-by: Darrick J. Wong --- libxfs/xfs_format.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libxfs/xfs_format.h b/libxfs/xfs_format.h index 0ab424cc25ca..e8e7e63455c6 100644 --- a/libxfs/xfs_format.h +++ b/libxfs/xfs_format.h @@ -471,7 +471,8 @@ xfs_sb_has_ro_compat_feature( #define XFS_SB_FEAT_INCOMPAT_ALL \ (XFS_SB_FEAT_INCOMPAT_FTYPE| \ XFS_SB_FEAT_INCOMPAT_SPINODES| \ - XFS_SB_FEAT_INCOMPAT_META_UUID) + XFS_SB_FEAT_INCOMPAT_META_UUID| \ + XFS_SB_FEAT_INCOMPAT_BIGTIME) #define XFS_SB_FEAT_INCOMPAT_UNKNOWN ~XFS_SB_FEAT_INCOMPAT_ALL static inline bool