* [PATCH blktests 1/2] nvme: enable buffered_io for file-backed namespaces
@ 2019-01-17 12:59 Johannes Thumshirn
2019-01-17 12:59 ` [PATCH blktests 2/2] nvme: test resize of a namespace with file-backed ns Johannes Thumshirn
2019-01-17 23:46 ` [PATCH blktests 1/2] nvme: enable buffered_io for file-backed namespaces Chaitanya Kulkarni
0 siblings, 2 replies; 6+ messages in thread
From: Johannes Thumshirn @ 2019-01-17 12:59 UTC (permalink / raw)
To: Omar Sandoval
Cc: Linux Block Layer Mailinglist, Linux NVMe Mailinglist,
Anthony Iliopoulos, Johannes Thumshirn
All file-based NVMe over Fabrics tests fail in my test environment as I'm
running these tests form within an initramfs. It turns out the file backing
store of the NVMe target defaults to using direct I/O which is not
available on tmpfs for obvious reasons.
If the backing store of an nvme target is file-based enable the use of
buffered I/O.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
tests/nvme/rc | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/tests/nvme/rc b/tests/nvme/rc
index eff1dd992460..ec92e41396be 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -48,7 +48,7 @@ _remove_nvmet_port() {
_create_nvmet_ns() {
local nvmet_subsystem="$1"
local nsid="$2"
- local blkdev="$3"
+ local backstore="$3"
local uuid="00000000-0000-0000-0000-000000000000"
local subsys_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}"
local ns_path="${subsys_path}/namespaces/${nsid}"
@@ -58,8 +58,11 @@ _create_nvmet_ns() {
fi
mkdir "${ns_path}"
- printf "%s" "${blkdev}" > "${ns_path}/device_path"
+ printf "%s" "${backstore}" > "${ns_path}/device_path"
printf "%s" "${uuid}" > "${ns_path}/device_uuid"
+ if [[ -f ${backstore} ]]; then
+ printf 1 > "${ns_path}/buffered_io"
+ fi
printf 1 > "${ns_path}/enable"
}
--
2.16.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH blktests 2/2] nvme: test resize of a namespace with file-backed ns
2019-01-17 12:59 [PATCH blktests 1/2] nvme: enable buffered_io for file-backed namespaces Johannes Thumshirn
@ 2019-01-17 12:59 ` Johannes Thumshirn
2019-01-18 0:04 ` Chaitanya Kulkarni
2019-01-17 23:46 ` [PATCH blktests 1/2] nvme: enable buffered_io for file-backed namespaces Chaitanya Kulkarni
1 sibling, 1 reply; 6+ messages in thread
From: Johannes Thumshirn @ 2019-01-17 12:59 UTC (permalink / raw)
To: Omar Sandoval
Cc: Linux Block Layer Mailinglist, Linux NVMe Mailinglist,
Anthony Iliopoulos, Johannes Thumshirn
Test resizing of a NVMe namespace by creating a file backed namespace over
nvme-loop with 1G size, connecting to it and then resizing it to 2G.
Check if /proc/partitions and blkdev --getsz $DEVICE see the updated size.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
tests/nvme/029 | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/nvme/029.out | 10 ++++++++
2 files changed, 77 insertions(+)
create mode 100755 tests/nvme/029
create mode 100644 tests/nvme/029.out
diff --git a/tests/nvme/029 b/tests/nvme/029
new file mode 100755
index 000000000000..8c94af039d0f
--- /dev/null
+++ b/tests/nvme/029
@@ -0,0 +1,67 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2019 Johannes Thumshirn
+#
+# Test resize of a namespace with file-backed ns
+
+. tests/nvme/rc
+
+DESCRIPTION="test resize of a namespace with file-backed ns"
+QUICK=1
+
+requires() {
+ _have_program nvme && _have_modules loop nvme-loop nvmet && \
+ _have_configfs
+}
+
+test() {
+ echo "Running ${TEST_NAME}"
+
+ modprobe nvmet
+ modprobe nvme-loop
+
+ local port
+ local nvmedev
+ local namespace
+ local file_path="$TMPDIR/img"
+ local subsys_name="blktests-subsystem-1"
+
+ truncate -s 1G "${file_path}"
+
+ _create_nvmet_subsystem "${subsys_name}" "${file_path}" \
+ "91fdba0d-f87b-4c25-b80f-db7be1418b9e"
+ port="$(_create_nvmet_port "loop")"
+ _add_nvmet_subsys_to_port "${port}" "${subsys_name}"
+
+ nvme connect -t loop -n "${subsys_name}"
+
+ nvmedev="$(_find_nvme_loop_dev)"
+ namespace="${nvmedev}n1"
+ cat "/sys/block/${namespace}/uuid"
+ cat "/sys/block/${namespace}/wwid"
+
+ cat /proc/partitions | grep ${namespace} | awk '{ print $3 }'
+ blockdev --getsz /dev/${namespace}
+
+ echo "Resizing"
+ truncate -s +1G "${file_path}"
+ printf 0 > ${NVMET_CFS}/subsystems/${subsys_name}/namespaces/1/enable
+ printf 1 > ${NVMET_CFS}/subsystems/${subsys_name}/namespaces/1/enable
+ sleep 1
+
+ cat /proc/partitions | grep ${namespace} | awk '{ print $3 }'
+ blockdev --getsz /dev/${namespace}
+
+ nvme disconnect -n "${subsys_name}"
+
+ _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
+ _remove_nvmet_subsystem "${subsys_name}"
+ _remove_nvmet_port "${port}"
+
+ rm -f "${file_path}"
+
+ modprobe -r nvme-loop
+ modprobe -r nvmet
+
+ echo "Test complete"
+}
diff --git a/tests/nvme/029.out b/tests/nvme/029.out
new file mode 100644
index 000000000000..e9571c7c9300
--- /dev/null
+++ b/tests/nvme/029.out
@@ -0,0 +1,10 @@
+Running nvme/029
+91fdba0d-f87b-4c25-b80f-db7be1418b9e
+uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
+1048576
+2097152
+Resizing
+2097152
+4194304
+NQN:blktests-subsystem-1 disconnected 1 controller(s)
+Test complete
--
2.16.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH blktests 1/2] nvme: enable buffered_io for file-backed namespaces
2019-01-17 12:59 [PATCH blktests 1/2] nvme: enable buffered_io for file-backed namespaces Johannes Thumshirn
2019-01-17 12:59 ` [PATCH blktests 2/2] nvme: test resize of a namespace with file-backed ns Johannes Thumshirn
@ 2019-01-17 23:46 ` Chaitanya Kulkarni
2019-01-18 7:17 ` Johannes Thumshirn
1 sibling, 1 reply; 6+ messages in thread
From: Chaitanya Kulkarni @ 2019-01-17 23:46 UTC (permalink / raw)
To: Johannes Thumshirn, Omar Sandoval
Cc: Linux Block Layer Mailinglist, Linux NVMe Mailinglist,
Anthony Iliopoulos
This will force the user to run all tests in the buffered_io mode.
What we really need is a config for the nvme category option which user can set and decide
whether to run buffered_io or direct_io, you can set by default to the buffered_io mode.
From: linux-block-owner@vger.kernel.org <linux-block-owner@vger.kernel.org> on behalf of Johannes Thumshirn <jthumshirn@suse.de>
Sent: Thursday, January 17, 2019 4:59 AM
To: Omar Sandoval
Cc: Linux Block Layer Mailinglist; Linux NVMe Mailinglist; Anthony Iliopoulos; Johannes Thumshirn
Subject: [PATCH blktests 1/2] nvme: enable buffered_io for file-backed namespaces
All file-based NVMe over Fabrics tests fail in my test environment as I'm
running these tests form within an initramfs. It turns out the file backing
store of the NVMe target defaults to using direct I/O which is not
available on tmpfs for obvious reasons.
If the backing store of an nvme target is file-based enable the use of
buffered I/O.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
tests/nvme/rc | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/tests/nvme/rc b/tests/nvme/rc
index eff1dd992460..ec92e41396be 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -48,7 +48,7 @@ _remove_nvmet_port() {
_create_nvmet_ns() {
local nvmet_subsystem="$1"
local nsid="$2"
- local blkdev="$3"
+ local backstore="$3"
local uuid="00000000-0000-0000-0000-000000000000"
local subsys_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}"
local ns_path="${subsys_path}/namespaces/${nsid}"
@@ -58,8 +58,11 @@ _create_nvmet_ns() {
fi
mkdir "${ns_path}"
- printf "%s" "${blkdev}" > "${ns_path}/device_path"
+ printf "%s" "${backstore}" > "${ns_path}/device_path"
printf "%s" "${uuid}" > "${ns_path}/device_uuid"
+ if [[ -f ${backstore} ]]; then
+ printf 1 > "${ns_path}/buffered_io"
+ fi
printf 1 > "${ns_path}/enable"
}
--
2.16.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH blktests 2/2] nvme: test resize of a namespace with file-backed ns
2019-01-17 12:59 ` [PATCH blktests 2/2] nvme: test resize of a namespace with file-backed ns Johannes Thumshirn
@ 2019-01-18 0:04 ` Chaitanya Kulkarni
0 siblings, 0 replies; 6+ messages in thread
From: Chaitanya Kulkarni @ 2019-01-18 0:04 UTC (permalink / raw)
To: Johannes Thumshirn, Omar Sandoval
Cc: Linux Block Layer Mailinglist, Linux NVMe Mailinglist,
Anthony Iliopoulos
Thanks for the test, I actually have a patch for this one, if Christoph and Sagi okay with that I can work on it.
Although, not sure if we want that sort of management code in the target.
From: linux-block-owner@vger.kernel.org <linux-block-owner@vger.kernel.org> on behalf of Johannes Thumshirn <jthumshirn@suse.de>
Sent: Thursday, January 17, 2019 4:59 AM
To: Omar Sandoval
Cc: Linux Block Layer Mailinglist; Linux NVMe Mailinglist; Anthony Iliopoulos; Johannes Thumshirn
Subject: [PATCH blktests 2/2] nvme: test resize of a namespace with file-backed ns
Test resizing of a NVMe namespace by creating a file backed namespace over
nvme-loop with 1G size, connecting to it and then resizing it to 2G.
Check if /proc/partitions and blkdev --getsz $DEVICE see the updated size.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
tests/nvme/029 | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/nvme/029.out | 10 ++++++++
2 files changed, 77 insertions(+)
create mode 100755 tests/nvme/029
create mode 100644 tests/nvme/029.out
diff --git a/tests/nvme/029 b/tests/nvme/029
new file mode 100755
index 000000000000..8c94af039d0f
--- /dev/null
+++ b/tests/nvme/029
@@ -0,0 +1,67 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2019 Johannes Thumshirn
+#
+# Test resize of a namespace with file-backed ns
+
+. tests/nvme/rc
+
+DESCRIPTION="test resize of a namespace with file-backed ns"
+QUICK=1
+
+requires() {
+ _have_program nvme && _have_modules loop nvme-loop nvmet && \
+ _have_configfs
do we really need loop module here ?
also missinghave_program blockdev ?
+}
+
+test() {
+ echo "Running ${TEST_NAME}"
+
+ modprobe nvmet
+ modprobe nvme-loop
+
+ local port
+ local nvmedev
+ local namespace
+ local file_path="$TMPDIR/img"
+ local subsys_name="blktests-subsystem-1"
+
+ truncate -s 1G "${file_path}"
+
+ _create_nvmet_subsystem "${subsys_name}" "${file_path}" \
+ "91fdba0d-f87b-4c25-b80f-db7be1418b9e"
+ port="$(_create_nvmet_port "loop")"
+ _add_nvmet_subsys_to_port "${port}" "${subsys_name}"
+
+ nvme connect -t loop -n "${subsys_name}"
+
+ nvmedev="$(_find_nvme_loop_dev)"
+ namespace="${nvmedev}n1"
+ cat "/sys/block/${namespace}/uuid"
+ cat "/sys/block/${namespace}/wwid"
+
+ cat /proc/partitions | grep ${namespace} | awk '{ print $3 }'
+ blockdev --getsz /dev/${namespace}
+
+ echo "Resizing"
+ truncate -s +1G "${file_path}"
+ printf 0 > ${NVMET_CFS}/subsystems/${subsys_name}/namespaces/1/enable
+ printf 1 > ${NVMET_CFS}/subsystems/${subsys_name}/namespaces/1/enable
+ sleep 1
+
+ cat /proc/partitions | grep ${namespace} | awk '{ print $3 }'
+ blockdev --getsz /dev/${namespace}
+
+ nvme disconnect -n "${subsys_name}"
+
+ _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
+ _remove_nvmet_subsystem "${subsys_name}"
+ _remove_nvmet_port "${port}"
+
+ rm -f "${file_path}"
+
+ modprobe -r nvme-loop
+ modprobe -r nvmet
+
+ echo "Test complete"
+}
diff --git a/tests/nvme/029.out b/tests/nvme/029.out
new file mode 100644
index 000000000000..e9571c7c9300
--- /dev/null
+++ b/tests/nvme/029.out
@@ -0,0 +1,10 @@
+Running nvme/029
+91fdba0d-f87b-4c25-b80f-db7be1418b9e
+uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e
+1048576
+2097152
+Resizing
+2097152
+4194304
+NQN:blktests-subsystem-1 disconnected 1 controller(s)
+Test complete
--
2.16.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH blktests 1/2] nvme: enable buffered_io for file-backed namespaces
2019-01-17 23:46 ` [PATCH blktests 1/2] nvme: enable buffered_io for file-backed namespaces Chaitanya Kulkarni
@ 2019-01-18 7:17 ` Johannes Thumshirn
2019-01-18 19:10 ` Chaitanya Kulkarni
0 siblings, 1 reply; 6+ messages in thread
From: Johannes Thumshirn @ 2019-01-18 7:17 UTC (permalink / raw)
To: Chaitanya Kulkarni, Omar Sandoval
Cc: Linux Block Layer Mailinglist, Linux NVMe Mailinglist,
Anthony Iliopoulos
On 18/01/2019 00:46, Chaitanya Kulkarni wrote:
> This will force the user to run all tests in the buffered_io mode.
>
> What we really need is a config for the nvme category option which user can set and decide
> whether to run buffered_io or direct_io, you can set by default to the buffered_io mode.
We could also introduce a check if we can use direct IO on the
underlying FS, but the only way I can think of from a shell script is
doing a 'dd of=$TMPDIR/testfile oflag=direct' and then populate the
result to the helper functions.
Chaitanya, Omar any ideas?
--
Johannes Thumshirn SUSE Labs Filesystems
jthumshirn@suse.de +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH blktests 1/2] nvme: enable buffered_io for file-backed namespaces
2019-01-18 7:17 ` Johannes Thumshirn
@ 2019-01-18 19:10 ` Chaitanya Kulkarni
0 siblings, 0 replies; 6+ messages in thread
From: Chaitanya Kulkarni @ 2019-01-18 19:10 UTC (permalink / raw)
To: Johannes Thumshirn, Omar Sandoval
Cc: Linux Block Layer Mailinglist, Linux NVMe Mailinglist,
Anthony Iliopoulos
xfstest has the following nicely written routine may be we can re-use that?
from git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git, ${XFSTEST_HOME}/common/rc :-
2185 # check that kernel and filesystem support direct I/O
2186 _require_odirect()
2187 {
2188 if [ $FSTYP = "ext4" ] ; then
2189 if echo "$MOUNT_OPTIONS" | grep -q "test_dummy_encryption"; then
2190 _notrun "ext4 encryption doesn't support O_DIRECT"
2191 elif echo "$MOUNT_OPTIONS" | grep -q "data=journal"; then
2192 _notrun "ext4 data journaling doesn't support O_DIRECT"
2193 fi
2194 fi
2195 local testfile=$TEST_DIR/$$.direct
2196 $XFS_IO_PROG -F -f -d -c "pwrite 0 20k" $testfile > /dev/null 2>&1
2197 if [ $? -ne 0 ]; then
2198 _notrun "O_DIRECT is not supported"
2199 fi
2200 rm -f $testfile 2>&1 > /dev/null
2201 }
2202
This will require to have xfs_io program.
From: Johannes Thumshirn <jthumshirn@suse.de>
Sent: Thursday, January 17, 2019 11:17 PM
To: Chaitanya Kulkarni; Omar Sandoval
Cc: Linux Block Layer Mailinglist; Linux NVMe Mailinglist; Anthony Iliopoulos
Subject: Re: [PATCH blktests 1/2] nvme: enable buffered_io for file-backed namespaces
On 18/01/2019 00:46, Chaitanya Kulkarni wrote:
> This will force the user to run all tests in the buffered_io mode.
>
> What we really need is a config for the nvme category option which user can set and decide
> whether to run buffered_io or direct_io, you can set by default to the buffered_io mode.
We could also introduce a check if we can use direct IO on the
underlying FS, but the only way I can think of from a shell script is
doing a 'dd of=$TMPDIR/testfile oflag=direct' and then populate the
result to the helper functions.
Chaitanya, Omar any ideas?
--
Johannes Thumshirn SUSE Labs Filesystems
jthumshirn@suse.de +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-01-18 19:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-17 12:59 [PATCH blktests 1/2] nvme: enable buffered_io for file-backed namespaces Johannes Thumshirn
2019-01-17 12:59 ` [PATCH blktests 2/2] nvme: test resize of a namespace with file-backed ns Johannes Thumshirn
2019-01-18 0:04 ` Chaitanya Kulkarni
2019-01-17 23:46 ` [PATCH blktests 1/2] nvme: enable buffered_io for file-backed namespaces Chaitanya Kulkarni
2019-01-18 7:17 ` Johannes Thumshirn
2019-01-18 19:10 ` Chaitanya Kulkarni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).