* [PATCH] block: Remove the extra check in queue_requests_store.
@ 2011-04-19 8:26 Tao Ma
2011-04-19 11:51 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Tao Ma @ 2011-04-19 8:26 UTC (permalink / raw)
To: linux-kernel; +Cc: axboe
From: Tao Ma <boyu.mt@taobao.com>
In queue_requests_store, the code looks like
if (rl->count[BLK_RW_SYNC] >= q->nr_requests) {
blk_set_queue_full(q, BLK_RW_SYNC);
} else if (rl->count[BLK_RW_SYNC]+1 <= q->nr_requests) {
blk_clear_queue_full(q, BLK_RW_SYNC);
wake_up(&rl->wait[BLK_RW_SYNC]);
}
If we don't satify the situation of "if", we can get that
rl->count[BLK_RW_SYNC} < q->nr_quests. It is the same as
rl->count[BLK_RW_SYNC]+1 <= q->nr_requests.
All the "else" should satisfy the "else if" check so it isn't
needed actually.
Signed-off-by: Tao Ma <boyu.mt@taobao.com>
---
block/blk-sysfs.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 6d73512..644e2d3 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -66,14 +66,14 @@ queue_requests_store(struct request_queue *q, const char *page, size_t count)
if (rl->count[BLK_RW_SYNC] >= q->nr_requests) {
blk_set_queue_full(q, BLK_RW_SYNC);
- } else if (rl->count[BLK_RW_SYNC]+1 <= q->nr_requests) {
+ } else {
blk_clear_queue_full(q, BLK_RW_SYNC);
wake_up(&rl->wait[BLK_RW_SYNC]);
}
if (rl->count[BLK_RW_ASYNC] >= q->nr_requests) {
blk_set_queue_full(q, BLK_RW_ASYNC);
- } else if (rl->count[BLK_RW_ASYNC]+1 <= q->nr_requests) {
+ } else {
blk_clear_queue_full(q, BLK_RW_ASYNC);
wake_up(&rl->wait[BLK_RW_ASYNC]);
}
--
1.6.3.GIT
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] block: Remove the extra check in queue_requests_store.
2011-04-19 8:26 [PATCH] block: Remove the extra check in queue_requests_store Tao Ma
@ 2011-04-19 11:51 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2011-04-19 11:51 UTC (permalink / raw)
To: Tao Ma; +Cc: linux-kernel
On 2011-04-19 10:26, Tao Ma wrote:
> From: Tao Ma <boyu.mt@taobao.com>
>
> In queue_requests_store, the code looks like
> if (rl->count[BLK_RW_SYNC] >= q->nr_requests) {
> blk_set_queue_full(q, BLK_RW_SYNC);
> } else if (rl->count[BLK_RW_SYNC]+1 <= q->nr_requests) {
> blk_clear_queue_full(q, BLK_RW_SYNC);
> wake_up(&rl->wait[BLK_RW_SYNC]);
> }
> If we don't satify the situation of "if", we can get that
> rl->count[BLK_RW_SYNC} < q->nr_quests. It is the same as
> rl->count[BLK_RW_SYNC]+1 <= q->nr_requests.
> All the "else" should satisfy the "else if" check so it isn't
> needed actually.
Thanks, applied.
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-04-19 11:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-19 8:26 [PATCH] block: Remove the extra check in queue_requests_store Tao Ma
2011-04-19 11:51 ` Jens Axboe
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.