From patchwork Wed Aug 8 01:35:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masayoshi Mizuma X-Patchwork-Id: 10559379 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 1B8F613B4 for ; Wed, 8 Aug 2018 01:36:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 064C22040D for ; Wed, 8 Aug 2018 01:36:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBD3526256; Wed, 8 Aug 2018 01:36:03 +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=-2.8 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6BF352040D for ; Wed, 8 Aug 2018 01:36:03 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 1CBC2210DF5F3; Tue, 7 Aug 2018 18:36:03 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::c44; helo=mail-yw1-xc44.google.com; envelope-from=msys.mizuma@gmail.com; receiver=linux-nvdimm@lists.01.org Received: from mail-yw1-xc44.google.com (mail-yw1-xc44.google.com [IPv6:2607:f8b0:4864:20::c44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1FD48210DF5EE for ; Tue, 7 Aug 2018 18:36:02 -0700 (PDT) Received: by mail-yw1-xc44.google.com with SMTP id y203-v6so410793ywd.9 for ; Tue, 07 Aug 2018 18:36:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=0wyiVkRj2PqSViT5WWAh5vipcFvLdNZdwmnV67EwBZE=; b=CfOkWLjMMqjms2CL3Pqn65dcESxLIp8sMExE1zMwejd38DMuPEPpekQi4bebJjYh5H 7Bf6vYQhGasvwSVq1dQBy/cHIQblcZS2dlyuekQb/bBh+YFenunl740Y7c765Chn80rO K/dzdq1PWKIVLLRasJ3rIhssEn/FPi8SNnxxISw6T0GNSDKKEWXLvw8ZCqx/PrYK1No/ 7K9byX2mOLLpOnX7crxsEO1bPahqb7ZMCc+1VRwnr3QNGQSCO/KGbfPspjODc4Ye8Qe5 TldsJZSeaaIcgGloah6/ikUBGfzpRyYBfWGfebA2iKVo3q9vnAJX0D944eVYxtruWheW x0Pg== 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; bh=0wyiVkRj2PqSViT5WWAh5vipcFvLdNZdwmnV67EwBZE=; b=tck2iEjZR5ZfUAD5kHQHnjDDHUMKIZcEMjPR1uBZrVqhZvew9qFOV1N/XE+PEOBuJU 3lmON3lf2zXYfGaUQtJBFTT3FJdqflD2u3+Vi73lnqq4t0fKYG56gsAT47sDod9TBtAQ lrK9JbtKQz3NcJoo9+6bcSQCWXGcpEd0/yFUxR3WDMMryHPjDYm5ZrS95aUO2vNp2/r4 ZdRG7DrT/DcQxV+lrVdzFEoHojrIEg5yy+53J8A9/muuIpHeT4zLOGOCmX7dIkKsubH7 JUixN3LQkGTwyZgSpSKCpkPgLtomIgy/a74fFV3MUmzcnFFgYDFMB3lxNv2/+NQPt2oi JvzA== X-Gm-Message-State: AOUpUlE6MNG8vWT6HsyU2Dqta1iIPkQuFKHFqikbcgleRCc5bLjjOnpQ IumpkNihjDm9oPZ6Y8Wa2kXcOro= X-Google-Smtp-Source: AA+uWPyGv7Gi9YHV+a8RiVvOAE5pb5C8qdYxJ4mJQ5LQL1bx80V+pdbnwV0K7XYzGKTSONowcyyaJg== X-Received: by 2002:a25:6f8b:: with SMTP id k133-v6mr424709ybc.286.1533692161275; Tue, 07 Aug 2018 18:36:01 -0700 (PDT) Received: from gabell.redhat.com ([2601:18f:600:d880:fdf0:58cc:b692:c048]) by smtp.gmail.com with ESMTPSA id 135-v6sm1216245ywm.74.2018.08.07.18.36.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Aug 2018 18:36:00 -0700 (PDT) From: Masayoshi Mizuma To: vishal.l.verma@intel.com, linux-nvdimm@lists.01.org Subject: [PATCH v3] ndctl, test: add a new unit test for max_available_extent namespace Date: Tue, 7 Aug 2018 21:35:45 -0400 Message-Id: <20180808013545.4541-1-msys.mizuma@gmail.com> X-Mailer: git-send-email 2.17.1 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Masayoshi Mizuma MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP From: Masayoshi Mizuma Add a new unit test to test max_available_extent namespace. This feature is implemented by the following patches. kernel side: https://lists.01.org/pipermail/linux-nvdimm/2018-July/016731.html https://lists.01.org/pipermail/linux-nvdimm/2018-July/016732.html ndctl side: https://lists.01.org/pipermail/linux-nvdimm/2018-July/017176.html Signed-off-by: Masayoshi Mizuma --- test/Makefile.am | 3 ++- test/max_available_extent_ns.sh | 46 +++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100755 test/max_available_extent_ns.sh diff --git a/test/Makefile.am b/test/Makefile.am index 8c55056..9af2464 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -22,7 +22,8 @@ TESTS =\ firmware-update.sh \ ack-shutdown-count-set \ rescan-partitions.sh \ - monitor.sh + monitor.sh \ + max_available_extent_ns.sh check_PROGRAMS =\ libndctl \ diff --git a/test/max_available_extent_ns.sh b/test/max_available_extent_ns.sh new file mode 100755 index 0000000..1c7e7bf --- /dev/null +++ b/test/max_available_extent_ns.sh @@ -0,0 +1,46 @@ +#!/bin/bash -Ex + +# SPDX-License-Identifier: GPL-2.0 +# Copyright(c) 2018, FUJITSU LIMITED. All rights reserved. + +rc=77 + +. ./common + +trap 'err $LINENO' ERR + +check_min_kver "4.19" || do_skip "kernel $KVER may not support max_available_size" + +init() +{ + $NDCTL disable-region -b $NFIT_TEST_BUS0 all + $NDCTL zero-labels -b $NFIT_TEST_BUS0 all + $NDCTL enable-region -b $NFIT_TEST_BUS0 all +} + +do_test() +{ + region=$($NDCTL list -b $NFIT_TEST_BUS0 -R -t pmem | jq -r 'sort_by(-.size) | .[].dev' | head -1) + + available_sz=$($NDCTL list -r $region | jq -r .[].available_size) + size=$(( available_sz/4 )) + + NS=() + for ((i=0; i<3; i++)) + do + NS[$i]=$($NDCTL create-namespace -r $region -t pmem -s $size | jq -r .dev) + [[ -n ${NS[$i]} ]] + done + + $NDCTL disable-namespace ${NS[1]} + $NDCTL destroy-namespace ${NS[1]} + + $NDCTL create-namespace -r $region -t pmem +} + +modprobe nfit_test +rc=1 +init +do_test +_cleanup +exit 0