public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Chandan Rajendra <chandan@linux.vnet.ibm.com>
To: fstests@vger.kernel.org
Subject: [PATCH] generic/273: Remove hard coded block size
Date: Tue,  5 Apr 2016 11:23:29 +0530	[thread overview]
Message-ID: <1459835609-17892-1-git-send-email-chandan@linux.vnet.ibm.com> (raw)

The space occupied by files in the 'origin' directory is calculated with
the assumption that 4k is the block size of the underlying filesystem.
This causes the test to fail with ENOSPC errors when running on
filesystems with larger block sizes. To fix the issue, this commit makes
use of the the block size obtained from the mounted filesystem.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
---
 tests/generic/273 | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/generic/273 b/tests/generic/273
index 0a4a600..d90212e 100755
--- a/tests/generic/273
+++ b/tests/generic/273
@@ -57,6 +57,7 @@ _threads_set()
 
 _file_create()
 {
+	block_size=$1
 	_i=0
 
 	if ! mkdir $SCRATCH_MNT/origin
@@ -70,11 +71,11 @@ _file_create()
 
 	_disksize=`$DF_PROG -B 1 $SCRATCH_MNT | tail -1 | $AWK_PROG '{ print $5 }'`
 	_disksize=$(($_disksize / 3))
-	_num=$(($_disksize / $count / $threads / 4096))
+	_num=$(($_disksize / $count / $threads / $block_size))
 	_count=$count
 	while [ $_i -lt $_num ]
 	do
-		dd if=/dev/zero of=file_$_i bs=4096 count=$_count >/dev/null 2>&1
+		dd if=/dev/zero of=file_$_i bs=$block_size count=$_count >/dev/null 2>&1
 		_i=$(($_i + 1))
 	done
 
@@ -105,9 +106,10 @@ _do_workload()
 {
 	_pids=""
 	_pid=1
+	block_size=$(get_block_size $SCRATCH_MNT)
 	
 	_threads_set
-	_file_create
+	_file_create $block_size
 
 	_threads=$threads
 
-- 
2.1.0


                 reply	other threads:[~2016-04-05  5:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1459835609-17892-1-git-send-email-chandan@linux.vnet.ibm.com \
    --to=chandan@linux.vnet.ibm.com \
    --cc=fstests@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox