From patchwork Tue Oct 9 11:11:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matias Bjorling X-Patchwork-Id: 10632311 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BDCEF15E8 for ; Tue, 9 Oct 2018 11:16:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D68928A5E for ; Tue, 9 Oct 2018 11:16:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 90D0828A45; Tue, 9 Oct 2018 11:16:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A9ED28A45 for ; Tue, 9 Oct 2018 11:16:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727467AbeJISat (ORCPT ); Tue, 9 Oct 2018 14:30:49 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:34115 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726523AbeJISas (ORCPT ); Tue, 9 Oct 2018 14:30:48 -0400 Received: by mail-pf1-f196.google.com with SMTP id k19-v6so684880pfi.1 for ; Tue, 09 Oct 2018 04:14:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lightnvm-io.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Sy+r8jO0Q8UfjF0drR25FSVUoi9fSGNT9sYCdGAlsHo=; b=qb48qzLdrPCcT4dzCpc1qerS3usR4wixuvwV2JYKlwFBA60Tc8F7tf79Djf87xRAU+ wTCiCYaNekIrm7xCIkmb8FwB1Y0SPmNxkNfj8ihasvqv4Mza1Xh7NY8vtLI2Jw+J0rg4 RmwbA3Q+cbciTcdoiXcKxFz0GgQkDNVYqwj1+vAyd/Ip+9MpIZRBRmZ8N9azmwBPpEX9 sPXzhq64U9zE5paxhJh2xC+i2hjTkpt9+DR5K1gv2qSHC92mXGWnXaT6rFYDpYJm9sXv bPW8A/z9EPpqfrQ63PDXLa7AF/UyMaknOnSsMyl4w1RWPx5FYaR+eSdYmm1OO16/GPau n+Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Sy+r8jO0Q8UfjF0drR25FSVUoi9fSGNT9sYCdGAlsHo=; b=nUXeNt86Yaou13DCNWL9uc/H5HcE26P3wOxj2y24/B9ifNoM7oq8SvMoVLBIrDJzZP IfbYWQDqt/l5gls/AeMnRkLuTS0SOzoeXRu/hbPqy0263qCbY/1k2heuZhvUnQljCg4K w6hP6jp2P5QfxvB16t21szmNxiqgepkOlmJCZB5CuqFQdXXA+7jME72fUehu6uD/7UPR qaOWm6QRoZurON0H85fI3SdT2KwL5zhFl4+X2BwlLi7Tt/GkR6Uxx5/IAz1OUvEc/jBm aZOiN7ZS0szSiGaQhqs2BlDwhb5vMEA91UB3OYy5F6iekNMTgRafjrs98nSdUtzy+nYT Y8xQ== X-Gm-Message-State: ABuFfoipySFOyVcBZXp6Xnzo3tOAzdPHBrNs5k4zUHHn27tXv8XThvPE 1BgT2MU9w1+se9Ec+k8Emyky2g== X-Google-Smtp-Source: ACcGV62eBanY5eJCkX4RbIofpg3vKxVYbAQAAZJC2bHBR3UZtQcZN59gGDtHj+N0YTaMvmMp6KKtpw== X-Received: by 2002:a63:501:: with SMTP id 1-v6mr24837626pgf.205.1539083661626; Tue, 09 Oct 2018 04:14:21 -0700 (PDT) Received: from skyninja.hgst.com (rap-us.hgst.com. [199.255.44.250]) by smtp.gmail.com with ESMTPSA id p1-v6sm25342380pff.128.2018.10.09.04.14.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Oct 2018 04:14:20 -0700 (PDT) From: =?utf-8?q?Matias_Bj=C3=B8rling?= To: axboe@fb.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg , =?utf-8?q?Matias_Bj=C3=B8rling?= Subject: [GIT PULL 20/45] lightnvm: pblk: fix write amplificiation calculation Date: Tue, 9 Oct 2018 13:11:50 +0200 Message-Id: <20181009111215.7653-21-mb@lightnvm.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181009111215.7653-1-mb@lightnvm.io> References: <20181009111215.7653-1-mb@lightnvm.io> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Hans Holmberg When the user data counter exceeds 32 bits, the write amplification calculation does not provide the right value. Fix this by using div64_u64 in stead of div64. Fixes: 76758390f83e ("lightnvm: pblk: export write amplification counters to sysfs") Signed-off-by: Hans Holmberg Signed-off-by: Matias Bjørling --- drivers/lightnvm/pblk-sysfs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/lightnvm/pblk-sysfs.c b/drivers/lightnvm/pblk-sysfs.c index 9fc3dfa168b4..e56eeeeb914e 100644 --- a/drivers/lightnvm/pblk-sysfs.c +++ b/drivers/lightnvm/pblk-sysfs.c @@ -337,7 +337,6 @@ static ssize_t pblk_get_write_amp(u64 user, u64 gc, u64 pad, { int sz; - sz = snprintf(page, PAGE_SIZE, "user:%lld gc:%lld pad:%lld WA:", user, gc, pad); @@ -349,7 +348,7 @@ static ssize_t pblk_get_write_amp(u64 user, u64 gc, u64 pad, u32 wa_frac; wa_int = (user + gc + pad) * 100000; - wa_int = div_u64(wa_int, user); + wa_int = div64_u64(wa_int, user); wa_int = div_u64_rem(wa_int, 100000, &wa_frac); sz += snprintf(page + sz, PAGE_SIZE - sz, "%llu.%05u\n",