public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Boris Ranto <branto@redhat.com>
Cc: Eric Sandeen <esandeen@redhat.com>, xfs <xfs@oss.sgi.com>
Subject: Re: [PATCH] xfstests 016: Do not discard blocks at the mkfs time
Date: Thu, 27 Oct 2011 12:04:34 -0400	[thread overview]
Message-ID: <20111027160434.GA21551@infradead.org> (raw)
In-Reply-To: <1319625983.3074.28.camel@dhcp-26-208.brq.redhat.com>

On Wed, Oct 26, 2011 at 12:46:23PM +0200, Boris Ranto wrote:
> The test 016 fills scratch device with some data and then creates xfs fs
> on the scratch device. Later, the test assumes that the previously
> written data are still in there and checks for them at specific
> locations. On ssd drive this will lead to failure since the blocks are
> discarded by default when the mkfs command is run.
> This simple patch that adds -K to stop the discarding (if the mkfs
> command supports it) fixed the issue for me:
> 
> Signed-off-by: Boris Ranto <branto@redhat.com>
> 
> diff --git a/016 b/016
> index 9275ade..db76398 100755
> --- a/016
> +++ b/016
> @@ -65,6 +65,8 @@ _init()
>      $here/src/devzero -b 2048 -n 50 -v 198 $SCRATCH_DEV
>      echo "*** mkfs"
>      force_opts="-dsize=50m -lsize=$log_size"
> +    # Do not discard blocks, we need them for further reads
> +    _scratch_mkfs_xfs -N -K $force_opts >/dev/null 2>&1 &&
> force_opts="-K $force_opts"
>      echo mkfs_xfs $force_opts $SCRATCH_DEV >>$seq.full
>      _scratch_mkfs_xfs $force_opts >$tmp.mkfs0 2>&1

It took me very long understanding why you do mkfs.xfs calls here,
but I suspect now that it is to detect if -K is supported?

If so please document it in a comment, and maybe also write the
code a bit more verbose, e.g.

	#
	# Do not discard blocks as we check for patterns in freespace.
	#
	# Given that older xfsprogs versions do not have the -K option
	# make sure it works first.
	#
	if _scratch_mkfs_xfs -N -K $force_opts >/dev/null 2>&1; then
	    force_opts="-K $force_opts"
	fi

Otherwise the test looks good and will fix the 016 failure on TP / TRIM
capable devices that I've been seeing for a while.

Thanks a lot for doing this!

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2011-10-27 16:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-26 10:46 [PATCH] xfstests 016: Do not discard blocks at the mkfs time Boris Ranto
2011-10-27 16:04 ` Christoph Hellwig [this message]
2011-10-28  9:25   ` Boris Ranto
2011-10-28  9:38 ` [PATCH] xfstests 016: Do not discard blocks at the mkfs time, more verbose version Boris Ranto
2011-10-28  9:53   ` Christoph Hellwig
2012-05-29 16:54     ` Eric Sandeen
2012-05-30  7:42       ` Christoph Hellwig

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=20111027160434.GA21551@infradead.org \
    --to=hch@infradead.org \
    --cc=branto@redhat.com \
    --cc=esandeen@redhat.com \
    --cc=xfs@oss.sgi.com \
    /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