summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2013-05-21 10:05:03 -0500
committerAlex Elder <elder@inktank.com>2013-05-21 14:44:35 -0500
commita6b4847ef27a3e956074fa7be6ed13de9bc4009b (patch)
tree07a74d60d7a0383ca16d518edfd122f28a1d24ca /qa
parent512e907726c3162df088b67fc2609208b06a4f17 (diff)
downloadceph-a6b4847ef27a3e956074fa7be6ed13de9bc4009b.tar.gz
rbd image_read.sh: allocate local file at create time
Move the dd command that touches the last byte in a local file into create_image() where it belongs (out of fill_original()). Signed-off-by: Alex Elder <elder@inktank.com>
Diffstat (limited to 'qa')
-rwxr-xr-xqa/workunits/rbd/image_read.sh11
1 files changed, 4 insertions, 7 deletions
diff --git a/qa/workunits/rbd/image_read.sh b/qa/workunits/rbd/image_read.sh
index 9e2228a0e11..6fbe0c92bae 100755
--- a/qa/workunits/rbd/image_read.sh
+++ b/qa/workunits/rbd/image_read.sh
@@ -245,11 +245,14 @@ function create_image() {
[ $# -eq 1 ] || exit 99
local image_name="$1"
local image_path
+ local bytes
verbose "creating image \"${image_name}\""
if [ "${LOCAL_FILES}" = true ]; then
image_path=$(image_dev_path "${image_name}")
- touch "${image_path}"
+ bytes=$(echo "${IMAGE_SIZE} * 1024 * 1024 - 1" | bc)
+ quiet dd if=/dev/zero bs=1 count=1 seek="${bytes}" \
+ of="${image_path}"
return
fi
@@ -425,18 +428,12 @@ function source_data() {
function fill_original() {
local image_path=$(image_dev_path "${ORIGINAL}")
- local bytes=$(echo "${IMAGE_SIZE} * 1024 * 1024 - 1" | bc)
verbose "filling original image"
# Fill 16 objects worth of "random" data
source_data |
quiet dd bs="${PAGE_SIZE}" count=$((16 * OBJECT_PAGES)) \
of="${image_path}"
- if [ "${LOCAL_FILES}" = true ]; then
- # Extend it another 16 objects, as a hole in the image
- quiet dd if=/dev/zero bs=1 count=1 seek=${bytes} \
- of="${image_path}"
- fi
}
function do_read() {