Blame SOURCES/xfsprogs-5.10.0-xfs-refactor-quota-timestamp-coding.patch

5d5cbe
From 68879320b482e73e6ce202a8e680c8ab7e6a2af4 Mon Sep 17 00:00:00 2001
5d5cbe
From: "Darrick J. Wong" <darrick.wong@oracle.com>
5d5cbe
Date: Tue, 10 Nov 2020 15:12:50 -0500
5d5cbe
Subject: [PATCH] xfs: refactor quota timestamp coding
5d5cbe
5d5cbe
Source kernel commit: 9f99c8fe551a056c0929dff13cbce62b6b150156
5d5cbe
5d5cbe
Refactor quota timestamp encoding and decoding into helper functions so
5d5cbe
that we can add extra behavior in the next patch.
5d5cbe
5d5cbe
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
5d5cbe
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
5d5cbe
Reviewed-by: Christoph Hellwig <hch@lst.de>
5d5cbe
Reviewed-by: Allison Collins <allison.henderson@oracle.com>
5d5cbe
Reviewed-by: Dave Chinner <dchinner@redhat.com>
5d5cbe
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
5d5cbe
---
5d5cbe
5d5cbe
diff --git a/libxfs/xfs_dquot_buf.c b/libxfs/xfs_dquot_buf.c
5d5cbe
index 324f528..963f8ea 100644
5d5cbe
--- a/libxfs/xfs_dquot_buf.c
5d5cbe
+++ b/libxfs/xfs_dquot_buf.c
5d5cbe
@@ -286,3 +286,21 @@ const struct xfs_buf_ops xfs_dquot_buf_ra_ops = {
5d5cbe
 	.verify_read = xfs_dquot_buf_readahead_verify,
5d5cbe
 	.verify_write = xfs_dquot_buf_write_verify,
5d5cbe
 };
5d5cbe
+
5d5cbe
+/* Convert an on-disk timer value into an incore timer value. */
5d5cbe
+time64_t
5d5cbe
+xfs_dquot_from_disk_ts(
5d5cbe
+	struct xfs_disk_dquot	*ddq,
5d5cbe
+	__be32			dtimer)
5d5cbe
+{
5d5cbe
+	return be32_to_cpu(dtimer);
5d5cbe
+}
5d5cbe
+
5d5cbe
+/* Convert an incore timer value into an on-disk timer value. */
5d5cbe
+__be32
5d5cbe
+xfs_dquot_to_disk_ts(
5d5cbe
+	struct xfs_dquot	*dqp,
5d5cbe
+	time64_t		timer)
5d5cbe
+{
5d5cbe
+	return cpu_to_be32(timer);
5d5cbe
+}
5d5cbe
diff --git a/libxfs/xfs_quota_defs.h b/libxfs/xfs_quota_defs.h
5d5cbe
index c69dba4..2f61cd3 100644
5d5cbe
--- a/libxfs/xfs_quota_defs.h
5d5cbe
+++ b/libxfs/xfs_quota_defs.h
5d5cbe
@@ -149,4 +149,9 @@ extern int xfs_calc_dquots_per_chunk(unsigned int nbblks);
5d5cbe
 extern int xfs_dqblk_repair(struct xfs_mount *mp, struct xfs_dqblk *dqb,
5d5cbe
 		xfs_dqid_t id, uint type);
5d5cbe
 
5d5cbe
+struct xfs_dquot;
5d5cbe
+time64_t xfs_dquot_from_disk_ts(struct xfs_disk_dquot *ddq,
5d5cbe
+		__be32 dtimer);
5d5cbe
+__be32 xfs_dquot_to_disk_ts(struct xfs_dquot *ddq, time64_t timer);
5d5cbe
+
5d5cbe
 #endif	/* __XFS_QUOTA_H__ */