From: Pavel Reichl <preichl@redhat.com>
To: linux-xfs@vger.kernel.org
Subject: [PATCH v2 22/29] xfsprogs: Stop using platform_nproc()
Date: Fri, 6 Aug 2021 23:23:11 +0200 [thread overview]
Message-ID: <20210806212318.440144-23-preichl@redhat.com> (raw)
In-Reply-To: <20210806212318.440144-1-preichl@redhat.com>
---
include/platform_defs.h.in | 1 +
libfrog/linux.c | 8 +++++++-
repair/phase4.c | 6 +++---
repair/prefetch.c | 2 +-
repair/slab.c | 2 +-
repair/xfs_repair.c | 2 +-
scrub/disk.c | 8 ++++----
7 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/include/platform_defs.h.in b/include/platform_defs.h.in
index 539bdbec..03bc255a 100644
--- a/include/platform_defs.h.in
+++ b/include/platform_defs.h.in
@@ -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)
diff --git a/libfrog/linux.c b/libfrog/linux.c
index 891373c6..ee163661 100644
--- a/libfrog/linux.c
+++ b/libfrog/linux.c
@@ -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)
{
diff --git a/repair/phase4.c b/repair/phase4.c
index 191b4842..c496deda 100644
--- a/repair/phase4.c
+++ b/repair/phase4.c
@@ -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);
diff --git a/repair/prefetch.c b/repair/prefetch.c
index 48affa18..f01e1296 100644
--- a/repair/prefetch.c
+++ b/repair/prefetch.c
@@ -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);
diff --git a/repair/slab.c b/repair/slab.c
index 165f97ef..d9a94a81 100644
--- a/repair/slab.c
+++ b/repair/slab.c
@@ -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));
diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c
index a5410919..fbbc8c6f 100644
--- a/repair/xfs_repair.c
+++ b/repair/xfs_repair.c
@@ -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) {
diff --git a/scrub/disk.c b/scrub/disk.c
index a1ef798a..9b91eedd 100644
--- a/scrub/disk.c
+++ b/scrub/disk.c
@@ -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? */
--
2.31.1
next prev parent reply other threads:[~2021-08-06 21:23 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-06 21:22 [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Pavel Reichl
2021-08-06 21:22 ` [PATCH v2 01/29] xfsprogs: Stop using platform_uuid_compare() Pavel Reichl
2021-08-06 21:22 ` [PATCH v2 02/29] xfsprogs: Stop using platform_test_xfs_fd() Pavel Reichl
2021-08-06 21:22 ` [PATCH v2 03/29] xfsprogs: Stop using platform_test_xfs_path() Pavel Reichl
2021-08-06 21:22 ` [PATCH v2 04/29] xfsprogs: Stop using platform_fstatfs() Pavel Reichl
2021-08-06 21:22 ` [PATCH v2 05/29] xfsprogs: Stop using platform_getoptreset() Pavel Reichl
2021-08-06 21:22 ` [PATCH v2 06/29] xfsprogs: Stop using platform_uuid_copy() Pavel Reichl
2021-08-06 21:22 ` [PATCH v2 07/29] xfsprogs: Stop using platform_uuid_generate() Pavel Reichl
2021-08-06 21:22 ` [PATCH v2 08/29] xfsprogs: Stop using platform_uuid_unparse() Pavel Reichl
2021-08-06 21:22 ` [PATCH v2 09/29] xfsprogs: Stop using platform_uuid_clear() Pavel Reichl
2021-08-06 21:22 ` [PATCH v2 10/29] xfsprogs: Stop using platform_uuid_parse() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 11/29] xfsprogs: Stop using platform_uuid_is_null() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 12/29] xfsprogs: Stop using platform_check_mount() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 13/29] xfsprogs: Stop using platform_check_ismounted() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 14/29] xfsprogs: Stop using platform_flush_device() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 15/29] xfsprogs: Stop using platform_mntent_open() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 16/29] xfsprogs: Stop using platform_mntent_next() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 17/29] xfsprogs: Stop using platform_mntent_close() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 18/29] xfsprogs: Stop using platform_findsizes() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 19/29] xfsprogs: Stop using platform_discard_blocks Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 20/29] xfsprogs: Stop using platform_zero_range() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 21/29] xfsprogs: Stop using platform_crash() Pavel Reichl
2021-08-06 21:23 ` Pavel Reichl [this message]
2021-08-06 21:23 ` [PATCH v2 23/29] xfsprogs: Stop using platform_check_iswritable() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 24/29] xfsprogs: Stop using platform_set_blocksize() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 25/29] xfsprogs: Stop using platform_findrawpath() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 26/29] xfsprogs: Stop using platform_findblockpath() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 27/29] xfsprogs: Stop using platform_direct_blockdev() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 28/29] xfsprogs: Stop using platform_align_blockdev() Pavel Reichl
2021-08-06 21:23 ` [PATCH v2 29/29] xfsprogs: Stop using platform_physmem() Pavel Reichl
2021-08-06 23:05 ` [PATCH v2 00/29] xfsprogs: Drop the 'platform_' prefix Dave Chinner
2021-08-07 15:13 ` Pavel Reichl
2021-08-07 21:46 ` Dave Chinner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210806212318.440144-23-preichl@redhat.com \
--to=preichl@redhat.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).