All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luben Tuikov <ltuikov@yahoo.com>
To: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: jaxboe@fusionio.com
Subject: [PATCH] [BLOCK] Allow tag 0 to be generated
Date: Mon, 10 Jan 2011 09:26:13 -0800 (PST)	[thread overview]
Message-ID: <1266.36669.qm@web31807.mail.mud.yahoo.com> (raw)

Commit 67869fb9fdfa04503b250d59e086c15f1698aea0
skipped tag 0 by virtue of setting last_tag to
0. This commit sets it to -1, in order to start
and loop over from 0, thus generating tags
[0,max_tag-1], instead of [1,max_tag-1].

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
---
 For a reference to the original patch see here:
 git://github.com/ltuikov/linux-2.6.git

 block/blk-tag.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/block/blk-tag.c b/block/blk-tag.c
index f792e98..744cea6 100644
--- a/block/blk-tag.c
+++ b/block/blk-tag.c
@@ -130,7 +130,7 @@ init_tag_map(struct request_queue *q, struct blk_queue_tag *tags, int depth)
        tags->max_depth = depth;
        tags->tag_index = tag_index;
        tags->tag_map = tag_map;
-       tags->last_tag = 0;
+       tags->last_tag = -1;
 
        return 0;
 fail:
@@ -340,7 +340,7 @@ EXPORT_SYMBOL(blk_queue_end_tag);
 int blk_queue_start_tag(struct request_queue *q, struct request *rq)
 {
        struct blk_queue_tag *bqt = q->queue_tags;
-       unsigned max_depth;
+       int max_depth;
        int tag;
 
        if (unlikely((rq->cmd_flags & REQ_QUEUED))) {
@@ -361,14 +361,14 @@ int blk_queue_start_tag(struct request_queue *q, struct request *rq)
        max_depth = bqt->max_depth;
        if (!rq_is_sync(rq) && max_depth > 1) {
                max_depth -= 2;
-               if (!max_depth)
+               if (max_depth <= 0)
                        max_depth = 1;
                if (q->in_flight[BLK_RW_ASYNC] > max_depth)
                        return 1;
        }
 
        if (bqt->last_tag == bqt->max_depth-1)
-               bqt->last_tag = 0;
+               bqt->last_tag = -1;
 
        do {
                tag = find_next_zero_bit(bqt->tag_map,
-- 
1.7.2.2.165.gbc382

             reply	other threads:[~2011-01-10 17:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-10 17:26 Luben Tuikov [this message]
2011-01-10 18:49 ` [PATCH] [BLOCK] Allow tag 0 to be generated Jens Axboe
2011-01-10 18:52   ` Jens Axboe
2011-01-10 19:27     ` Luben Tuikov
2011-01-10 19:31       ` Jens Axboe

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=1266.36669.qm@web31807.mail.mud.yahoo.com \
    --to=ltuikov@yahoo.com \
    --cc=jaxboe@fusionio.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /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.