Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp468318rwr; Wed, 3 May 2023 01:04:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5F3/NbV01I5FdXLvlcrDHX3xkmAtftELdwfkTVTFgzO4NKJkF6YR/CvzHe5/WN6rotbQFY X-Received: by 2002:a05:6a20:6f03:b0:f8:b39b:b24e with SMTP id gt3-20020a056a206f0300b000f8b39bb24emr20235697pzb.11.1683101075030; Wed, 03 May 2023 01:04:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683101075; cv=none; d=google.com; s=arc-20160816; b=zQ7WeZLiB4f6YLboZ/yYXW1YAbO3SBy3D+djkHWFprrWqDd6PQ5Rvd1wV1EzA9fxgM DUpRNb77RIc/wTSH4K8BfeRUFIgdtvSsRUj2UgOBhmWkmT4aKMvl4L8j3nEKvD15MWHL npY9EDhFj1A8B2dnXIiUu/EmRRp4Jps41xme+HUhN6GFn8V2HPp5pMux/YrBhxR6ipSj etNadet/v6E7IMQqC9RfvWpi1C+o+scWVGCF1g+m+mRFw7rc+Lx5aahBZ7igPXsTOeGP 4Evsn2R8MxT387Ftm76qBL1b8BXNnus59DRDdY5ItLsayn+zo1Hu+09bVva/z6yZ+Tbk TVGA== 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=Xw83kEvyDvOY4G+duwKj+zpJnWldo/RL4BBA4e0mSGM=; b=SRsY+fFpb1xrgViYAtknhmj/vR5HN6CnR3hWnRQx89kv3d1kB4qZL8WoimdunhZHoq MB6V4pZxVvj00TgVPn8TkmorZYTgLdipSa36TC4bfAFfLOulQLIdZp0uQjTPj4gUb4/3 uhmB77DM5tnmHfv4H+8O+hJcFGWSiWbkBZRhzp7AA9i989M/a4qH8FkRDSEKgG7sDIIF Z9/qA6UAxAL3tobzUF77LgYhJTcQVn2M0qj1L6F3Aqm9Gyf319cL7VW532KRSv1PnTB/ rtzmUTZPo0ksjEcdYKpGGUFKcHBp53h1aYi/GogvRBLLQV1acsBwfOIV7OMkxw0l3aUq 04rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=J4gbtqMO; dkim=neutral (no key) header.i=@suse.de; 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 u23-20020a627917000000b0064353c7d213si112324pfc.377.2023.05.03.01.04.20; Wed, 03 May 2023 01:04:35 -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=J4gbtqMO; dkim=neutral (no key) header.i=@suse.de; 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 S229724AbjECIDU (ORCPT + 99 others); Wed, 3 May 2023 04:03:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229559AbjECIDN (ORCPT ); Wed, 3 May 2023 04:03:13 -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 4BAF310F5; Wed, 3 May 2023 01:03:12 -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 EEDCA200AD; Wed, 3 May 2023 08:03:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1683100990; 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=Xw83kEvyDvOY4G+duwKj+zpJnWldo/RL4BBA4e0mSGM=; b=J4gbtqMOaRgITZNuTkoHNOTSHNPZQVgIAUhLkOtKGIzeLOBaWeo940hhp+gl5Omfsv9Xml QszrUOiYnj+RF/CiuxWU+uAdW2/u/JTJZ6xJynFvs/zvxwJA4oBlehEdPn7BPMiWgvgsRl 6Gg/Ik9TNNjBWwz/67d1Umf5x1v/IWE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1683100990; 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=Xw83kEvyDvOY4G+duwKj+zpJnWldo/RL4BBA4e0mSGM=; b=qpcx2sDyYcBTYxeXHcHB+6JB1vu5LPj/85rqnKETu851ayoBKHu3LJ3UkeLfmToFuzWWZ4 TlvdCYH2EwfGPxDA== 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 E18621331F; Wed, 3 May 2023 08:03:10 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id scv+Nj4VUmQvYgAAMHmgww (envelope-from ); Wed, 03 May 2023 08:03:10 +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 , Hannes Reinecke , Daniel Wagner Subject: [PATCH blktests v3 02/12] nvme: Do not hard code device size for dd test Date: Wed, 3 May 2023 10:02:48 +0200 Message-Id: <20230503080258.14525-3-dwagner@suse.de> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230503080258.14525-1-dwagner@suse.de> References: <20230503080258.14525-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,URIBL_BLOCKED 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, so that the device size can be configurable in future. Reviewed-by: Hannes Reinecke 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..875e99eea346 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)) + + 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..8cb343e1d31c 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)) + + dd if=/dev/urandom of="/dev/${nvmedev}n1" \ + count="${count}" bs="${bs}" status=none nvme flush "/dev/${nvmedev}n1" -n 1 -- 2.40.0