* [PATCH v1] xfs: fix comment for start time value of inode with bigtime enabled
@ 2022-07-17 10:04 Xiaole He
2022-07-18 17:14 ` Darrick J. Wong
0 siblings, 1 reply; 2+ messages in thread
From: Xiaole He @ 2022-07-17 10:04 UTC (permalink / raw)
To: linux-xfs
Cc: djwong, dchinner, chandan.babu, allison.henderson, hexiaole, Xiaole He
The 'ctime', 'mtime', and 'atime' for inode is the type of
'xfs_timestamp_t', which is a 64-bit type:
/* fs/xfs/libxfs/xfs_format.h begin */
typedef __be64 xfs_timestamp_t;
/* fs/xfs/libxfs/xfs_format.h end */
When the 'bigtime' feature is disabled, this 64-bit type is splitted
into two parts of 32-bit, one part is encoded for seconds since
1970-01-01 00:00:00 UTC, the other part is encoded for nanoseconds
above the seconds, this two parts are the type of
'xfs_legacy_timestamp' and the min and max time value of this type are
defined as macros 'XFS_LEGACY_TIME_MIN' and 'XFS_LEGACY_TIME_MAX':
/* fs/xfs/libxfs/xfs_format.h begin */
struct xfs_legacy_timestamp {
__be32 t_sec; /* timestamp seconds */
__be32 t_nsec; /* timestamp nanoseconds */
};
#define XFS_LEGACY_TIME_MIN ((int64_t)S32_MIN)
#define XFS_LEGACY_TIME_MAX ((int64_t)S32_MAX)
/* fs/xfs/libxfs/xfs_format.h end */
/* include/linux/limits.h begin */
#define U32_MAX ((u32)~0U)
#define S32_MAX ((s32)(U32_MAX >> 1))
#define S32_MIN ((s32)(-S32_MAX - 1))
/* include/linux/limits.h end */
'XFS_LEGACY_TIME_MIN' is the min time value of the
'xfs_legacy_timestamp', that is -(2^31) seconds relative to the
1970-01-01 00:00:00 UTC, it can be converted to human-friendly time
value by 'date' command:
/* command begin */
[root@~]# date --utc -d '@0' +'%Y-%m-%d %H:%M:%S'
1970-01-01 00:00:00
[root@~]# date --utc -d "@`echo '-(2^31)'|bc`" +'%Y-%m-%d %H:%M:%S'
1901-12-13 20:45:52
[root@~]#
/* command end */
When 'bigtime' feature is enabled, this 64-bit type becomes a 64-bit
nanoseconds counter, with the start time value is the min time value of
'xfs_legacy_timestamp'(start time means the value of 64-bit nanoseconds
counter is 0). We have already caculated the min time value of
'xfs_legacy_timestamp', that is 1901-12-13 20:45:52 UTC, but the comment
for the start time value of inode with 'bigtime' feature enabled writes
the value is 1901-12-31 20:45:52 UTC:
/* fs/xfs/libxfs/xfs_format.h begin */
/*
* XFS Timestamps
* ==============
* 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. ...
...
*/
/* fs/xfs/libxfs/xfs_format.h end */
That is a typo, and this patch corrects the typo, from 'Dec 31' to
'Dec 13'.
Suggested-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Xiaole He <hexiaole@kylinos.cn>
---
fs/xfs/libxfs/xfs_format.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h
index afdfc81..b55bdfa 100644
--- a/fs/xfs/libxfs/xfs_format.h
+++ b/fs/xfs/libxfs/xfs_format.h
@@ -704,7 +704,7 @@ struct xfs_agfl {
* 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
+ * Dec 13 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.
*/
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1] xfs: fix comment for start time value of inode with bigtime enabled
2022-07-17 10:04 [PATCH v1] xfs: fix comment for start time value of inode with bigtime enabled Xiaole He
@ 2022-07-18 17:14 ` Darrick J. Wong
0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2022-07-18 17:14 UTC (permalink / raw)
To: Xiaole He; +Cc: linux-xfs, dchinner, chandan.babu, allison.henderson, hexiaole
On Sun, Jul 17, 2022 at 06:04:31PM +0800, Xiaole He wrote:
> The 'ctime', 'mtime', and 'atime' for inode is the type of
> 'xfs_timestamp_t', which is a 64-bit type:
>
> /* fs/xfs/libxfs/xfs_format.h begin */
> typedef __be64 xfs_timestamp_t;
> /* fs/xfs/libxfs/xfs_format.h end */
>
> When the 'bigtime' feature is disabled, this 64-bit type is splitted
> into two parts of 32-bit, one part is encoded for seconds since
> 1970-01-01 00:00:00 UTC, the other part is encoded for nanoseconds
> above the seconds, this two parts are the type of
> 'xfs_legacy_timestamp' and the min and max time value of this type are
> defined as macros 'XFS_LEGACY_TIME_MIN' and 'XFS_LEGACY_TIME_MAX':
>
> /* fs/xfs/libxfs/xfs_format.h begin */
> struct xfs_legacy_timestamp {
> __be32 t_sec; /* timestamp seconds */
> __be32 t_nsec; /* timestamp nanoseconds */
> };
> #define XFS_LEGACY_TIME_MIN ((int64_t)S32_MIN)
> #define XFS_LEGACY_TIME_MAX ((int64_t)S32_MAX)
> /* fs/xfs/libxfs/xfs_format.h end */
> /* include/linux/limits.h begin */
> #define U32_MAX ((u32)~0U)
> #define S32_MAX ((s32)(U32_MAX >> 1))
> #define S32_MIN ((s32)(-S32_MAX - 1))
> /* include/linux/limits.h end */
>
> 'XFS_LEGACY_TIME_MIN' is the min time value of the
> 'xfs_legacy_timestamp', that is -(2^31) seconds relative to the
> 1970-01-01 00:00:00 UTC, it can be converted to human-friendly time
> value by 'date' command:
>
> /* command begin */
> [root@~]# date --utc -d '@0' +'%Y-%m-%d %H:%M:%S'
> 1970-01-01 00:00:00
> [root@~]# date --utc -d "@`echo '-(2^31)'|bc`" +'%Y-%m-%d %H:%M:%S'
> 1901-12-13 20:45:52
> [root@~]#
> /* command end */
>
> When 'bigtime' feature is enabled, this 64-bit type becomes a 64-bit
> nanoseconds counter, with the start time value is the min time value of
> 'xfs_legacy_timestamp'(start time means the value of 64-bit nanoseconds
> counter is 0). We have already caculated the min time value of
> 'xfs_legacy_timestamp', that is 1901-12-13 20:45:52 UTC, but the comment
> for the start time value of inode with 'bigtime' feature enabled writes
> the value is 1901-12-31 20:45:52 UTC:
>
> /* fs/xfs/libxfs/xfs_format.h begin */
> /*
> * XFS Timestamps
> * ==============
> * 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. ...
> ...
> */
> /* fs/xfs/libxfs/xfs_format.h end */
>
> That is a typo, and this patch corrects the typo, from 'Dec 31' to
> 'Dec 13'.
>
> Suggested-by: Darrick J. Wong <djwong@kernel.org>
> Signed-off-by: Xiaole He <hexiaole@kylinos.cn>
Heh, thanks for fixing the typo.
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> ---
> fs/xfs/libxfs/xfs_format.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h
> index afdfc81..b55bdfa 100644
> --- a/fs/xfs/libxfs/xfs_format.h
> +++ b/fs/xfs/libxfs/xfs_format.h
> @@ -704,7 +704,7 @@ struct xfs_agfl {
> * 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
> + * Dec 13 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.
> */
> --
> 1.8.3.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-18 17:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-17 10:04 [PATCH v1] xfs: fix comment for start time value of inode with bigtime enabled Xiaole He
2022-07-18 17:14 ` Darrick J. Wong
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.