Disable WRITE_SAME (no_write_same) for Virtual Disks only. For System PDs and EPDs (Enhanced PDs), WRITE_SAME need not be disabled by default. Signed-off-by: Anand Lodnoor <anand.lodnoor@xxxxxxxxxxxx> --- drivers/scsi/megaraid/megaraid_sas_base.c | 5 ++++- drivers/scsi/megaraid/megaraid_sas_fusion.h | 17 ++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 96b893f..8b9ecee 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -1887,6 +1887,10 @@ void megasas_set_dynamic_target_properties(struct scsi_device *sdev, mr_device_priv_data->is_tm_capable = raid->capability.tmCapable; + + if (!raid->flags.isEPD) + sdev->no_write_same = 1; + } else if (instance->use_seqnum_jbod_fp) { pd_index = (sdev->channel * MEGASAS_MAX_DEV_PER_CHANNEL) + sdev->id; @@ -3416,7 +3420,6 @@ static int megasas_reset_target(struct scsi_cmnd *scmd) .bios_param = megasas_bios_param, .change_queue_depth = scsi_change_queue_depth, .max_segment_size = 0xffffffff, - .no_write_same = 1, }; /** diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.h b/drivers/scsi/megaraid/megaraid_sas_fusion.h index c013c80..8358b68 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.h +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.h @@ -864,9 +864,20 @@ struct MR_LD_RAID { u8 regTypeReqOnRead; __le16 seqNum; - struct { - u32 ldSyncRequired:1; - u32 reserved:31; +struct { +#ifndef MFI_BIG_ENDIAN + u32 ldSyncRequired:1; + u32 regTypeReqOnReadIsValid:1; + u32 isEPD:1; + u32 enableSLDOnAllRWIOs:1; + u32 reserved:28; +#else + u32 reserved:28; + u32 enableSLDOnAllRWIOs:1; + u32 isEPD:1; + u32 regTypeReqOnReadIsValid:1; + u32 ldSyncRequired:1; +#endif } flags; u8 LUN[8]; /* 0x24 8 byte LUN field used for SCSI IO's */ -- 1.8.3.1