* [PATCH blktests v2] loop/002: Regression testing for loop device flush
@ 2017-06-27 4:01 James Wang
2017-08-18 8:11 ` Omar Sandoval
0 siblings, 1 reply; 3+ messages in thread
From: James Wang @ 2017-06-27 4:01 UTC (permalink / raw)
To: osandov
Cc: osandov, hch, axboe, hare, linux-block, linux-kernel, mgorman,
James Wang
Add a regression testing for loop device. when an unbound device
be close that take too long time. kernel will consume serveral orders
of magnitude more wall time than it does for a mounted device.
Signed-off-by: James Wang <jnwang@suse.com>
---
tests/loop/002 | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/loop/002.out | 2 ++
2 files changed, 65 insertions(+)
create mode 100755 tests/loop/002
create mode 100644 tests/loop/002.out
diff --git a/tests/loop/002 b/tests/loop/002
new file mode 100755
index 0000000..ef69729
--- /dev/null
+++ b/tests/loop/002
@@ -0,0 +1,63 @@
+#!/bin/bash
+#
+# Test if close()ing a unbound loop device is too slow
+# Copyright (C) 2017 James Wang <jnwang@suse.com>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+DESCRIPTION="Test if close()ing a unbound loop device is too slow"
+
+QUICK=1
+
+run_test() {
+ TIMEFORMAT='%5R'
+ time {
+ for ((i=0;i<200;i++)); do dd if=/dev/loop0 of=/dev/null bs=512 count=1 >/dev/null 2>&1; done
+ }
+}
+clean_up() {
+ if lsmod | grep loop >/dev/null 2>&1; then
+ if ! rmmod loop;then
+ return 2;
+ fi
+ fi
+}
+
+prepare() {
+ modprobe loop max_loop=1
+}
+
+
+test() {
+ echo "Running ${TEST_NAME}"
+
+ clean_up
+ prepare
+ SECONDS=0
+ run_test >/dev/null 2>&1
+ DURATION=${SECONDS}
+
+ clean_up
+ if ! clean_up; then
+ echo "Test complete"
+ return 2
+ fi
+ echo "Test complete"
+ if [[ "${DURATION}" -gt 1 ]]; then
+ echo "test took too long ($URATION seconds)"
+ return 1
+ else
+ return 0
+ fi
+}
diff --git a/tests/loop/002.out b/tests/loop/002.out
new file mode 100644
index 0000000..5c34a37
--- /dev/null
+++ b/tests/loop/002.out
@@ -0,0 +1,2 @@
+Running loop/002
+Test complete
--
2.12.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH blktests v2] loop/002: Regression testing for loop device flush
2017-06-27 4:01 [PATCH blktests v2] loop/002: Regression testing for loop device flush James Wang
@ 2017-08-18 8:11 ` Omar Sandoval
2017-08-18 10:09 ` James Wang
0 siblings, 1 reply; 3+ messages in thread
From: Omar Sandoval @ 2017-08-18 8:11 UTC (permalink / raw)
To: James Wang; +Cc: osandov, hch, axboe, hare, linux-block, linux-kernel, mgorman
On Tue, Jun 27, 2017 at 12:01:47PM +0800, James Wang wrote:
> Add a regression testing for loop device. when an unbound device
> be close that take too long time. kernel will consume serveral orders
> of magnitude more wall time than it does for a mounted device.
James, sorry I forgot about this. I ended up committing a simplified
version here:
https://github.com/osandov/blktests/commit/bbe69c4cc83ddc36e5c82114890ac071d01c8ac5
Thanks for the test!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH blktests v2] loop/002: Regression testing for loop device flush
2017-08-18 8:11 ` Omar Sandoval
@ 2017-08-18 10:09 ` James Wang
0 siblings, 0 replies; 3+ messages in thread
From: James Wang @ 2017-08-18 10:09 UTC (permalink / raw)
To: Omar Sandoval
Cc: osandov, hch, axboe, hare, linux-block, linux-kernel, mgorman
No problem thank you sir
发自我的 iPhone
> 在 2017年8月18日,16:11,Omar Sandoval <osandov@osandov.com> 写道:
>
>> On Tue, Jun 27, 2017 at 12:01:47PM +0800, James Wang wrote:
>> Add a regression testing for loop device. when an unbound device
>> be close that take too long time. kernel will consume serveral orders
>> of magnitude more wall time than it does for a mounted device.
>
> James, sorry I forgot about this. I ended up committing a simplified
> version here:
> https://github.com/osandov/blktests/commit/bbe69c4cc83ddc36e5c82114890ac071d01c8ac5
> Thanks for the test!
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-08-18 10:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-27 4:01 [PATCH blktests v2] loop/002: Regression testing for loop device flush James Wang
2017-08-18 8:11 ` Omar Sandoval
2017-08-18 10:09 ` James Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox