public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: Lukas Czerner <lczerner@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	linux-fsdevel@vger.kernel.org, axboe@kernel.dk
Subject: Re: [PATCH] block: reintroduce discard_zeroes_data sysfs file and BLKDISCARDZEROES
Date: Thu, 17 Aug 2017 13:47:13 -0400	[thread overview]
Message-ID: <yq1fucqkrxa.fsf@oracle.com> (raw)
In-Reply-To: <20170817133557.dm2mybjrxpbzagyg@rh_laptop> (Lukas Czerner's message of "Thu, 17 Aug 2017 15:35:57 +0200")


Lukas,

> Do we also know that the blocks were discarded as we do with
> BLKDISCARD ?

There never was a way to know for sure.

ATA DSM TRIM and SCSI UNMAP are hints by definition. We attempted to
bend their semantics towards getting predictable behavior but ultimately
failed. Too many corner cases.

> As I mentioned before. We relied on discard_zeroes_data in mkfs.ext4
> to make sure that inode tables are zeroed after discard.

The point is that you shouldn't have an if (discard_zeroes_data)
conditional in the first place.

 - If you need to dellocate a block range and you don't care about its
   contents in the future, use BLKDISCARD / FL_PUNCH_HOLE.

 - If you need to zero a block range, use BLKZEROOUT / FL_ZERO_RANGE.

So the mkfs usage model should essentially be:

 - DISCARD the entire partition/device block range

 - ZEROOUT the inode tables and other areas where you need zeroes on
   future reads

And that should be the approach regardless of whether your device is a
disk drive, an SSD, an NVMe device a SCSI array or whatever. DISCARD old
contents, ZEROOUT the pieces you care about. No conditionals or trying
to do things differently based on device capabilities.

-- 
Martin K. Petersen	Oracle Linux Engineering

  reply	other threads:[~2017-08-17 17:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-16 13:19 [PATCH] block: reintroduce discard_zeroes_data sysfs file and BLKDISCARDZEROES Lukas Czerner
2017-08-16 15:18 ` Christoph Hellwig
2017-08-16 15:48   ` Lukas Czerner
2017-08-17  1:49     ` Martin K. Petersen
2017-08-17  7:47       ` Lukas Czerner
2017-08-17  8:17         ` Christoph Hellwig
2017-08-17  8:41           ` Lukas Czerner
2017-08-17  9:52             ` Christoph Hellwig
2017-08-17 13:35               ` Lukas Czerner
2017-08-17 17:47                 ` Martin K. Petersen [this message]
2017-08-17 19:35                   ` Lukas Czerner
2017-08-17 20:39                   ` Theodore Ts'o

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=yq1fucqkrxa.fsf@oracle.com \
    --to=martin.petersen@oracle.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=lczerner@redhat.com \
    --cc=linux-fsdevel@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