From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754526AbbJUKTU (ORCPT ); Wed, 21 Oct 2015 06:19:20 -0400 Received: from mail-lb0-f177.google.com ([209.85.217.177]:34100 "EHLO mail-lb0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753607AbbJUKTR (ORCPT ); Wed, 21 Oct 2015 06:19:17 -0400 From: Rasmus Villemoes To: Vitaly Kuznetsov Cc: Andrew Morton , Andy Shevchenko , James Bottomley , linux-kernel@vger.kernel.org, "K. Y. Srinivasan" Subject: Re: [PATCH v5 2/2] lib/test-string_helpers.c: add string_get_size() tests Organization: D03 References: <1442483044-9401-1-git-send-email-vkuznets@redhat.com> <1442483044-9401-3-git-send-email-vkuznets@redhat.com> X-Hashcash: 1:20:151021:andriy.shevchenko@linux.intel.com::uvLo86sxmmA6HVUi:00000000000000000000000000000F1F X-Hashcash: 1:20:151021:akpm@linux-foundation.org::ILIIz84P+67xp0dy:00000000000000000000000000000000000001BC X-Hashcash: 1:20:151021:jbottomley@odin.com::nwMYMr8Pghn4YuCG:0000000000000000000000000000000000000000001nam X-Hashcash: 1:20:151021:kys@microsoft.com::GtQ+kan6sGW0OZgp:0000000000000000000000000000000000000000000023/Q X-Hashcash: 1:20:151021:linux-kernel@vger.kernel.org::vIb5YJU7kUX+o3Pe:0000000000000000000000000000000002S9J X-Hashcash: 1:20:151021:vkuznets@redhat.com::Mdivh+u5fEIp8qXB:0000000000000000000000000000000000000000002ljf Date: Wed, 21 Oct 2015 12:19:13 +0200 In-Reply-To: <1442483044-9401-3-git-send-email-vkuznets@redhat.com> (Vitaly Kuznetsov's message of "Thu, 17 Sep 2015 11:44:04 +0200") Message-ID: <87eggor0bi.fsf@rasmusvillemoes.dk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 17 2015, Vitaly Kuznetsov 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