Re: [PATCH 21/22] aacraid: use scsi_get_internal_cmd()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




  	return fibptr;
  }
@@ -240,36 +231,28 @@ struct fib *aac_fib_alloc_tag(struct aac_dev *dev, struct scsi_cmnd *scmd)
  /**
   *	aac_fib_alloc	-	allocate a fib
   *	@dev: Adapter to allocate the fib for
+ *	@direction: DMA data direction
   *
   *	Allocate a fib from the adapter fib pool. If the pool is empty we
   *	return NULL.
   */
-struct fib *aac_fib_alloc(struct aac_dev *dev)
+struct fib *aac_fib_alloc(struct aac_dev *dev, int direction)
  {
-	struct fib * fibptr;
+	struct scsi_cmnd *scmd;
+	struct fib * fibptr = NULL;
  	unsigned long flags;
+
  	spin_lock_irqsave(&dev->fib_lock, flags);

Do you still require this spinlock'ing?

-	fibptr = dev->free_fib;
-	if(!fibptr){
-		spin_unlock_irqrestore(&dev->fib_lock, flags);
-		return fibptr;
-	}
-	dev->free_fib = fibptr->next;
+	scmd = scsi_get_internal_cmd(dev->scsi_host_dev, direction,
+				     REQ_NOWAIT);
+	if (scmd)
+		fibptr = aac_fib_alloc_tag(dev, scmd);
  	spin_unlock_irqrestore(&dev->fib_lock, flags);
-	/*
-	 *	Set the proper node type code and node byte size
-	 */
-	fibptr->type = FSAFS_NTC_FIB_CONTEXT;
+	if (!fibptr)
+		return NULL;
+
  	fibptr->size = sizeof(struct fib); > -	/*
-	 *	Null out fields that depend on being zero at the start of
-	 *	each I/O
-	 */
-	fibptr->hw_fib_va->header.XferState = 0;
-	fibptr->flags = 0;
-	fibptr->callback = NULL;
-	fibptr->callback_data = NULL;
return fibptr;
  }
@@ -297,8 +280,12 @@ void aac_fib_free(struct fib *fibptr)
  			 (void*)fibptr,
  			 le32_to_cpu(fibptr->hw_fib_va->header.XferState));
  	}
-	fibptr->next = fibptr->dev->free_fib;
-	fibptr->dev->free_fib = fibptr;
+	if (fibptr->scmd) {
+		struct scsi_cmnd *scmd = fibptr->scmd;
+
+		fibptr->scmd = NULL;
+		scsi_put_internal_cmd(scmd);
+	}
  	spin_unlock_irqrestore(&fibptr->dev->fib_lock, flags);

as above

  }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux