public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Ric Wheeler <ricwheeler@gmail.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
	Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org,
	Linux FS Devel <linux-fsdevel@vger.kernel.org>,
	lczerner@redhat.com
Subject: Re: Testing devices for discard support properly
Date: Thu, 9 May 2019 07:58:32 +1000	[thread overview]
Message-ID: <20190508215832.GR1454@dread.disaster.area> (raw)
In-Reply-To: <0a16285c-545a-e94a-c733-bcc3d4556557@gmail.com>

On Wed, May 08, 2019 at 01:09:03PM -0400, Ric Wheeler wrote:
> 
> On 5/8/19 1:03 PM, Martin K. Petersen wrote:
> > Ric,
> > 
> > > That all makes sense, but I think it is orthogonal in large part to
> > > the need to get a good way to measure performance.
> > There are two parts to the performance puzzle:
> > 
> >   1. How does mixing discards/zeroouts with regular reads and writes
> >      affect system performance?
> > 
> >   2. How does issuing discards affect the tail latency of the device for
> >      a given workload? Is it worth it?
> > 
> > Providing tooling for (1) is feasible whereas (2) is highly
> > workload-specific. So unless we can make the cost of (1) negligible,
> > we'll have to defer (2) to the user.
> 
> Agree, but I think that there is also a base level performance question -
> how does the discard/zero perform by itself.
> 
> Specifically, we have had to punt the discard of a whole block device before
> mkfs (back at RH) since it tripped up a significant number of devices.
> Similar pain for small discards (say one fs page) - is it too slow to do?

Small discards are already skipped is the device indicates it has
a minumum discard granularity. This is another reason why the "-o
discard" mount option isn't sufficient by itself and fstrim is still
required - filesystems often only free small isolated chunks of
space at a time and hence never may send discards to the device.

> > > For SCSI, I think the "WRITE_SAME" command *might* do discard
> > > internally or just might end up re-writing large regions of slow,
> > > spinning drives so I think it is less interesting.
> > WRITE SAME has an UNMAP flag that tells the device to deallocate, if
> > possible. The results are deterministic (unlike the UNMAP command).

That's kinda what I'm getting at here - we need to define the
behaviour the OS provides users, and then ensure that the behaviour
is standardised correctly so that devices behave correctly. i.e.  we
want devices to support WRITE_SAME w/ UNMAP flag well (because
that's an exact representation of FALLOC_FL_PUNCH_HOLE
requirements), and don't really care about the UNMAP command.

> > WRITE SAME also has an ANCHOR flag which provides a use case we
> > currently don't have fallocate plumbing for: Allocating blocks without
> > caring about their contents. I.e. the blocks described by the I/O are
> > locked down to prevent ENOSPC for future writes.

So WRITE_SAME (0) with an ANCHOR flag does not return zeroes on
subsequent reads? i.e. it is effectively
fallocate(FALLOC_FL_NO_HIDE_STALE) preallocation semantics?

For many use cases cases we actually want zeroed space to be
guaranteed so we don't expose stale data from previous device use
into the new user's visibility - can that be done with WRITE_SAME
and the ANCHOR flag?

Cheers,

Dave.

-- 
Dave Chinner
david@fromorbit.com

  parent reply	other threads:[~2019-05-08 21:58 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-06 20:56 Testing devices for discard support properly Ric Wheeler
2019-05-07  7:10 ` Lukas Czerner
2019-05-07  8:48   ` Jan Tulak
2019-05-07  9:40     ` Lukas Czerner
2019-05-07 12:57       ` Ric Wheeler
2019-05-07 15:35         ` Bryan Gurney
2019-05-07 15:44           ` Ric Wheeler
2019-05-07 20:09             ` Bryan Gurney
2019-05-07 21:24               ` Chris Mason
2019-06-03 20:01                 ` Ric Wheeler
2019-05-07  8:21 ` Nikolay Borisov
2019-05-07 22:04 ` Dave Chinner
2019-05-08  0:07   ` Ric Wheeler
2019-05-08  1:14     ` Dave Chinner
2019-05-08 15:05       ` Ric Wheeler
2019-05-08 17:03         ` Martin K. Petersen
2019-05-08 17:09           ` Ric Wheeler
2019-05-08 17:25             ` Martin K. Petersen
2019-05-08 18:12               ` Ric Wheeler
2019-05-09 16:02                 ` Bryan Gurney
2019-05-09 17:27                   ` Ric Wheeler
2019-05-09 20:35                     ` Bryan Gurney
2019-05-08 21:58             ` Dave Chinner [this message]
2019-05-09  2:29               ` Martin K. Petersen
2019-05-09  3:20                 ` Dave Chinner
2019-05-09  4:35                   ` Martin K. Petersen
2019-05-08 16:16   ` Martin K. Petersen
2019-05-08 22:31     ` Dave Chinner
2019-05-09  3:55       ` Martin K. Petersen
2019-05-09 13:40         ` Ric Wheeler

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=20190508215832.GR1454@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=axboe@kernel.dk \
    --cc=lczerner@redhat.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=ricwheeler@gmail.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