]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libxfs: refactor NSEC_PER_SEC
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 10 Nov 2020 19:52:31 +0000 (14:52 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Tue, 10 Nov 2020 19:52:31 +0000 (14:52 -0500)
Clean up all the open-coded and duplicate definitions of time unit
conversion factors.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
include/platform_defs.h.in
repair/dinode.c
scrub/common.c
scrub/progress.c

index 1f7ceafb1fbc75c93b277a22005e3dbd19cce194..a11b58719380d3e9dc463461d52b91ed5cd7762e 100644 (file)
@@ -80,4 +80,7 @@ typedef unsigned short umode_t;
 
 extern int     platform_nproc(void);
 
+#define NSEC_PER_SEC   (1000000000ULL)
+#define NSEC_PER_USEC  (1000ULL)
+
 #endif /* __XFS_PLATFORM_DEFS_H__ */
index c89f21e08373a7f12203c6594672d464f632f61d..7d55fe456b907e0f709c772a2c4740973e91c749 100644 (file)
@@ -2126,7 +2126,7 @@ check_nsec(
        struct xfs_timestamp    *t,
        int                     *dirty)
 {
-       if (be32_to_cpu(t->t_nsec) < 1000000000)
+       if (be32_to_cpu(t->t_nsec) < NSEC_PER_SEC)
                return;
 
        do_warn(
index c4699b6ad1e35876af59ae3c2811b86a5df6a907..49a87f412c4dcf65753d37ca73e6f679da5dc4f1 100644 (file)
@@ -288,8 +288,6 @@ scrub_nproc_workqueue(
  * Sleep for 100us * however many -b we got past the initial one.
  * This is an (albeit clumsy) way to throttle scrub activity.
  */
-#define NSEC_PER_SEC   1000000000ULL
-#define NSEC_PER_USEC  1000ULL
 void
 background_sleep(void)
 {
index d8130ca5f93c284524766abc8c366cafbf6e084f..15247b7c6d1b1db7cb18cc0ebbc90d5a8f1f0560 100644 (file)
@@ -110,7 +110,6 @@ progress_report(
        fflush(pt.fp);
 }
 
-#define NSEC_PER_SEC   (1000000000)
 static void *
 progress_report_thread(void *arg)
 {