* [PATCH] scsi:sd: define variable dif as unsigned int instead of bool
@ 2019-10-22 6:27 chenxiang
2019-10-24 16:57 ` Bart Van Assche
2019-10-25 0:35 ` Martin K. Petersen
0 siblings, 2 replies; 3+ messages in thread
From: chenxiang @ 2019-10-22 6:27 UTC (permalink / raw)
To: jejb, martin.petersen; +Cc: linuxarm, linux-scsi, john.garry, Xiang Chen
From: Xiang Chen <chenxiang66@hisilicon.com>
Variable dif in function sd_setup_read_write_cmnd() is the return value
of function scsi_host_dif_capable() which returns dif capability of disks.
If define it as bool, even for the disks which support DIF3, the function
still return dif=1, which causes IO error. So define variable dif as
unsigned int instead of bool.
Fixes: e249e42d277e ("scsi: sd: Clean up sd_setup_read_write_cmnd()")
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
---
drivers/scsi/sd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 32d9517..a763b70 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1166,11 +1166,12 @@ static blk_status_t sd_setup_read_write_cmnd(struct scsi_cmnd *cmd)
sector_t lba = sectors_to_logical(sdp, blk_rq_pos(rq));
sector_t threshold;
unsigned int nr_blocks = sectors_to_logical(sdp, blk_rq_sectors(rq));
- bool dif, dix;
unsigned int mask = logical_to_sectors(sdp, 1) - 1;
bool write = rq_data_dir(rq) == WRITE;
unsigned char protect, fua;
blk_status_t ret;
+ unsigned int dif;
+ bool dix;
ret = scsi_init_io(cmd);
if (ret != BLK_STS_OK)
--
2.8.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi:sd: define variable dif as unsigned int instead of bool
2019-10-22 6:27 [PATCH] scsi:sd: define variable dif as unsigned int instead of bool chenxiang
@ 2019-10-24 16:57 ` Bart Van Assche
2019-10-25 0:35 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Bart Van Assche @ 2019-10-24 16:57 UTC (permalink / raw)
To: chenxiang, jejb, martin.petersen; +Cc: linuxarm, linux-scsi, john.garry
On 10/21/19 11:27 PM, chenxiang wrote:
> From: Xiang Chen <chenxiang66@hisilicon.com>
>
> Variable dif in function sd_setup_read_write_cmnd() is the return value
> of function scsi_host_dif_capable() which returns dif capability of disks.
> If define it as bool, even for the disks which support DIF3, the function
> still return dif=1, which causes IO error. So define variable dif as
> unsigned int instead of bool.
>
> Fixes: e249e42d277e ("scsi: sd: Clean up sd_setup_read_write_cmnd()")
> Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
> ---
> drivers/scsi/sd.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index 32d9517..a763b70 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -1166,11 +1166,12 @@ static blk_status_t sd_setup_read_write_cmnd(struct scsi_cmnd *cmd)
> sector_t lba = sectors_to_logical(sdp, blk_rq_pos(rq));
> sector_t threshold;
> unsigned int nr_blocks = sectors_to_logical(sdp, blk_rq_sectors(rq));
> - bool dif, dix;
> unsigned int mask = logical_to_sectors(sdp, 1) - 1;
> bool write = rq_data_dir(rq) == WRITE;
> unsigned char protect, fua;
> blk_status_t ret;
> + unsigned int dif;
> + bool dix;
>
> ret = scsi_init_io(cmd);
> if (ret != BLK_STS_OK)
>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi:sd: define variable dif as unsigned int instead of bool
2019-10-22 6:27 [PATCH] scsi:sd: define variable dif as unsigned int instead of bool chenxiang
2019-10-24 16:57 ` Bart Van Assche
@ 2019-10-25 0:35 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2019-10-25 0:35 UTC (permalink / raw)
To: chenxiang; +Cc: jejb, martin.petersen, linuxarm, linux-scsi, john.garry
> Variable dif in function sd_setup_read_write_cmnd() is the return
> value of function scsi_host_dif_capable() which returns dif capability
> of disks. If define it as bool, even for the disks which support
> DIF3, the function still return dif=1, which causes IO error. So
> define variable dif as unsigned int instead of bool.
Applied to 5.4/scsi-fixes, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-25 0:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-22 6:27 [PATCH] scsi:sd: define variable dif as unsigned int instead of bool chenxiang
2019-10-24 16:57 ` Bart Van Assche
2019-10-25 0:35 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).