public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: Tom Yan <tom.ty89@gmail.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org, linux-ide@vger.kernel.org
Subject: Re: configurable discard parameters
Date: Tue, 23 Jun 2015 11:36:15 -0400	[thread overview]
Message-ID: <yq1bng65te8.fsf@sermon.lab.mkp.net> (raw)
In-Reply-To: <CAGnHSEn4EPC_RHTJXtvFC8dj8L+aDd_pRvSsDWNaqHz3Tdxj5w@mail.gmail.com> (Tom Yan's message of "Tue, 23 Jun 2015 22:16:22 +0800")

>>>>> "Tom" == Tom Yan <tom.ty89@gmail.com> writes:

Tom> I don't know whether the USB bridging or the way hdparm does TRIM
Tom> matters, but it seems that some devices can't really handle limit
Tom> like 0x3fffc0 blocks.

The 0x3fffc0 limit is for SATA devices connected through Linux' libata
SCSI ATA translation. This number corresponds to the biggest range we
can discard while maintaining a 1:1 mapping between the SCSI command and
the ATA ditto.

If you connect the SATA drive to a USB/UAS bridge you are entirely at
the bridge's whim when it comes to translation of WRITE SAME(10/16) w/
UNMAP or the UNMAP command to DSM TRIM. libata is not involved and
neither is the 0x3fffc0 limit (although chances are that the drive has
the same limit internally). Even when using hdparm the bridge device
still needs to correctly translate the ATA PASSTHROUGH commands.

Tom> So I still think that the kernel should allow users to configure
Tom> limits that can make libata send reliable ATA TRIM commands.

You haven't given us any reason to. We are not aware of any ATA drives
that put constraints on the range block count.

Again, if you want to help please focus on your bridge devices and what,
if anything, can be done to uniquely identify them and override any
incorrect values they might report to the SCSI stack. Up to and
including us disabling discard entirely on these devices if their
translation isn't verifiable and bullet proof.

-- 
Martin K. Petersen	Oracle Linux Engineering

  reply	other threads:[~2015-06-23 15:36 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-20 17:12 configurable discard parameters Tom Yan
2015-06-21  0:20 ` Martin K. Petersen
2015-06-21  7:03   ` Tom Yan
2015-06-21  8:05     ` Tom Yan
2015-06-21 12:36       ` Tom Yan
2015-06-21 20:30         ` Tom Yan
2015-06-22 20:57           ` Martin K. Petersen
2015-06-23 14:16             ` Tom Yan
2015-06-23 15:36               ` Martin K. Petersen [this message]
2015-06-23 16:41                 ` Tom Yan
2015-06-23 17:03                   ` Martin K. Petersen
2015-06-23 17:24                     ` Tom Yan
2015-06-23 18:26                       ` Martin K. Petersen
2015-06-23 21:25                         ` Tom Yan
2015-06-24  2:55                           ` Martin K. Petersen
2015-06-24 12:46                             ` Tom Yan
2015-06-25  1:15                               ` Martin K. Petersen
2015-06-26  7:05                                 ` Tom Yan

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=yq1bng65te8.fsf@sermon.lab.mkp.net \
    --to=martin.petersen@oracle.com \
    --cc=linux-ide@vger.kernel.org \
    --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