From: Alex Elder Date: Tue, 21 May 2013 15:05:03 +0000 (-0500) Subject: rbd image_read.sh: allocate local file at create time X-Git-Tag: v0.64~82 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a6b4847ef27a3e956074fa7be6ed13de9bc4009b;p=ceph.git 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 --- diff --git a/qa/workunits/rbd/image_read.sh b/qa/workunits/rbd/image_read.sh index 9e2228a0e118..6fbe0c92bae5 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() {