Linux RAID subsystem development
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Shaohua Li <shli@kernel.org>, linux-raid@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>, Mike Snitzer <snitzer@redhat.com>,
	Coly Li <colyli@suse.de>, Mikulas Patocka <mpatocka@redhat.com>,
	Song Liu <songliubraving@fb.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] md: Convert to use int_pow()
Date: Fri, 26 Jul 2019 19:48:23 +0300	[thread overview]
Message-ID: <20190726164823.GB9224@smile.fi.intel.com> (raw)
In-Reply-To: <20190723204155.71531-1-andriy.shevchenko@linux.intel.com>

On Tue, Jul 23, 2019 at 11:41:55PM +0300, Andy Shevchenko wrote:
> Instead of linear approach to calculate power of 10, use generic int_pow()
> which does it better.

I took into Cc drivers/dm guys as they might have known something about md raid
state of affairs. Sorry if I mistakenly added somebody.

Who is doing this?
Should it be orphaned?

(I got a bounce from Shaohua address)

> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/md/md.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 24638ccedce4..3f1252440ad0 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -3664,11 +3664,7 @@ int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale)
>  		return -EINVAL;
>  	if (decimals < 0)
>  		decimals = 0;
> -	while (decimals < scale) {
> -		result *= 10;
> -		decimals ++;
> -	}
> -	*res = result;
> +	*res = result * int_pow(10, scale - decimals);
>  	return 0;
>  }
>  
> -- 
> 2.20.1
> 

-- 
With Best Regards,
Andy Shevchenko

       reply	other threads:[~2019-07-26 16:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190723204155.71531-1-andriy.shevchenko@linux.intel.com>
2019-07-26 16:48 ` Andy Shevchenko [this message]
2019-07-26 17:18   ` [PATCH v1] md: Convert to use int_pow() Song Liu
2019-07-26 18:58     ` Andy Shevchenko
2019-07-26 20:28       ` Song Liu

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=20190726164823.GB9224@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=axboe@kernel.dk \
    --cc=colyli@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=shli@kernel.org \
    --cc=snitzer@redhat.com \
    --cc=songliubraving@fb.com \
    /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