]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_scrub: clean out the nproc global variable
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 1 Nov 2019 20:54:20 +0000 (16:54 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Fri, 1 Nov 2019 20:54:20 +0000 (16:54 -0400)
Get rid of this global variable since we already have a libfrog function
that does exactly what it does.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
scrub/disk.c
scrub/xfs_scrub.c
scrub/xfs_scrub.h

index 8a8a411b335d006dd7f98329caf0387800655ae3..a1ef798a02540fad7880c90a6699b12eefa24ff1 100644 (file)
@@ -22,6 +22,7 @@
 #include "xfs_scrub.h"
 #include "common.h"
 #include "disk.h"
+#include "platform_defs.h"
 
 #ifndef BLKROTATIONAL
 # define BLKROTATIONAL _IO(0x12, 126)
@@ -42,6 +43,7 @@ __disk_heads(
 {
        int                     iomin;
        int                     ioopt;
+       int                     nproc = platform_nproc();
        unsigned short          rot;
        int                     error;
 
index b6a012742eff5ff9ea88311bc66c2285cedadf70..147c114c8fcf3abcfb03ef739026d02cef3a2e0c 100644 (file)
@@ -131,9 +131,6 @@ static bool                 display_rusage;
 /* Background mode; higher values insert more pauses between scrub calls. */
 unsigned int                   bg_mode;
 
-/* Maximum number of processors available to us. */
-int                            nproc;
-
 /* Number of threads we're allowed to use. */
 unsigned int                   force_nr_threads;
 
@@ -717,11 +714,6 @@ main(
        }
        memcpy(&ctx.fsinfo, fsp, sizeof(struct fs_path));
 
-       /* How many CPUs? */
-       nproc = sysconf(_SC_NPROCESSORS_ONLN);
-       if (nproc < 1)
-               nproc = 1;
-
        /* Set up a page-aligned buffer for read verification. */
        page_size = sysconf(_SC_PAGESIZE);
        if (page_size < 0) {
index f9a72052d3d8630fbed1617e4152dc1c71504822..37d78f61f687c751e29979439efeaf4c903e98f5 100644 (file)
@@ -15,7 +15,6 @@ extern char *progname;
 extern unsigned int            force_nr_threads;
 extern unsigned int            bg_mode;
 extern unsigned int            debug;
-extern int                     nproc;
 extern bool                    verbose;
 extern long                    page_size;
 extern bool                    want_fstrim;