Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1252668 > unrolled thread

Re: [PATCH v5 2/2] lib/test-string_helpers.c: add string_get_size() tests

Started byRasmus Villemoes <linux@rasmusvillemoes.dk>
First post2015-10-21 12:20 +0200
Last post2015-10-23 14:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v5 2/2] lib/test-string_helpers.c: add string_get_size() tests Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-10-21 12:20 +0200
    Re: [PATCH v5 2/2] lib/test-string_helpers.c: add string_get_size() tests Vitaly Kuznetsov <vkuznets@redhat.com> - 2015-10-23 14:40 +0200

#1252668 — Re: [PATCH v5 2/2] lib/test-string_helpers.c: add string_get_size() tests

FromRasmus Villemoes <linux@rasmusvillemoes.dk>
Date2015-10-21 12:20 +0200
SubjectRe: [PATCH v5 2/2] lib/test-string_helpers.c: add string_get_size() tests
Message-ID<qlYEW-8lO-5@gated-at.bofh.it>
On Thu, Sep 17 2015, Vitaly Kuznetsov <vkuznets@redhat.com> wrote:

> +
> +static __init void test_string_get_size(void)
> +{
> +	test_string_get_size_one(16384, 512, STRING_UNITS_2, "8.00 MiB");
> +	test_string_get_size_one(8192, 4096, STRING_UNITS_10, "32.7 MB");

This is a little late, but I just noticed that string_get_size with
STRING_UNITS_10, block size >= 1024 and sufficiently large size seems to
be broken. Yes, 32.7 MB is what it produces, but is it what it should
give? 8192*4096 = 33554432, so I'd expect "33.5 MB". It does give that
when we pass size=65536 and block_size=512; a combination with the same
product.

I think the problem is that the remainder coming out of the while
(blk_size >= divisor[units]) loop is dropped on the floor in the
subsequent size > exp case - but I'm too lazy right now to figure out how
to fix it.

Rasmus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1254561

FromVitaly Kuznetsov <vkuznets@redhat.com>
Date2015-10-23 14:40 +0200
Message-ID<qmJNy-1va-59@gated-at.bofh.it>
In reply to#1252668
Rasmus Villemoes <linux@rasmusvillemoes.dk> writes:

> On Thu, Sep 17 2015, Vitaly Kuznetsov <vkuznets@redhat.com> wrote:
>
>> +
>> +static __init void test_string_get_size(void)
>> +{
>> +	test_string_get_size_one(16384, 512, STRING_UNITS_2, "8.00 MiB");
>> +	test_string_get_size_one(8192, 4096, STRING_UNITS_10, "32.7 MB");
>
> This is a little late,

Thanks for the ping, it turns out this patch was never merged (though
the one fixing the issue was), I'll have to resend.

> but I just noticed that string_get_size with
> STRING_UNITS_10, block size >= 1024 and sufficiently large size seems to
> be broken. Yes, 32.7 MB is what it produces, but is it what it should
> give? 8192*4096 = 33554432, so I'd expect "33.5 MB". It does give that
> when we pass size=65536 and block_size=512; a combination with the same
> product.
>
> I think the problem is that the remainder coming out of the while
> (blk_size >= divisor[units]) loop is dropped on the floor in the
> subsequent size > exp case - but I'm too lazy right now to figure out how
> to fix it.

Ok, I'll take a look.

-- 
  Vitaly
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web