Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp9026216ybi; Fri, 7 Jun 2019 02:14:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqwW4ohWS4ueX1WrY0e/J8KjHM9z9Go95bsMkybgvYfOxfW4pfnz8Voj+eYuJhj13a+iivlm X-Received: by 2002:a17:90a:1b4a:: with SMTP id q68mr4344239pjq.61.1559898841487; Fri, 07 Jun 2019 02:14:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559898841; cv=none; d=google.com; s=arc-20160816; b=LCynh+XuYFFrkvtOryOmT5zi0LziO5a25UeqyA0mhSN3N3PhRKHXuvCUL2zlQRrQX0 v8WgCO/IwLeKKgj1r9Y7D4Vs4AAKbWT6xbCNXJkM9wTLIYLsbFA+a3xt94fssMygRulX gSx4OSvkYlVw4sW/SNhSWCWa+TOPNZwLOO04vjVokaSOozyzNlBI1gPDnLLFm433F7MT ZgcsTfy9o3uhVdElbKnPeuFcEeu1zPIpmvX5PTHWPgYRESjOYLPI4hNERdyls32YsQEm 016c4SCqC8/NRU6nuBfHL1XGrFGOzTs8wdhMFLoovJd0H9tzPRqyT7kFLuKVXdcuUc6z zXuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:message-id:date:cc:to:from:subject:dkim-signature; bh=5kesgdWUa0hLxgoOBvcgPl+MIKlLt888PUPzHfbM6p8=; b=C6Gu4Zh12Ai0UvqxH5GyvlVZQRwrfD5kjblRj5kRxKvgcZk2ZkuNXHRiLM0uw4+9mp TQsOLF/ucqoyHcSC/y8HTby7/wViFd6TOZ2GgNIDDz0TxBgoagYfDIwuSSlTkDj3Bkik aEkCN7u0ArqNR6WUPBbiI7JiiTUsUHOT6u5swJ4zNHuryWKe13gX3Kf6ez3KYysgbGf5 Wnqc+DdNc7yJfgphtn6oQcFPCX/Mt0qmYAYdmiqLMkJjLt6NhD794ItT+uGd3+QnvPDz 4mzmmhT87ldt+x0u//CE9vqkUBzznf4CR1mOTh9nOyPYum6LDAQvD0LclW+mbjwH+a33 d2dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yandex-team.ru header.s=default header.b=Lzpi5dzs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex-team.ru Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u7si1310575pfb.223.2019.06.07.02.13.41; Fri, 07 Jun 2019 02:14:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@yandex-team.ru header.s=default header.b=Lzpi5dzs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex-team.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727602AbfFGHen (ORCPT + 99 others); Fri, 7 Jun 2019 03:34:43 -0400 Received: from forwardcorp1j.mail.yandex.net ([5.45.199.163]:46676 "EHLO forwardcorp1j.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726857AbfFGHen (ORCPT ); Fri, 7 Jun 2019 03:34:43 -0400 Received: from mxbackcorp1g.mail.yandex.net (mxbackcorp1g.mail.yandex.net [IPv6:2a02:6b8:0:1402::301]) by forwardcorp1j.mail.yandex.net (Yandex) with ESMTP id E63BA2E0956; Fri, 7 Jun 2019 10:34:39 +0300 (MSK) Received: from smtpcorp1o.mail.yandex.net (smtpcorp1o.mail.yandex.net [2a02:6b8:0:1a2d::30]) by mxbackcorp1g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 8jMNhgmr0x-YdlWYwfU; Fri, 07 Jun 2019 10:34:39 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1559892879; bh=5kesgdWUa0hLxgoOBvcgPl+MIKlLt888PUPzHfbM6p8=; h=Message-ID:Date:To:From:Subject:Cc; b=Lzpi5dzsewQhOK0gOHC1Gx8dArYgcfGZKxruSqTxxzdygp2KFIeos70tGQSvLhfGd 15yVAAb/7Htn87viV6HKctJHuLAgncvqQLhSqoUUw2Nsa1FEMXwGnbQaHx8sMYsBep W7Yd9b23ZK8Vqi3ft9zN7E9U2d79mkFRl36Ywd+0= Authentication-Results: mxbackcorp1g.mail.yandex.net; dkim=pass header.i=@yandex-team.ru Received: from dynamic-red.dhcp.yndx.net (dynamic-red.dhcp.yndx.net [2a02:6b8:0:40c:b19a:10ab:8629:85d9]) by smtpcorp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id C8fJwnqGf6-YdYqLFJv; Fri, 07 Jun 2019 10:34:39 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) Subject: [PATCH] drivers/ata: print trim features at device initialization From: Konstantin Khlebnikov To: Jens Axboe , linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Dmitry Monakhov Date: Fri, 07 Jun 2019 10:34:39 +0300 Message-ID: <155989287898.1506.14253954112551051148.stgit@buzz> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Print trim status once at ata device initialization in form: ataX.YZ: trim: , queued: , zero_after_trim: Full example: ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300) ata1.00: NCQ Send/Recv Log not supported ata1.00: ATA-9: SAMSUNG MZ7GE900HMHP-000DX, EXT03Y3Q, max UDMA/133 ata1.00: 1758174768 sectors, multi 16: LBA48 NCQ (depth 32), AA ata1.00: trim: supported, queued: no, zero_after_trim: maybe ata1.00: NCQ Send/Recv Log not supported ata1.00: configured for UDMA/133 scsi 0:0:0:0: Direct-Access ATA SAMSUNG MZ7GE900 3Y3Q PQ: 0 ANSI: 5 sd 0:0:0:0: [sda] 1758174768 512-byte logical blocks: (900 GB/838 GiB) sd 0:0:0:0: Attached scsi generic sg0 type 0 sd 0:0:0:0: [sda] Write Protect is off sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00 sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA sda: sda1 sda2 sd 0:0:0:0: [sda] Attached SCSI disk Signed-off-by: Konstantin Khlebnikov --- drivers/ata/libata-core.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index aaa57e0c809d..6ff33e79cfc2 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -2617,6 +2617,34 @@ int ata_dev_configure(struct ata_device *dev) } } + if (print_info && ata_id_has_trim(id)) { + const char *trim_status; + const char *trim_queued; + const char *trim_zero; + + if (dev->horkage & ATA_HORKAGE_NOTRIM) + trim_status = "backlisted"; + else + trim_status = "supported"; + + if (!ata_fpdma_dsm_supported(dev)) + trim_queued = "no"; + else if (dev->horkage & ATA_HORKAGE_NO_NCQ_TRIM) + trim_queued = "backlisted"; + else + trim_queued = "yes"; + + if (!ata_id_has_zero_after_trim(id)) + trim_zero = "no"; + else if (dev->horkage & ATA_HORKAGE_ZERO_AFTER_TRIM) + trim_zero = "yes"; + else + trim_zero = "maybe"; + + ata_dev_info(dev, "trim: %s, queued: %s, zero_after_trim: %s\n", + trim_status, trim_queued, trim_zero); + } + /* Check and mark DevSlp capability. Get DevSlp timing variables * from SATA Settings page of Identify Device Data Log. */