public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Chaotian Jing <chaotian.jing@mediatek.com>,
	James.Bottomley@HansenPartnership.com,
	martin.petersen@oracle.com
Cc: Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, srv_heupstream@mediatek.com
Subject: Re: [PATCH] scsi: fix the return value of scsi_logical_block_count
Date: Tue, 6 Aug 2024 13:51:48 -0700	[thread overview]
Message-ID: <126b79d8-6451-4e86-9df5-189f19eb121e@acm.org> (raw)
In-Reply-To: <20240806072714.29756-1-chaotian.jing@mediatek.com>

On 8/6/24 12:26 AM, Chaotian Jing wrote:
> scsi_logical_block_count() should return the block count of scsi device,
> but the original code has a wrong implement.
> 
> Signed-off-by: Chaotian Jing <chaotian.jing@mediatek.com>
> ---
>   include/scsi/scsi_cmnd.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
> index 45c40d200154..f0be0caa295a 100644
> --- a/include/scsi/scsi_cmnd.h
> +++ b/include/scsi/scsi_cmnd.h
> @@ -236,7 +236,7 @@ static inline unsigned int scsi_logical_block_count(struct scsi_cmnd *scmd)
>   {
>   	unsigned int shift = ilog2(scmd->device->sector_size) - SECTOR_SHIFT;
>   
> -	return blk_rq_bytes(scsi_cmd_to_rq(scmd)) >> shift;
> +	return blk_rq_sectors(scsi_cmd_to_rq(scmd)) >> shift;
>   }
>   
>   /*

Please add the following to this patch:

Cc: stable@vger.kernel.org
Fixes: 6a20e21ae1e2 ("scsi: core: Add helper to return number of logical 
blocks in a request")

Anyway:

Reviewed-by: Bart Van Assche <bvanassche@acm.org>

  reply	other threads:[~2024-08-06 20:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-06  7:26 [PATCH] scsi: fix the return value of scsi_logical_block_count Chaotian Jing
2024-08-06 20:51 ` Bart Van Assche [this message]
2024-08-07  8:47 ` John Garry
  -- strict thread matches above, loose matches on Subject: below --
2024-08-07  0:57 Chaotian Jing
2024-08-13  1:52 ` Martin K. Petersen
2024-08-13  3:35   ` Chaotian Jing (井朝天)

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=126b79d8-6451-4e86-9df5-189f19eb121e@acm.org \
    --to=bvanassche@acm.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=chaotian.jing@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=matthias.bgg@gmail.com \
    --cc=srv_heupstream@mediatek.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