From 591bdaeafc617c4b51988052230cd395e85edaf3 Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Sun, 17 Aug 2008 23:59:43 -0500 Subject: [PATCH 20/23] libfc: don't use GFP_ATOMIC when we do not have to. fc_eh_device_reset is not called with a spin_lock and is called from the scsi eh process, so we do not have to use GFP_ATOMIC. Signed-off-by: Mike Christie --- drivers/scsi/libfc/fc_fcp.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c index eb37a66..95605a1 100644 --- a/drivers/scsi/libfc/fc_fcp.c +++ b/drivers/scsi/libfc/fc_fcp.c @@ -185,17 +185,18 @@ static void fc_fcp_srr_error(struct fc_fcp_pkt *, struct fc_frame *); /** * fc_fcp_pkt_alloc - allocation routine for scsi_pkt packet * @lp: fc lport struct + * @gfp: gfp flags for allocation * * This is used by upper layer scsi driver. * Return Value : scsi_pkt structure or null on allocation failure. * Context : call from process context. no locking required. */ -static struct fc_fcp_pkt *fc_fcp_pkt_alloc(struct fc_lport *lp) +static struct fc_fcp_pkt *fc_fcp_pkt_alloc(struct fc_lport *lp, gfp_t gfp) { struct fc_fcp_internal *si = fc_get_scsi_internal(lp); struct fc_fcp_pkt *sp; - sp = mempool_alloc(si->scsi_pkt_pool, GFP_ATOMIC); + sp = mempool_alloc(si->scsi_pkt_pool, gfp); if (sp) { memset(sp, 0, sizeof(*sp)); sp->lp = lp; @@ -1703,7 +1704,7 @@ int fc_queuecommand(struct scsi_cmnd *sc_cmd, void (*done)(struct scsi_cmnd *)) goto out; } - sp = fc_fcp_pkt_alloc(lp); + sp = fc_fcp_pkt_alloc(lp, GFP_ATOMIC); if (sp == NULL) { rc = SCSI_MLQUEUE_HOST_BUSY; goto out; @@ -1955,7 +1956,7 @@ int fc_eh_device_reset(struct scsi_cmnd *sc_cmd) if (lp->state != LPORT_ST_READY) return rc; - sp = fc_fcp_pkt_alloc(lp); + sp = fc_fcp_pkt_alloc(lp, GFP_NOIO); if (sp == NULL) { FC_DBG("could not allocate scsi_pkt\n"); sc_cmd->result = DID_NO_CONNECT << 16; -- 1.5.4.1