From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: Dave Chinner <david@fromorbit.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
Ric Wheeler <ricwheeler@gmail.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, 09 May 2019 00:35:07 -0400 [thread overview]
Message-ID: <yq1d0ksi6tg.fsf@oracle.com> (raw)
In-Reply-To: <20190509032044.GW1454@dread.disaster.area> (Dave Chinner's message of "Thu, 9 May 2019 13:20:44 +1000")
Dave,
>> The answer is that it depends. It can return zeroes or a
>> device-specific initialization pattern (oh joy).
>
> So they ignore the "write zeroes" part of the command?
I'd have to look to see how ANCHOR and NDOB interact on a WRITE
SAME. That's the closest thing SCSI has to WRITE ZEROES.
You can check whether a device has a non-standard initialization
pattern. It's a bit convoluted given that devices can autonomously
transition blocks between different states based on the initialization
pattern. But again, I don't think anybody has actually implemented this
part of the spec.
>> We have:
>>
>> Allocate and zero: FALLOC_FL_ZERO_RANGE
>> Deallocate and zero: FALLOC_FL_PUNCH_HOLE
>> Deallocate: FALLOC_FL_PUNCH_HOLE | FALLOC_FL_NO_HIDE_STALE
>> but are missing:
>>
>> Allocate: FALLOC_FL_ZERO_RANGE | FALLOC_FL_NO_HIDE_STALE
Copy and paste error. "Allocate:" would be FALLOC_FL_NO_HIDE_STALE in
the ANCHOR case. It's really just a preallocation but the blocks could
contain something other than zeroes depending on the device.
> So we've defined the fallocate flags to have /completely/ different
> behaviour on block devices to filesystems.
Are you referring to the "Allocate" case or something else? From
fallocate(2):
"Specifying the FALLOC_FL_ZERO_RANGE flag [...] zeroes space [...].
Within the specified range, blocks are preallocated for the regions that
span the holes in the file. After a successful call, subsequent reads
from this range will return zeroes."
"Specifying the FALLOC_FL_PUNCH_HOLE flag [...] deallocates space [...].
Within the specified range, partial filesystem blocks are zeroed, and
whole filesystem blocks are removed from the file. After a successful
call, subsequent reads from this range will return zeroes."
That matches the block device behavior as far as I'm concerned.
--
Martin K. Petersen Oracle Linux Engineering
next prev parent reply other threads:[~2019-05-09 4:35 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
2019-05-09 2:29 ` Martin K. Petersen
2019-05-09 3:20 ` Dave Chinner
2019-05-09 4:35 ` Martin K. Petersen [this message]
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=yq1d0ksi6tg.fsf@oracle.com \
--to=martin.petersen@oracle.com \
--cc=axboe@kernel.dk \
--cc=david@fromorbit.com \
--cc=lczerner@redhat.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.