@@ -79,6 +79,7 @@ typedef unsigned short umode_t;
#endif
extern int platform_nproc(void);
+extern int nproc(void);
#define NSEC_PER_SEC (1000000000ULL)
#define NSEC_PER_USEC (1000ULL)
@@ -285,7 +285,7 @@ platform_align_blockdev(void)
/* How many CPUs are online? */
int
-platform_nproc(void)
+nproc(void)
{
long nproc = sysconf(_SC_NPROCESSORS_ONLN);
@@ -296,6 +296,12 @@ platform_nproc(void)
return nproc;
}
+int
+platform_nproc(void)
+{
+ return nproc();
+}
+
unsigned long
platform_physmem(void)
{
@@ -235,7 +235,7 @@ process_rmap_data(
if (!rmap_needs_work(mp))
return;
- create_work_queue(&wq, mp, platform_nproc());
+ create_work_queue(&wq, mp, nproc());
for (i = 0; i < mp->m_sb.sb_agcount; i++)
queue_work(&wq, check_rmap_btrees, i, NULL);
destroy_work_queue(&wq);
@@ -243,12 +243,12 @@ process_rmap_data(
if (!xfs_sb_version_hasreflink(&mp->m_sb))
return;
- create_work_queue(&wq, mp, platform_nproc());
+ create_work_queue(&wq, mp, nproc());
for (i = 0; i < mp->m_sb.sb_agcount; i++)
queue_work(&wq, compute_ag_refcounts, i, NULL);
destroy_work_queue(&wq);
- create_work_queue(&wq, mp, platform_nproc());
+ create_work_queue(&wq, mp, nproc());
for (i = 0; i < mp->m_sb.sb_agcount; i++) {
queue_work(&wq, process_inode_reflink_flags, i, NULL);
queue_work(&wq, check_refcount_btrees, i, NULL);
@@ -1024,7 +1024,7 @@ do_inode_prefetch(
*/
if (check_cache && !libxfs_bcache_overflowed()) {
queue.wq_ctx = mp;
- create_work_queue(&queue, mp, platform_nproc());
+ create_work_queue(&queue, mp, nproc());
for (i = 0; i < mp->m_sb.sb_agcount; i++)
queue_work(&queue, func, i, NULL);
destroy_work_queue(&queue);
@@ -234,7 +234,7 @@ qsort_slab(
return;
}
- create_work_queue(&wq, NULL, platform_nproc());
+ create_work_queue(&wq, NULL, nproc());
hdr = slab->s_first;
while (hdr) {
qs = malloc(sizeof(struct qsort_slab));
@@ -1030,7 +1030,7 @@ main(int argc, char **argv)
}
if (ag_stride) {
- int max_threads = platform_nproc() * 8;
+ int max_threads = nproc() * 8;
thread_count = (glob_agcount + ag_stride - 1) / ag_stride;
while (thread_count > max_threads) {
@@ -43,19 +43,19 @@ __disk_heads(
{
int iomin;
int ioopt;
- int nproc = platform_nproc();
+ int n_proc = nproc();
unsigned short rot;
int error;
/* If it's not a block device, throw all the CPUs at it. */
if (!S_ISBLK(disk->d_sb.st_mode))
- return nproc;
+ return n_proc;
/* Non-rotational device? Throw all the CPUs at the problem. */
rot = 1;
error = ioctl(disk->d_fd, BLKROTATIONAL, &rot);
if (error == 0 && rot == 0)
- return nproc;
+ return n_proc;
/*
* Sometimes we can infer the number of devices from the
@@ -65,7 +65,7 @@ __disk_heads(
if (ioctl(disk->d_fd, BLKIOMIN, &iomin) == 0 &&
ioctl(disk->d_fd, BLKIOOPT, &ioopt) == 0 &&
iomin > 0 && ioopt > 0) {
- return min(nproc, max(1, ioopt / iomin));
+ return min(n_proc, max(1, ioopt / iomin));
}
/* Rotating device? I guess? */