mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Haoqian He <haoqian.he@smartx.com>,
	Christoph Hellwig <hch@infradead.org>,
	"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
	open list <linux-kernel@vger.kernel.org>,
	"open list:SCSI SUBSYSTEM" <linux-scsi@vger.kernel.org>,
	"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: fengli@smartx.com
Subject: Re: [PATCH 2/3] scsi: sd: remove scsi_disk field lbpvpd
Date: Tue, 2 Jul 2024 12:30:58 +0900	[thread overview]
Message-ID: <469c4c38-ee78-4782-a58c-0e6f6c1faedc@kernel.org> (raw)
In-Reply-To: <20240702030118.2198570-3-haoqian.he@smartx.com>

On 7/2/24 12:01, Haoqian He wrote:
> The lbpme bit in scsi_disk can be used directly to indicate
> if the logical unit supports logical block provisioning
> management. The lbpvpd bit is no longer needed, so remove
> this field from scsi_disk.
> 
> Signed-off-by: Haoqian He <haoqian.he@smartx.com>
> Signed-off-by: Li Feng <fengli@smartx.com>
> ---
>  drivers/scsi/sd.c | 8 ++++----
>  drivers/scsi/sd.h | 1 -
>  2 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index 44a19945b5b6..b49bab1d8610 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -3306,8 +3306,10 @@ static void sd_read_app_tag_own(struct scsi_disk *sdkp, unsigned char *buffer)
>  
>  static unsigned int sd_discard_mode(struct scsi_disk *sdkp)
>  {
> -	if (!sdkp->lbpvpd)
> -		/* Disable discard if LBP VPD page not provided */
> +	if (!sdkp->lbpme)
> +		/* LBPME was not set means the logical unit
> +		 * is fully provisioned, so disable discard.
> +		 */

Incorrect multi-line comment format. Please start the comment with a "/*" line
and no text. It may also be a good idea to add curly brackets for this if as it
is multi line (but single statement). Or move the comment before the if.

>  		return SD_LBP_DISABLE;
>  
>  	/* LBP VPD page tells us what to use */
> @@ -3430,7 +3432,6 @@ static void sd_read_block_provisioning(struct scsi_disk *sdkp)
>  	struct scsi_vpd *vpd;
>  
>  	if (!sdkp->lbpme) {
> -		sdkp->lbpvpd    = 0;
>  		sdkp->lbpu      = 0;
>  		sdkp->lbpws     = 0;
>  		sdkp->lbpws10   = 0;
> @@ -3445,7 +3446,6 @@ static void sd_read_block_provisioning(struct scsi_disk *sdkp)
>  		return;
>  	}
>  
> -	sdkp->lbpvpd	= 1;
>  	sdkp->lbpu	= (vpd->data[5] >> 7) & 1; /* UNMAP */
>  	sdkp->lbpws	= (vpd->data[5] >> 6) & 1; /* WRITE SAME(16) w/ UNMAP */
>  	sdkp->lbpws10	= (vpd->data[5] >> 5) & 1; /* WRITE SAME(10) w/ UNMAP */
> diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h
> index 36382eca941c..ff9ff2655c25 100644
> --- a/drivers/scsi/sd.h
> +++ b/drivers/scsi/sd.h
> @@ -146,7 +146,6 @@ struct scsi_disk {
>  	unsigned	lbpu : 1;
>  	unsigned	lbpws : 1;
>  	unsigned	lbpws10 : 1;
> -	unsigned	lbpvpd : 1;
>  	unsigned	ws10 : 1;
>  	unsigned	ws16 : 1;
>  	unsigned	rc_basis: 2;

-- 
Damien Le Moal
Western Digital Research


  reply	other threads:[~2024-07-02  3:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-02  3:01 [PATCH 0/3] scsi: disable discard when set target full provisioning Haoqian He
2024-07-02  3:01 ` [PATCH 1/3] scsi: sd: " Haoqian He
2024-07-03  2:31   ` Martin K. Petersen
2024-07-02  3:01 ` [PATCH 2/3] scsi: sd: remove scsi_disk field lbpvpd Haoqian He
2024-07-02  3:30   ` Damien Le Moal [this message]
2024-07-02  3:01 ` [PATCH 3/3] scsi: sd: remove some redundant initialization code Haoqian He
2024-07-02  3:33   ` Damien Le Moal
2024-07-04  3:01     ` Haoqian He

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=469c4c38-ee78-4782-a58c-0e6f6c1faedc@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=fengli@smartx.com \
    --cc=haoqian.he@smartx.com \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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

all inboxes | Powered by JetHome®