aboutsummaryrefslogtreecommitdiffstats
path: root/scrub
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2019-11-01 16:54:20 -0400
committerEric Sandeen <sandeen@sandeen.net>2019-11-01 16:54:20 -0400
commitae14fe63b522e25b4652683d3fde54ce415fa80b (patch)
tree914e39892ee7cfde9573cb6b1fa69ff4fc06f3bc /scrub
parentb658de931769b85dd9145249ba4c8acf6ebbc863 (diff)
downloadxfsprogs-dev-ae14fe63b522e25b4652683d3fde54ce415fa80b.tar.gz
xfs_scrub: clean out the nproc global variable
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>
Diffstat (limited to 'scrub')
-rw-r--r--scrub/disk.c2
-rw-r--r--scrub/xfs_scrub.c8
-rw-r--r--scrub/xfs_scrub.h1
3 files changed, 2 insertions, 9 deletions
diff --git a/scrub/disk.c b/scrub/disk.c
index 8a8a411b33..a1ef798a02 100644
--- a/scrub/disk.c
+++ b/scrub/disk.c
@@ -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;
diff --git a/scrub/xfs_scrub.c b/scrub/xfs_scrub.c
index b6a012742e..147c114c8f 100644
--- a/scrub/xfs_scrub.c
+++ b/scrub/xfs_scrub.c
@@ -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) {
diff --git a/scrub/xfs_scrub.h b/scrub/xfs_scrub.h
index f9a72052d3..37d78f61f6 100644
--- a/scrub/xfs_scrub.h
+++ b/scrub/xfs_scrub.h
@@ -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;