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
Cc: Chandan Rajendra <chandan@linux.vnet.ibm.com>,
	linux-btrfs@vger.kernel.org, fdmanana@gmail.com,
	chandan@mykolab.com
Subject: [PATCH 01/12] Filter xfs_io and od's output in units of FS block size and the CPU's page size
Date: Wed, 25 Nov 2015 16:32:55 +0530	[thread overview]
Message-ID: <1448449386-4186-2-git-send-email-chandan@linux.vnet.ibm.com> (raw)
In-Reply-To: <1448449386-4186-1-git-send-email-chandan@linux.vnet.ibm.com>

The helpers will be used to make btrfs tests that assume 4k as the block size
to work on non-4k blocksized filesystem instances as well.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
---
 common/filter | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 common/rc     |  5 +++++
 2 files changed, 57 insertions(+)

diff --git a/common/filter b/common/filter
index af456c9..faa6f82 100644
--- a/common/filter
+++ b/common/filter
@@ -229,6 +229,45 @@ _filter_xfs_io_unique()
     common_line_filter | _filter_xfs_io
 }
 
+_filter_xfs_io_units_modified()
+{
+	UNIT=$1
+	UNIT_SIZE=$2
+
+	$AWK_PROG -v unit="$UNIT" -v unit_size=$UNIT_SIZE '
+		/wrote/ {
+			split($2, bytes, "/")
+
+			bytes_written = strtonum(bytes[1])
+
+			offset = strtonum($NF)
+
+			unit_start = offset / unit_size
+			unit_start = int(unit_start)
+			unit_end = (offset + bytes_written - 1) / unit_size
+			unit_end = int(unit_end)
+
+			printf("%ss modified: [%d - %d]\n", unit, unit_start, unit_end)
+
+			next
+		}
+	'
+}
+
+_filter_xfs_io_blocks_modified()
+{
+	BLOCK_SIZE=$(get_block_size $SCRATCH_MNT)
+
+	_filter_xfs_io_units_modified "Block" $BLOCK_SIZE
+}
+
+_filter_xfs_io_pages_modified()
+{
+	PAGE_SIZE=$(get_page_size)
+
+	_filter_xfs_io_units_modified "Page" $PAGE_SIZE
+}
+
 _filter_test_dir()
 {
 	sed -e "s,$TEST_DEV,TEST_DEV,g" -e "s,$TEST_DIR,TEST_DIR,g"
@@ -323,5 +362,18 @@ _filter_ro_mount() {
 	    -e "s/mount: cannot mount block device/mount: cannot mount/g"
 }
 
+_filter_od()
+{
+	BLOCK_SIZE=$(get_block_size $SCRATCH_MNT)
+	$AWK_PROG -v block_size=$BLOCK_SIZE '
+		/^[0-9]+/ {
+			offset = strtonum("0"$1);
+			$1 = sprintf("%o", offset / block_size);
+			print $0;
+		}
+		/\*/
+	'
+}
+
 # make sure this script returns success
 /bin/true
diff --git a/common/rc b/common/rc
index 4c2f42c..acda6cb 100644
--- a/common/rc
+++ b/common/rc
@@ -3151,6 +3151,11 @@ get_block_size()
 	echo `stat -f -c %S $1`
 }
 
+get_page_size()
+{
+	echo $(getconf PAGE_SIZE)
+}
+
 init_rc
 
 ################################################################################
-- 
2.1.0


  reply	other threads:[~2015-11-25 11:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-25 11:02 [PATCH 00/12] Fix Btrfs tests to work on non-4k block sized fs instances Chandan Rajendra
2015-11-25 11:02 ` Chandan Rajendra [this message]
2015-11-25 11:02 ` [PATCH 02/12] Fix btrfs/017 to work on non-4k block sized filesystems Chandan Rajendra
2015-11-25 11:02 ` [PATCH 03/12] Fix btrfs/052 " Chandan Rajendra
2015-11-25 11:02 ` [PATCH 04/12] Fix btrfs/055 " Chandan Rajendra
2015-11-25 11:02 ` [PATCH 05/12] Fix btrfs/056 " Chandan Rajendra
2015-11-25 11:03 ` [PATCH 06/12] Fix btrfs/094 " Chandan Rajendra
2015-11-25 11:11   ` Filipe Manana
2015-11-25 11:47     ` Chandan Rajendra
2015-11-25 11:51       ` Filipe Manana
2015-11-25 12:03         ` Chandan Rajendra
2015-11-25 11:03 ` [PATCH 07/12] Fix btrfs/095 " Chandan Rajendra
2015-11-25 11:03 ` [PATCH 08/12] Fix btrfs/096 " Chandan Rajendra
2015-11-25 11:03 ` [PATCH 09/12] Fix btrfs/097 " Chandan Rajendra
2015-11-25 11:03 ` [PATCH 10/12] Fix btrfs/098 " Chandan Rajendra
2015-11-25 11:03 ` [PATCH 11/12] Fix btrfs/103 " Chandan Rajendra
2015-11-25 11:03 ` [PATCH 12/12] Fix btrfs/106 " Chandan Rajendra

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=1448449386-4186-2-git-send-email-chandan@linux.vnet.ibm.com \
    --to=chandan@linux.vnet.ibm.com \
    --cc=chandan@mykolab.com \
    --cc=fdmanana@gmail.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-btrfs@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