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__ */