From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: Tom Yan <tom.ty89@gmail.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH 1/1] sd: fix lbprz discard granularity as expected
Date: Thu, 10 Mar 2016 21:16:20 -0500 [thread overview]
Message-ID: <yq11t7hn4i3.fsf@sermon.lab.mkp.net> (raw)
In-Reply-To: <CAGnHSEkGybgU0KXGYg_RLvgbnKvAth4dyHuxMPsKzF7cQs7qgQ@mail.gmail.com> (Tom Yan's message of "Thu, 10 Mar 2016 17:15:12 +0800")
>>>>> "Tom" == Tom Yan <tom.ty89@gmail.com> writes:
Tom> Nevertheless, I don't really quite get the sense of the original
Tom> commit anyway. Isn't discard granularity the minimum size we can
Tom> discard? In that case why would it have anything to do with "read
Tom> zeroes"?
On devices that guarantee returning zeroes after discard we use the
feature to clear block ranges (for filesystem metadata, etc.).
A filesystem that clears a block range obviously needs every logical
block to be properly zeroed. And not just the portion that are a certain
size and aligned to a certain boundary.
Tom> Suppose we are handling a device reports a discard granularity of
Tom> 4096 bytes, while logical block size and physical block size are
Tom> both 512 bytes. For such a device, a single 512-byte discard
Tom> request should simply be rejected because it's not allowed by the
Tom> device.
Discard is advisory, the command will not get rejected.
Tom> When it's rejected, it doesn't mean that "the 512-byte block does
Tom> not read zeroes after being discarded"; instead, it's just "we did
Tom> not discard the 512-byte block as per requested because it's not
Tom> allowed".
We only honor discard_zeroes_data for devices that support WRITE SAME w/
UNMAP. And WRITE SAME will manually write any block that it can not
deprovision so you are guaranteed reliable results.
--
Martin K. Petersen Oracle Linux Engineering
next prev parent reply other threads:[~2016-03-11 2:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-10 8:16 [PATCH 1/1] sd: fix lbprz discard granularity as expected tom.ty89
2016-03-10 9:15 ` Tom Yan
2016-03-11 2:16 ` Martin K. Petersen [this message]
2016-03-11 3:53 ` Tom Yan
2016-03-11 12:37 ` Martin K. Petersen
2016-03-11 14:55 ` Tom Yan
2016-03-11 21:41 ` Martin K. Petersen
2016-03-12 5:37 ` Tom Yan
2016-03-12 5:43 ` Tom Yan
2016-03-14 20:07 ` Martin K. Petersen
2016-03-11 2:08 ` Martin K. Petersen
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=yq11t7hn4i3.fsf@sermon.lab.mkp.net \
--to=martin.petersen@oracle.com \
--cc=linux-scsi@vger.kernel.org \
--cc=tom.ty89@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