Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1216102rwr; Thu, 20 Apr 2023 11:32:23 -0700 (PDT) X-Google-Smtp-Source: AKy350Yd6/ILgmyyfOdgeOLZ7Fmip3gm/BRhN6I4t5ML7JoPooV3SkKv+F3F+YcEEVN5fPExT7fG X-Received: by 2002:a17:90a:a63:b0:247:1f35:3314 with SMTP id o90-20020a17090a0a6300b002471f353314mr2161863pjo.48.1682015543513; Thu, 20 Apr 2023 11:32:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682015543; cv=none; d=google.com; s=arc-20160816; b=YaF/ZKp+mQEW9u3+FcLXTOc1YAvDiziHHjAyuwrW7Rn3CtseaC83UtPM62gb2r1555 9id126mE/6lPTNGzUvQMqUAdy+qNqpAeUz+uyy2CrkdM/TTRGE+IW7ucFpv8BLhiIja1 zNsDpi2M6V/XcV3GTAdJFkmU1ygIXELJOswZfq45ZC5nYr9rTLmZy8o5YJrXg1TfHmg8 Svnsgg5gq0G0wgwnXJMu8Ci3hDvnIqIjQIa4wMhcbFSdNbnEvKsdR3GY1UCmWp4z9dc2 3bhpionRjFpqb6DpR/HghBAHagYkh6WjLaWLhD+GFtPuT0Br8ewpNfaNv287anFBymJT MktQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=9lIVFZmI6Kd5BjqNKBTjO2IfwGUAsCicokfMeR7skIo=; b=hjw/Tr0k+MBAiP1I645ty3Og4ZuboqdUQOxHw1+dHcaYPMB3bVITbVl/PdSDCCTNNO a8H2Slh5K3derFUWfzbhaytBa47QHn0aBG1dILS/DToXVGDPlCJk3tXFti+O8lO95+mS IXvvfwPVHMKFPtqHcD1txZY6BpI5gFB/Llu7hmowFRmg2adubUo2lRuqayRcS0+yq+z4 FLvQRiNITgdDLe18VT5AESUB+wYv+WPsCea75wxE9d79jkASSGV/FXDfIP0qz/QrUwDJ 3UiS75Zb4dZZmCtmC/HU4GiN+ctszZMZ0RoaXMJyOlhlZpV2vo7VKT9ReOYvx7BQKi6C CwVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=IQSOQLGg; dkim=neutral (no key) header.i=@suse.de header.b=TOVk7c5e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v135-20020a63618d000000b0051ba2c6310bsi2295061pgb.435.2023.04.20.11.32.12; Thu, 20 Apr 2023 11:32:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=IQSOQLGg; dkim=neutral (no key) header.i=@suse.de header.b=TOVk7c5e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231611AbjDTSbg (ORCPT + 99 others); Thu, 20 Apr 2023 14:31:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230129AbjDTSb2 (ORCPT ); Thu, 20 Apr 2023 14:31:28 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CDF530F2; Thu, 20 Apr 2023 11:31:27 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id AFCCF1FD8D; Thu, 20 Apr 2023 18:31:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1682015485; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9lIVFZmI6Kd5BjqNKBTjO2IfwGUAsCicokfMeR7skIo=; b=IQSOQLGg1asFq2ObLcZSIE9clwijfiPy0A5BmBVnz6rkYT+dqKhsycbvhb8v42OrIKBYv1 9HK6gy9rI3M/vrYh1kcCr6Wcm28Fyyv9GtNX43JxAJMpJqzJvlwZeK8vMWvfVzTA+3EjZx U4oUfDyFhvRosAIaSpsUWqH6EGfaPOU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1682015485; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9lIVFZmI6Kd5BjqNKBTjO2IfwGUAsCicokfMeR7skIo=; b=TOVk7c5eVsbcioWCvcv4Furyspbz+giSPRZaF0xQsuc6huQ3sVKafzcbG0nrzzRcysSlre XBGpuMXZ3KwzHBBg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A20E913584; Thu, 20 Apr 2023 18:31:25 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id PVSPJ/2EQWSjNAAAMHmgww (envelope-from ); Thu, 20 Apr 2023 18:31:25 +0000 From: Daniel Wagner To: linux-nvme@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Chaitanya Kulkarni , Shin'ichiro Kawasaki , Daniel Wagner Subject: [PATCH blktests v2 2/9] nvme: Do not hard code device size for dd test Date: Thu, 20 Apr 2023 20:31:11 +0200 Message-Id: <20230420183121.4489-3-dwagner@suse.de> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230420183121.4489-1-dwagner@suse.de> References: <20230420183121.4489-1-dwagner@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Read the block device sizes instead hard coding them. Signed-off-by: Daniel Wagner --- tests/nvme/014 | 10 +++++++++- tests/nvme/015 | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/nvme/014 b/tests/nvme/014 index d13cff7921da..28913641ae40 100755 --- a/tests/nvme/014 +++ b/tests/nvme/014 @@ -23,6 +23,9 @@ test() { local port local nvmedev local loop_dev + local size + local bs + local count local file_path="$TMPDIR/img" local subsys_name="blktests-subsystem-1" @@ -41,7 +44,12 @@ test() { cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" - dd if=/dev/urandom of="/dev/${nvmedev}n1" count=128000 bs=4k status=none + size="$(blockdev --getsize64 "/dev/${nvmedev}n1")" + bs="$(blockdev --getbsz "/dev/${nvmedev}n1")" + count=$((size / bs - 1)) + + dd if=/dev/urandom of="/dev/${nvmedev}n1" \ + count="${count}" bs="${bs}" status=none nvme flush "/dev/${nvmedev}" -n 1 diff --git a/tests/nvme/015 b/tests/nvme/015 index bb52ba2598db..2f7957caac88 100755 --- a/tests/nvme/015 +++ b/tests/nvme/015 @@ -22,6 +22,9 @@ test() { local port local nvmedev + local size + local bs + local count local file_path="$TMPDIR/img" local subsys_name="blktests-subsystem-1" @@ -38,7 +41,12 @@ test() { cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" - dd if=/dev/urandom of="/dev/${nvmedev}n1" count=128000 bs=4k status=none + size="$(blockdev --getsize64 "/dev/${nvmedev}n1")" + bs="$(blockdev --getbsz "/dev/${nvmedev}n1")" + count=$((size / bs - 1)) + + dd if=/dev/urandom of="/dev/${nvmedev}n1" \ + count="${count}" bs="${bs}" status=none nvme flush "/dev/${nvmedev}n1" -n 1 -- 2.40.0