Skip to contentSkip to conversation

block: Fix queue_flag update when rq_affinity goes from 2 to 1

PATCH In review Eric Seppanen 2 participants 2 messages Aug 16, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 block: Fix queue_flag update when rq_affinity goes from 2 to 1

From: Eric Seppanen <[email protected]>

Commit 5757a6d76cdf added the QUEUE_FLAG_SAME_FORCE flag, but fails to clear that flag when the current state is '2' (SAME_COMP + SAME_FORCE) and the new state is '1' (SAME_COMP).

Cc Dan Williams <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Dave Jiang <[email protected]>
Cc Jens Axboe <[email protected]>
---
 block/blk-sysfs.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
block/blk-sysfs.c +6 -4
index 0ee17b5..e681805 100644
@@ -258,11 +258,13 @@ queue_rq_affinity_store(struct request_queue *q, const char *page, size_t count)
 
 	ret = queue_var_store(&val, page, count);
 	spin_lock_irq(q->queue_lock);
-	if (val) {
+	if (val == 2) {
 		queue_flag_set(QUEUE_FLAG_SAME_COMP, q);
-		if (val == 2)
-			queue_flag_set(QUEUE_FLAG_SAME_FORCE, q);
-	} else {
+		queue_flag_set(QUEUE_FLAG_SAME_FORCE, q);
+	} else if (val == 1) {
+		queue_flag_set(QUEUE_FLAG_SAME_COMP, q);
+		queue_flag_clear(QUEUE_FLAG_SAME_FORCE, q);
+	} else if (val == 0) {
 		queue_flag_clear(QUEUE_FLAG_SAME_COMP, q);
 		queue_flag_clear(QUEUE_FLAG_SAME_FORCE, q);
 	}
Signature · 1 line
1.7.4.1