From: Eric Sandeen <sandeen@sandeen.net>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 09/12] xfs_scrub: fix background-mode sleep throttling
Date: Tue, 21 May 2019 14:18:43 -0500 [thread overview]
Message-ID: <cd4cdc09-8cb2-e6dc-ec5b-95894a4faeb7@sandeen.net> (raw)
In-Reply-To: <155839425742.68606.18377767804648563349.stgit@magnolia>
On 5/20/19 6:17 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> The comment preceding background_sleep() is wrong -- the function sleeps
> 100us, not 100ms, for every '-b' passed in after the first one. This is
> really not obvious from the magic numbers, so fix the comment and use
> symbolic constants for easier reading.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Ok, looks like man page was already correct.
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
> ---
> scrub/common.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
>
> diff --git a/scrub/common.c b/scrub/common.c
> index c877c7c8..1cd2b7ba 100644
> --- a/scrub/common.c
> +++ b/scrub/common.c
> @@ -253,21 +253,23 @@ scrub_nproc_workqueue(
> }
>
> /*
> - * Sleep for 100ms * however many -b we got past the initial one.
> + * 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)
> {
> - unsigned long long time;
> + unsigned long long time_ns;
> struct timespec tv;
>
> if (bg_mode < 2)
> return;
>
> - time = 100000ULL * (bg_mode - 1);
> - tv.tv_sec = time / 1000000;
> - tv.tv_nsec = time % 1000000;
> + time_ns = 100 * NSEC_PER_USEC * (bg_mode - 1);
> + tv.tv_sec = time_ns / NSEC_PER_SEC;
> + tv.tv_nsec = time_ns % NSEC_PER_SEC;
> nanosleep(&tv, NULL);
> }
>
>
next prev parent reply other threads:[~2019-05-21 19:18 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-20 23:16 [PATCH 00/12] xfsprogs-5.1: fix various problems Darrick J. Wong
2019-05-20 23:16 ` [PATCH 01/12] libxfs: fix attr include mess Darrick J. Wong
2019-05-21 16:30 ` Eric Sandeen
2019-05-20 23:16 ` [PATCH 02/12] libxfs: set m_finobt_nores when initializing library Darrick J. Wong
2019-05-21 16:33 ` Eric Sandeen
2019-05-20 23:17 ` [PATCH 03/12] libxfs: refactor online geometry queries Darrick J. Wong
2019-05-21 16:38 ` Eric Sandeen
2019-05-21 16:58 ` Darrick J. Wong
2019-05-20 23:17 ` [PATCH 04/12] libxfs: refactor open-coded bulkstat calls Darrick J. Wong
2019-05-20 23:17 ` [PATCH 05/12] libxfs: refactor open-coded INUMBERS calls Darrick J. Wong
2019-05-20 23:17 ` [PATCH 06/12] misc: remove all use of xfs_fsop_geom_t Darrick J. Wong
2019-05-21 16:43 ` Eric Sandeen
2019-05-21 16:58 ` Darrick J. Wong
2019-05-20 23:17 ` [PATCH 07/12] libfrog: fix bitmap return values Darrick J. Wong
2019-05-21 16:54 ` Eric Sandeen
2019-05-21 17:01 ` Darrick J. Wong
2019-05-21 18:59 ` Eric Sandeen
2019-05-21 19:19 ` Christoph Hellwig
2019-05-21 19:20 ` Eric Sandeen
2019-05-21 19:28 ` Christoph Hellwig
2019-05-21 19:33 ` Eric Sandeen
2019-05-22 16:23 ` Eric Sandeen
2019-05-20 23:17 ` [PATCH 08/12] xfs_repair: refactor namecheck functions Darrick J. Wong
2019-05-21 19:16 ` Eric Sandeen
2019-05-20 23:17 ` [PATCH 09/12] xfs_scrub: fix background-mode sleep throttling Darrick J. Wong
2019-05-21 19:18 ` Eric Sandeen [this message]
2019-05-20 23:17 ` [PATCH 10/12] mkfs: allow setting dax flag on root directory Darrick J. Wong
2019-05-21 19:19 ` Eric Sandeen
2019-05-20 23:17 ` [PATCH 11/12] mkfs: validate start and end of aligned logs Darrick J. Wong
2019-05-21 19:24 ` Eric Sandeen
2019-05-22 16:42 ` Darrick J. Wong
2019-05-20 23:18 ` [PATCH 12/12] mkfs: enable reflink by default Darrick J. Wong
2019-05-21 19:27 ` Eric Sandeen
2019-05-21 19:30 ` [PATCH 12/12 V2] " Eric Sandeen
2019-05-22 16:44 ` Darrick J. Wong
2019-05-22 16:46 ` Eric Sandeen
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=cd4cdc09-8cb2-e6dc-ec5b-95894a4faeb7@sandeen.net \
--to=sandeen@sandeen.net \
--cc=darrick.wong@oracle.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