From: "Stephen M. Cameron" <scameron@beardog.cce.hp.com>
To: akpm@linux-foundation.org, James.Bottomley@HansenPartnership.com
Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org,
scameron@beardog.cce.hp.com, mikem@beardog.cce.hp.com
Subject: [PATCH 14/17] hpsa: Flush cache with interrupts still enabled.
Date: Wed, 11 Nov 2009 10:51:34 -0600 [thread overview]
Message-ID: <20091111165134.17754.56407.stgit@beardog.cce.hp.com> (raw)
In-Reply-To: <20091111164803.17754.11900.stgit@beardog.cce.hp.com>
hpsa: Flush cache with interrupts still enabled. It's not
necessary to disable interrupts prior to flushing the cache
on driver unload. Also, don't dma from the stack.
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
---
drivers/scsi/hpsa.c | 39 ++++++++++++++++++++++++++++++---------
1 files changed, 30 insertions(+), 9 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index e3b80fa..d171a55 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -3581,24 +3581,45 @@ clean1:
return -1;
}
+static void hpsa_flush_cache(struct ctlr_info *h)
+{
+ char *flush_buf;
+ struct CommandList *c;
+ int rc;
+
+ flush_buf = kzalloc(4, GFP_KERNEL);
+ if (!flush_buf)
+ return;
+
+ c = cmd_special_alloc(h);
+ if (!c) {
+ dev_warn(&h->pdev->dev, "cmd_special_alloc returned NULL!\n");
+ goto out_of_memory;
+ }
+ rc = fill_cmd(c, HPSA_CACHE_FLUSH, h, flush_buf, 4, 0,
+ RAID_CTLR_LUNID, TYPE_CMD);
+ if (rc == 0) {
+ hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_TODEVICE);
+ if (c->err_info->CommandStatus != 0)
+ dev_warn(&h->pdev->dev,
+ "error flushing cache on controller\n");
+ }
+ cmd_special_free(h, c);
+out_of_memory:
+ kfree(flush_buf);
+}
+
static void hpsa_shutdown(struct pci_dev *pdev)
{
struct ctlr_info *h;
- char flush_buf[4];
- int return_code;
h = pci_get_drvdata(pdev);
/* Turn board interrupts off and send the flush cache command
* sendcmd will turn off interrupt, and send the flush...
* To write all data in the battery backed cache to disks
*/
- memset(flush_buf, 0, 4);
- return_code = sendcmd(HPSA_CACHE_FLUSH, h, flush_buf, 4, 0,
- RAID_CTLR_LUNID, TYPE_CMD);
- if (return_code != IO_OK) {
- dev_warn(&pdev->dev, "error flushing cache on controller %d\n",
- h->ctlr);
- }
+ hpsa_flush_cache(h);
+ h->access.set_intr_mask(h, HPSA_INTR_OFF);
free_irq(h->intr[2], h);
#ifdef CONFIG_PCI_MSI
if (h->msix_vector)
next prev parent reply other threads:[~2009-11-11 16:50 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-11 16:50 [PATCH 00/17] hpsa driver updates Stephen M. Cameron
2009-11-11 16:50 ` [PATCH 01/17] Add hpsa driver for HP Smart Array controllers Stephen M. Cameron
2009-11-11 16:50 ` [PATCH 02/17] avoid helpful cleanup patches Stephen M. Cameron
2009-11-11 16:50 ` [PATCH 03/17] hpsa: Fix vendor id check Stephen M. Cameron
2009-11-11 16:50 ` [PATCH 04/17] Fix use of unallocated memory for MSA2xxx enclosure device data Stephen M. Cameron
2009-11-12 22:45 ` Andrew Morton
2009-11-11 16:50 ` [PATCH 05/17] hpsa: Allocate the correct amount of extra space for the scsi host Stephen M. Cameron
2009-11-11 16:50 ` [PATCH 06/17] hpsa: Use shost_priv instead of accessing host->hostdata[0] directly Stephen M. Cameron
2009-11-11 16:50 ` [PATCH 07/17] hpsa: Factor out command submission sequence Stephen M. Cameron
2009-11-11 16:51 ` [PATCH 08/17] hpsa: Factor out some pci_unmap code Stephen M. Cameron
2009-11-11 16:51 ` [PATCH 09/17] Add thread to allow controllers to register for rescan for new devices Stephen M. Cameron
2009-11-12 22:50 ` Andrew Morton
2009-11-11 16:51 ` [PATCH 10/17] hpsa: Allow device rescan to be triggered via sysfs Stephen M. Cameron
2009-11-12 22:51 ` Andrew Morton
2009-11-11 16:51 ` [PATCH 11/17] hpsa: Make hpsa_sdev_attrs static Stephen M. Cameron
2009-11-11 16:51 ` [PATCH 12/17] hpsa: decode unit attention condition and retry commands Stephen M. Cameron
2009-11-11 16:51 ` [PATCH 13/17] hpsa: Retry driver initiated commands on unit attention Stephen M. Cameron
2009-11-12 22:52 ` Andrew Morton
2009-11-11 16:51 ` Stephen M. Cameron [this message]
2009-11-11 16:51 ` [PATCH 15/17] hpsa: Remove sendcmd, in no case are we required to poll for completions Stephen M. Cameron
2009-11-11 16:51 ` [PATCH 16/17] hpsa: Make fill_cmd() return void Stephen M. Cameron
2009-11-11 16:51 ` [PATCH 17/17] hpsa: fix typo that causes scsi status to be lost Stephen M. Cameron
2009-11-16 21:06 ` [PATCH 00/17] hpsa driver updates James Bottomley
2009-11-16 21:32 ` Andrew Morton
2009-11-16 21:54 ` scameron
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=20091111165134.17754.56407.stgit@beardog.cce.hp.com \
--to=scameron@beardog.cce.hp.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mikem@beardog.cce.hp.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