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

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