Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Randomized mmap direct i/o writes.

  • Loading branch information...
commit bf27f2a9585414385a25d0357f85a873ef1db323 1 parent 7efb09f
@adityadani authored
Showing with 18 additions and 33 deletions.
  1. +4 −20 256.out
  2. +14 −13 common.snapshot
View
24 256.out
@@ -6,11 +6,9 @@ Running snapshot test 1:
Appending 1M zeros to 1M.1 oflag=direct
1+0 records in
1+0 records out
-Writing 1M random data to 1 files
-1+0 records in
-1+0 records out
1+0 records in
1+0 records out
+Writing 1M random data to 0 files
Files in file system
A/a.txt:aligator
B/b.txt:bison
@@ -42,11 +40,9 @@ Running snapshot test 2:
Appending 1M zeros to 1M.1 oflag=direct
1+0 records in
1+0 records out
-Writing 1M random data to 2 files
-1+0 records in
-1+0 records out
1+0 records in
1+0 records out
+Writing 1M random data to 1 files
1+0 records in
1+0 records out
1+0 records in
@@ -90,19 +86,9 @@ Running snapshot test 3:
Appending 1M zeros to 1M.1 oflag=direct
1+0 records in
1+0 records out
-Writing 1M random data to 3 files
-1+0 records in
-1+0 records out
-1+0 records in
-1+0 records out
-1+0 records in
-1+0 records out
-1+0 records in
-1+0 records out
-1+0 records in
-1+0 records out
1+0 records in
1+0 records out
+Writing 1M random data to 2 files
Files in file system
A/a.txt:aligator
B/b.txt:bison
@@ -146,11 +132,9 @@ Running snapshot test 4:
Appending 1M zeros to 1M.1 oflag=direct
1+0 records in
1+0 records out
-Writing 1M random data to 4 files
-1+0 records in
-1+0 records out
1+0 records in
1+0 records out
+Writing 1M random data to 3 files
1+0 records in
1+0 records out
1+0 records in
View
27 common.snapshot
@@ -138,21 +138,22 @@ _snapshot_test()
TRUNCSIZE=4
echo Appending $F zeros to $F.1 $DIRECT
dd if=/dev/zero bs=1M count=$M of=$F.1 $NOTRUNC oflag=append $DIRECT status=noxfer || exit 1
- echo Writing $F random data to $n files
- for i in $( seq 1 $n ) ; do
- if [ $(($n % 2)) -eq 0 ] ; then
- # memmory mapped i/o
- # 1st rewrite moves existing blocks to snapshot and allocates new blocks
- dd if=/dev/zero bs=1M count=$M of=$F.$i $INPLACE status=noxfer || exit 1
+ # create a new file ad write 1M data on it
+ dd if=/dev/urandom bs=1M count=$M of=$F.$n status=noxfer || exit 1
+ echo Writing $F random data to $[ $n - 1 ] files
+ for i in $( seq 1 $[ $n - 1 ] ) ; do
+ # 1st rewrite moves existing blocks to snapshot and allocates new blocks
+ if [ $(($n % 2)) -eq 0 ] ; then
+ dd if=/dev/urandom bs=1M count=$M of=$F.$i $INPLACE $DIRECT status=noxfer || exit 1
+ else
$XFS_IO_PROG -f -F -c "mmap 0 $F" -c "mwrite 0 $F" $F.$i
- # subsequent rewrites doesn't move blocks to snapshot
- dd if=/dev/zero bs=1M count=$M of=$F.$i $INPLACE status=noxfer || exit 1
- $XFS_IO_PROG -f -F -c "mmap 0 $F" -c "mwrite 0 $F" $F.1
+ fi
+ # subsequent rewrites doesn't move blocks to snapshot
+ if [ $(($n % 2)) -eq 0 ] ; then
+ # subsequent rewrites doesn't move blocks to snapshot
+ dd if=/dev/urandom bs=1M count=$M of=$F.1 $INPLACE $DIRECT status=noxfer || exit 1
else
- # 1st rewrite moves existing blocks to snapshot and allocates new blocks
- dd if=/dev/urandom bs=1M count=$M of=$F.$i $INPLACE status=noxfer || exit 1
- # subsequent rewrites doesn't move blocks to snapshot
- dd if=/dev/urandom bs=1M count=$M of=$F.1 $INPLACE $DIRECT status=noxfer || exit 1
+ $XFS_IO_PROG -f -F -c "mmap 0 $F" -c "mwrite 0 $F" $F.1
fi
done
for i in $( seq 1 $n ) ; do
Please sign in to comment.
Something went wrong with that request. Please try again.