All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: "Martin K. Petersen" <martin.petersen@oracle.com>, tj@kernel.org
Cc: linux-ide@vger.kernel.org
Subject: Re: [PATCH 2/4] libata: Expose TRIM capability in sysfs
Date: Tue, 05 May 2015 07:54:03 +0200	[thread overview]
Message-ID: <55485AFB.6050302@suse.de> (raw)
In-Reply-To: <1430790861-30066-2-git-send-email-martin.petersen@oracle.com>

On 05/05/2015 03:54 AM, Martin K. Petersen wrote:
> Create a sysfs "trim" attribute for each ata_device that displays
> whether DSM TRIM is "unsupported", "unqueued", "forced_unqueued"
> (blacklisted) or "queued".
> 
> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
> ---
>  Documentation/ABI/testing/sysfs-ata | 11 +++++++++++
>  drivers/ata/libata-transport.c      | 22 ++++++++++++++++++++++
>  2 files changed, 33 insertions(+)
> 
> diff --git a/Documentation/ABI/testing/sysfs-ata b/Documentation/ABI/testing/sysfs-ata
> index 0a932155cbba..9231daef3813 100644
> --- a/Documentation/ABI/testing/sysfs-ata
> +++ b/Documentation/ABI/testing/sysfs-ata
> @@ -90,6 +90,17 @@ gscr
>  	130:	SATA_PMP_GSCR_SII_GPIO
>  	Only valid if the device is a PM.
>  
> +trim
> +
> +	Shows the DSM TRIM mode currently used by the device. Valid
> +	values are:
> +	unsupported:		Drive does not support DSM TRIM
> +	unqueued:		Drive supports unqueued DSM TRIM only
> +	queued:			Drive supports queued DSM TRIM
> +	forced_unqueued:	Drive's unqueued DSM support is known to be
> +				buggy and only unqueued TRIM commands
> +				are sent
> +
>  spdn_cnt
>  
>  	Number of time libata decided to lower the speed of link due to errors.
> diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c
> index 3227b7c8a05f..d6c37bcd416d 100644
> --- a/drivers/ata/libata-transport.c
> +++ b/drivers/ata/libata-transport.c
> @@ -560,6 +560,27 @@ show_ata_dev_gscr(struct device *dev,
>  
>  static DEVICE_ATTR(gscr, S_IRUGO, show_ata_dev_gscr, NULL);
>  
> +static ssize_t
> +show_ata_dev_trim(struct device *dev,
> +		  struct device_attribute *attr, char *buf)
> +{
> +	struct ata_device *ata_dev = transport_class_to_dev(dev);
> +	unsigned char *mode;
> +
> +	if (!ata_id_has_trim(ata_dev->id))
> +		mode = "unsupported";
> +	else if (ata_dev->horkage & ATA_HORKAGE_NO_NCQ_TRIM)
> +			mode = "forced_unqueued";
> +	else if (ata_fpdma_dsm_supported(ata_dev))
> +		mode = "queued";
> +	else
> +		mode = "unqueued";
> +
> +	return snprintf(buf, 20, "%s\n", mode);
> +}
> +
> +static DEVICE_ATTR(trim, S_IRUGO, show_ata_dev_trim, NULL);
> +
>  static DECLARE_TRANSPORT_CLASS(ata_dev_class,
>  			       "ata_device", NULL, NULL, NULL);
>  
> @@ -733,6 +754,7 @@ struct scsi_transport_template *ata_attach_transport(void)
>  	SETUP_DEV_ATTRIBUTE(ering);
>  	SETUP_DEV_ATTRIBUTE(id);
>  	SETUP_DEV_ATTRIBUTE(gscr);
> +	SETUP_DEV_ATTRIBUTE(trim);
>  	BUG_ON(count > ATA_DEV_ATTRS);
>  	i->dev_attrs[count] = NULL;
>  
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		               zSeries & Storage
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

  reply	other threads:[~2015-05-05  5:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-05  1:54 [PATCH 1/4] libata: Allow NCQ TRIM to be enabled or disabled with a module parameter Martin K. Petersen
2015-05-05  1:54 ` [PATCH 2/4] libata: Expose TRIM capability in sysfs Martin K. Petersen
2015-05-05  5:54   ` Hannes Reinecke [this message]
2015-05-05 17:50   ` Christoph Hellwig
2015-05-05 21:54     ` Martin K. Petersen
2015-05-05  1:54 ` [PATCH 3/4] libata: READ LOG DMA EXT support can be in either page 119 or 120 Martin K. Petersen
2015-05-05  6:00   ` Hannes Reinecke
2015-05-05  1:54 ` [PATCH 4/4] libata: Fall back to unqueued READ LOG EXT if the DMA variant fails Martin K. Petersen
2015-05-05  6:00   ` Hannes Reinecke
2015-06-12 19:58   ` David Milburn
2015-06-14 23:45     ` Martin K. Petersen
2015-06-15 15:24       ` David Milburn
2015-06-16 16:43         ` Martin K. Petersen
2015-05-05  5:51 ` [PATCH 1/4] libata: Allow NCQ TRIM to be enabled or disabled with a module parameter Hannes Reinecke
2015-05-05 13:31 ` Tejun Heo
2015-05-05 14:07   ` Hannes Reinecke
2015-05-05 21:57     ` 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=55485AFB.6050302@suse.de \
    --to=hare@suse.de \
    --cc=linux-ide@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=tj@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 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.