From: Tomas Racek <tracek@redhat.com>
To: xfs@oss.sgi.com
Subject: xfstests: standard way of handling loop devices
Date: Thu, 9 Aug 2012 04:30:21 -0400 (EDT) [thread overview]
Message-ID: <1855221844.724464.1344501021962.JavaMail.root@redhat.com> (raw)
In-Reply-To: <1664629800.716769.1344498186489.JavaMail.root@redhat.com>
Hi,
I am currently working on tests that check FITRIM implementation (251, 260 and one new I'm writing now) and I want to use loopback device as fallback if $SCRATCH_DEV doesn't support discard. Has anybody been working on some xfstests' standard way of creating/destroying loop devices?
I could do with something as simple as this (in common.rc):
_create_loop_device()
{
size=${1}
dev=`losetup -f`
file="$TEST_DIR/$(basename $dev).fs"
truncate -s $size $file || _fail "Cannot create image file $file"
losetup $dev $file || _fail "Cannot associate $file with $dev"
echo $dev
}
_destroy_loop_device()
{
dev=${1}
umount $dev 2>&1
file=`losetup -a | grep $dev | sed -n "s/.*(\(.*\))$/\1/p"`
losetup -d $dev && rm -f $file || _fail "Cannot destroy loop device"
}
Do you think it's sufficient or do you have different opinion on handling this?
Thanks for comments!
Tomas
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next parent reply other threads:[~2012-08-09 8:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1664629800.716769.1344498186489.JavaMail.root@redhat.com>
2012-08-09 8:30 ` Tomas Racek [this message]
2012-08-09 22:31 ` xfstests: standard way of handling loop devices Dave Chinner
2012-08-13 10:43 ` Tomas Racek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1855221844.724464.1344501021962.JavaMail.root@redhat.com \
--to=tracek@redhat.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.