From patchwork Wed Aug 29 12:23:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Holmberg X-Patchwork-Id: 10580125 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 3B55D920 for ; Wed, 29 Aug 2018 12:24:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 291022A6CF for ; Wed, 29 Aug 2018 12:24:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1AF9B2A70A; Wed, 29 Aug 2018 12:24:09 +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 BBDD12A6CF for ; Wed, 29 Aug 2018 12:24:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727460AbeH2QUk (ORCPT ); Wed, 29 Aug 2018 12:20:40 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:35986 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728245AbeH2QUk (ORCPT ); Wed, 29 Aug 2018 12:20:40 -0400 Received: by mail-ed1-f65.google.com with SMTP id f4-v6so3783945edq.3 for ; Wed, 29 Aug 2018 05:23:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=owltronix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lfyMZlbjbi+SYjhMjZnTgdIpBeV8AHl05jO2l5sWcXY=; b=sYIkLWnCVWGpFIbCk/wCWULMG4wXn798HYm6CEGy/nmnWGgONpOOwLBVaDEkiywptB OPCxvyQAjEm8oIRIWYHDj09K2BODTqTBw3lXrwdQ1SwTPTVx9NWdaW6kn8OsooKi+CbN qiuGVly//MVu3sieDFpQN5XcqCAkTMuO9UxCxc5lmyMX4KJFPad8BcRcty6RUEipWw/4 Whtl8evBPM8fvW0+L/xdAkmWwuN0kO+K7qChzcdzlB1ebjaH57I/aWTZ0kYvUhtKHCgq aVUxz+dPid4bckQtSYO86OREvy3DVMOsLOxWlf3N894Mps/wutI1jmtV4G+aZe3MQ4Qu cq9A== 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; bh=lfyMZlbjbi+SYjhMjZnTgdIpBeV8AHl05jO2l5sWcXY=; b=Elw4XhheFCl3slNT5k9EfNyOfkdnrS+2lvgKm12YAm8k0VqNVpVgHx8nlY0J4iX5Ex WChaay17migMrW1C82BqOIjI6MUscqnV4qGFUfAlvMY7Lo/drvfPLjL7jRA+fMs4c9mT wj2Htk4amm6iRSNgKdjvGt/QBcuGy9ufDh01IJnkVxFy3CKgxgEX1DzCwpH07c+mZ30D X7l+1IATyldksO8XWiQLxNIq/jScS7tUn6Tiw4XFHtuAOB9seihNiYXrErwF1vcphkFf kuZ14sXYGTc5wM3Um99KhuFFRK2wASGp5Ngf0HrUT92lrwEQsox5/t5rgp7X9lM7TJqD rPbg== X-Gm-Message-State: APzg51AKatBPNLMIZfH5Vc1dd5x1WTCnN/eraCdpvo9R7hOHtva9QF/O Jm5AXr0IRJ7CitbR44Z7ytt9qw== X-Google-Smtp-Source: ANB0VdYAQ+RjHI27Vgvn+uBh+ixA2+fz4NDdj+pxYu+jFIJP1CAvy4FAM85CyiANDIdz9SL5yVxUkw== X-Received: by 2002:a50:c05a:: with SMTP id u26-v6mr7258923edd.107.1535545439305; Wed, 29 Aug 2018 05:23:59 -0700 (PDT) Received: from titan.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id f26-v6sm1752068edb.28.2018.08.29.05.23.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Aug 2018 05:23:58 -0700 (PDT) From: Hans Holmberg To: Matias Bjorling Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Gonzales , Hans Holmberg Subject: [PATCH 7/7] lightnvm: pblk: fix write amplificiation calculation Date: Wed, 29 Aug 2018 14:23:34 +0200 Message-Id: <1535545414-550-8-git-send-email-hans.ml.holmberg@owltronix.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535545414-550-1-git-send-email-hans.ml.holmberg@owltronix.com> References: <1535545414-550-1-git-send-email-hans.ml.holmberg@owltronix.com> 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 --- 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",