Skip to content

Commit

Permalink
cciss: reinstate proper FIFO order of command queue list
Browse files Browse the repository at this point in the history
Commit 8a3173d inadvertently changed the ordering when
switching to hlists. Change to regular list heads so we
can use tail list adds, this improves performance.

Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
  • Loading branch information
Jens Axboe committed Jan 10, 2011
1 parent 2b51dca commit e6e1ee9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
23 changes: 11 additions & 12 deletions drivers/block/cciss.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,9 @@ static void set_performant_mode(ctlr_info_t *h, CommandList_struct *c)
/*
* Enqueuing and dequeuing functions for cmdlists.
*/
static inline void addQ(struct hlist_head *list, CommandList_struct *c)
static inline void addQ(struct list_head *list, CommandList_struct *c)
{
hlist_add_head(&c->list, list);
list_add_tail(&c->list, list);
}

static inline void removeQ(CommandList_struct *c)
Expand All @@ -281,12 +281,12 @@ static inline void removeQ(CommandList_struct *c)
* them off as 'stale' to prevent the driver from
* falling over.
*/
if (WARN_ON(hlist_unhashed(&c->list))) {
if (WARN_ON(list_empty(&c->list))) {
c->cmd_type = CMD_MSG_STALE;
return;
}

hlist_del_init(&c->list);
list_del_init(&c->list);
}

static void enqueue_cmd_and_start_io(ctlr_info_t *h,
Expand Down Expand Up @@ -935,7 +935,7 @@ static CommandList_struct *cmd_alloc(ctlr_info_t *h)

c->cmdindex = i;

INIT_HLIST_NODE(&c->list);
INIT_LIST_HEAD(&c->list);
c->busaddr = (__u32) cmd_dma_handle;
temp64.val = (__u64) err_dma_handle;
c->ErrDesc.Addr.lower = temp64.val32.lower;
Expand Down Expand Up @@ -974,7 +974,7 @@ static CommandList_struct *cmd_special_alloc(ctlr_info_t *h)
}
memset(c->err_info, 0, sizeof(ErrorInfo_struct));

INIT_HLIST_NODE(&c->list);
INIT_LIST_HEAD(&c->list);
c->busaddr = (__u32) cmd_dma_handle;
temp64.val = (__u64) err_dma_handle;
c->ErrDesc.Addr.lower = temp64.val32.lower;
Expand Down Expand Up @@ -2933,8 +2933,8 @@ static void start_io(ctlr_info_t *h)
{
CommandList_struct *c;

while (!hlist_empty(&h->reqQ)) {
c = hlist_entry(h->reqQ.first, CommandList_struct, list);
while (!list_empty(&h->reqQ)) {
c = list_entry(h->reqQ.next, CommandList_struct, list);
/* can't do anything if fifo is full */
if ((h->access.fifo_full(h))) {
dev_warn(&h->pdev->dev, "fifo full\n");
Expand Down Expand Up @@ -3447,11 +3447,10 @@ static inline u32 process_nonindexed_cmd(ctlr_info_t *h, u32 raw_tag)
{
u32 tag;
CommandList_struct *c = NULL;
struct hlist_node *tmp;
__u32 busaddr_masked, tag_masked;

tag = cciss_tag_discard_error_bits(raw_tag);
hlist_for_each_entry(c, tmp, &h->cmpQ, list) {
list_for_each_entry(c, &h->cmpQ, list) {
busaddr_masked = cciss_tag_discard_error_bits(c->busaddr);
tag_masked = cciss_tag_discard_error_bits(tag);
if (busaddr_masked == tag_masked) {
Expand Down Expand Up @@ -4632,8 +4631,8 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
h = hba[i];
h->pdev = pdev;
h->busy_initializing = 1;
INIT_HLIST_HEAD(&h->cmpQ);
INIT_HLIST_HEAD(&h->reqQ);
INIT_LIST_HEAD(&h->cmpQ);
INIT_LIST_HEAD(&h->reqQ);
mutex_init(&h->busy_shutting_down);

if (cciss_pci_init(h) != 0)
Expand Down
4 changes: 2 additions & 2 deletions drivers/block/cciss.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ struct ctlr_info
struct access_method access;

/* queue and queue Info */
struct hlist_head reqQ;
struct hlist_head cmpQ;
struct list_head reqQ;
struct list_head cmpQ;
unsigned int Qdepth;
unsigned int maxQsinceinit;
unsigned int maxSG;
Expand Down
2 changes: 1 addition & 1 deletion drivers/block/cciss_cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ typedef struct _CommandList_struct {
int ctlr;
int cmd_type;
long cmdindex;
struct hlist_node list;
struct list_head list;
struct request * rq;
struct completion *waiting;
int retry_count;
Expand Down

0 comments on commit e6e1ee9

Please sign in to comment.