All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
To: linux-scsi@vger.kernel.org
Cc: martin.petersen@oracle.com, thenzl@redhat.com,
	jejb@linux.vnet.ibm.com, kashyap.desai@broadcom.com,
	sumit.saxena@broadcom.com, hare@suse.com,
	Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Subject: [PATCH 2/4] megaraid_sas: add correct return type check for ldio hint logic for raid1
Date: Fri, 10 Mar 2017 03:22:13 -0800	[thread overview]
Message-ID: <1489144935-26567-3-git-send-email-shivasharan.srikanteshwara@broadcom.com> (raw)
In-Reply-To: <1489144935-26567-1-git-send-email-shivasharan.srikanteshwara@broadcom.com>

Return value check of atomic_dec_if_positive is required as it returns old value minus one.
Without this fix, driver will send small ios to firmware path and that will be a performance issue.

Not a critical, but good to have r1_ldio_hint as default value in sdev private.

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
---
 drivers/scsi/megaraid/megaraid_sas_base.c   | 3 +++
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 016ffce..0016f12 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -1963,6 +1963,9 @@ static int megasas_slave_alloc(struct scsi_device *sdev)
 	if (!mr_device_priv_data)
 		return -ENOMEM;
 	sdev->hostdata = mr_device_priv_data;
+
+	atomic_set(&mr_device_priv_data->r1_ldio_hint,
+		   instance->r1_ldio_hint_default);
 	return 0;
 }
 
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 29650ba..ebd746e 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -2338,7 +2338,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance,
 				fp_possible = false;
 				atomic_dec(&instance->fw_outstanding);
 			} else if ((scsi_buff_len > MR_LARGE_IO_MIN_SIZE) ||
-				   atomic_dec_if_positive(&mrdev_priv->r1_ldio_hint)) {
+				   (atomic_dec_if_positive(&mrdev_priv->r1_ldio_hint) > 0)) {
 				fp_possible = false;
 				atomic_dec(&instance->fw_outstanding);
 				if (scsi_buff_len > MR_LARGE_IO_MIN_SIZE)
-- 
2.8.3

  parent reply	other threads:[~2017-03-10 11:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-10 11:22 [PATCH 0/4] megaraid_sas: Bug fixes and improvements for 4.11-rc Shivasharan S
2017-03-10 11:22 ` [PATCH 1/4] megaraid_sas: enable intx only if msix request fails Shivasharan S
2017-03-10 16:00   ` Tomas Henzl
2017-03-10 11:22 ` Shivasharan S [this message]
2017-03-10 16:00   ` [PATCH 2/4] megaraid_sas: add correct return type check for ldio hint logic for raid1 Tomas Henzl
2017-03-10 11:22 ` [PATCH 3/4] megaraid_sas: raid6 also require cpuSel check same as raid5 Shivasharan S
2017-03-10 16:00   ` Tomas Henzl
2017-03-10 11:22 ` [PATCH 4/4] megaraid_sas: Driver version upgrade Shivasharan S
2017-03-10 16:01   ` Tomas Henzl
2017-03-14  3:00 ` [PATCH 0/4] megaraid_sas: Bug fixes and improvements for 4.11-rc Martin K. Petersen

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=1489144935-26567-3-git-send-email-shivasharan.srikanteshwara@broadcom.com \
    --to=shivasharan.srikanteshwara@broadcom.com \
    --cc=hare@suse.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=kashyap.desai@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=sumit.saxena@broadcom.com \
    --cc=thenzl@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.