]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: refactor quota timestamp coding
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 10 Nov 2020 20:12:50 +0000 (15:12 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Tue, 10 Nov 2020 20:12:50 +0000 (15:12 -0500)
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 <darrick.wong@oracle.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Allison Collins <allison.henderson@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_dquot_buf.c
libxfs/xfs_quota_defs.h

index b5adb840d015b2763784eb10cfefa37e755c1665..04f62e31019d0a163e1a1ad934648138a582f02e 100644 (file)
@@ -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);
+}
index 076bdc7037ee61b90436b526cbd480de7afeb625..9a99910d857e5a01a48ade6970cd323a1cf5ef33 100644 (file)
@@ -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__ */