From patchwork Fri Nov 20 09:01:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Javier_Gonz=C3=A1lez?= X-Patchwork-Id: 7666091 X-Patchwork-Delegate: axboe@kernel.dk Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 699C19F392 for ; Fri, 20 Nov 2015 09:01:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 74B4A20457 for ; Fri, 20 Nov 2015 09:01:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7AA4B20443 for ; Fri, 20 Nov 2015 09:01:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934857AbbKTJBh (ORCPT ); Fri, 20 Nov 2015 04:01:37 -0500 Received: from mail-wm0-f47.google.com ([74.125.82.47]:36285 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935049AbbKTJBf (ORCPT ); Fri, 20 Nov 2015 04:01:35 -0500 Received: by wmww144 with SMTP id w144so10981224wmw.1 for ; Fri, 20 Nov 2015 01:01:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=javigon-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CAXSRWsPjtZq40kWGqNd9tuARXWWqWDu8V78MyEevdI=; b=ZmIC8TXUiueOchEoJqUxwYUS5RzlE4lyKis6icU06vAnUzOfZip5xZs1+GCqVhBi0f oyJLSl33ajO3IIwn+pCopz1Ie0qqOgyZdpNJnTX1mwQrSnznwzE1qjYMVLqyc4D5VRsW uGfuPxRSLSdp0HHDGBfyp26V55H4L4OZj//eTCSiEy9I0UbIuydbOcH/w/h7qk1rierZ 4ySy4lfXc5ebxURfFJE0ZuOX2aEPI4IALtPhD9kuRanouf5XY+o9wXD1Y+mfXz8M3sKv qvG1zpQxuE+N/P/Wlorha1RYTbpF91Bm/mqvpIQGHxR6LwnwnzV6UvZ7n3dyiubGFLXK 5BDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CAXSRWsPjtZq40kWGqNd9tuARXWWqWDu8V78MyEevdI=; b=c6YP1mC4U5mpUMFuwk7lzodr5+6WWGGY0n7M4OJuYkpQ1Qa5kfYMIxBkZ8wpR6QR78 m+fG0DWupqekk0pNlkyJwtxIVxmelhoYgz4UT7/zxbT1EGt8H8y1JraQO8qVfqKuAKJJ /bE8NG1P3jx07Z9+dvE2512sJ/LwKGsbc+kWgUOyMilrJSqOnvopPshHxX2+u3E0dZ8E 63F+z1XWi9P+qFFOblDkcDttZ+2NuLoSyGf4G2o9DUW+bMdWQhTP5QIzpfAuxlndl2Ct iKUZzXAmvSi9nnwTMMtzHKspQ+OKBpklwpQtxG+5JtuRb+Z51qt8TaZDEzdVUmhkaaSS uUew== X-Gm-Message-State: ALoCoQnDEvIIDZ7sp/VkB7gju/ZZEmBZHssnxTZj7dSwF+2y+/V9lXdcPvApKuJS0SImbyAjia7z X-Received: by 10.28.61.4 with SMTP id k4mr1107864wma.34.1448010094300; Fri, 20 Nov 2015 01:01:34 -0800 (PST) Received: from localhost.localdomain (6164198-cl69.boa.fiberby.dk. [193.106.164.198]) by smtp.gmail.com with ESMTPSA id c194sm1763826wmd.13.2015.11.20.01.01.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 20 Nov 2015 01:01:33 -0800 (PST) From: Javier Gonzalez To: m@bjorling.me, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Cc: javier@javigon.com, Javier Gonzalez Subject: [PATCH 2/2] lightnvm: add lun information to show debug interf. Date: Fri, 20 Nov 2015 10:01:25 +0100 Message-Id: <1448010085-31281-2-git-send-email-javier@javigon.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1448010085-31281-1-git-send-email-javier@javigon.com> References: <1448010085-31281-1-git-send-email-javier@javigon.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add free block, used block, and bad block information to the show debug interface. This information is used to debug how targets track blocks. Also, change debug function name to make it more generic. Signed-off-by: Javier Gonzalez --- drivers/lightnvm/core.c | 2 +- drivers/lightnvm/gennvm.c | 19 ++++++++++++++----- include/linux/lightnvm.h | 4 ++-- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c index 51e0008..e0072b5 100644 --- a/drivers/lightnvm/core.c +++ b/drivers/lightnvm/core.c @@ -544,7 +544,7 @@ static int nvm_configure_show(const char *val) if (!dev->mt) return 0; - dev->mt->free_blocks_print(dev); + dev->mt->lun_info_print(dev); return 0; } diff --git a/drivers/lightnvm/gennvm.c b/drivers/lightnvm/gennvm.c index 43c01e0..e20e74e 100644 --- a/drivers/lightnvm/gennvm.c +++ b/drivers/lightnvm/gennvm.c @@ -464,15 +464,24 @@ static struct nvm_lun *gennvm_get_lun(struct nvm_dev *dev, int lunid) return &gn->luns[lunid].vlun; } -static void gennvm_free_blocks_print(struct nvm_dev *dev) +static void gennvm_lun_info_print(struct nvm_dev *dev) { struct gen_nvm *gn = dev->mp; struct gen_lun *lun; unsigned int i; - gennvm_for_each_lun(gn, lun, i) - pr_info("%s: lun%8u\t%u\n", - dev->name, i, lun->vlun.nr_free_blocks); + + gennvm_for_each_lun(gn, lun, i) { + spin_lock(&lun->vlun.lock); + + pr_info("%s: lun%8u\t%u\t%u\t%u\n", + dev->name, i, + lun->vlun.nr_free_blocks, + lun->vlun.nr_inuse_blocks, + lun->vlun.nr_bad_blocks); + + spin_unlock(&lun->vlun.lock); + } } static struct nvmm_type gennvm = { @@ -490,7 +499,7 @@ static struct nvmm_type gennvm = { .erase_blk = gennvm_erase_blk, .get_lun = gennvm_get_lun, - .free_blocks_print = gennvm_free_blocks_print, + .lun_info_print = gennvm_lun_info_print, }; static int __init gennvm_module_init(void) diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h index 76acd15..e527d67 100644 --- a/include/linux/lightnvm.h +++ b/include/linux/lightnvm.h @@ -380,7 +380,7 @@ typedef int (nvmm_end_io_fn)(struct nvm_rq *, int); typedef int (nvmm_erase_blk_fn)(struct nvm_dev *, struct nvm_block *, unsigned long); typedef struct nvm_lun *(nvmm_get_lun_fn)(struct nvm_dev *, int); -typedef void (nvmm_free_blocks_print_fn)(struct nvm_dev *); +typedef void (nvmm_lun_info_print_fn)(struct nvm_dev *); struct nvmm_type { const char *name; @@ -404,7 +404,7 @@ struct nvmm_type { nvmm_get_lun_fn *get_lun; /* Statistics */ - nvmm_free_blocks_print_fn *free_blocks_print; + nvmm_lun_info_print_fn *lun_info_print; struct list_head list; };