Skip to contentSkip to conversation

mmc: queue: exclude asynchronous transfer for special request

PATCH Superseded Seungwon Jeon 2 participants 5 messages Dec 20, 2012 – Dec 22, 2012 MMC, SD and SDIO

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: queue: exclude asynchronous transfer for special request

Unlike normal r/w request, special requests(discard, flush) is finished with a one-time issue_fn. Request change to mqrq_prev makes unnecessary call.

---
 drivers/mmc/card/queue.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/mmc/card/queue.c +8 -0
index fadf52e..a71db7a 100644
@@ -58,6 +58,7 @@ static int mmc_queue_thread(void *d)
 	do {
 		struct request *req = NULL;
 		struct mmc_queue_req *tmp;
+		unsigned int cmd_flags = 0;
 
 		spin_lock_irq(q->queue_lock);
 		set_current_state(TASK_INTERRUPTIBLE);
@@ -67,12 +68,19 @@ static int mmc_queue_thread(void *d)
 
 		if (req || mq->mqrq_prev->req) {
 			set_current_state(TASK_RUNNING);
+			cmd_flags = req ? req->cmd_flags : 0;
 			mq->issue_fn(mq, req);
 
 			/*
 			 * Current request becomes previous request
 			 * and vice versa.
+			 * In case of special requests, current request
+			 * has been finished. Do not remain it to previous
+			 * request.
 			 */
+			if (cmd_flags & REQ_DISCARD || cmd_flags & REQ_FLUSH)
+				mq->mqrq_cur->req = NULL;
+
 			mq->mqrq_prev->brq.mrq.data = NULL;
 			mq->mqrq_prev->req = NULL;
 			tmp = mq->mqrq_prev;
Signature · 1 line
1.7.0.4
#1 lore raw

Hello,

Quoted 28 lines · Seungwon Jeon

Unlike normal r/w request, special requests(discard, flush) is finished with a one-time issue_fn. Request change to mqrq_prev makes unnecessary call.

---
  drivers/mmc/card/queue.c |    8 ++++++++
  1 files changed, 8 insertions(+), 0 deletions(-)
drivers/mmc/card/queue.c +2 -0
index fadf52e..a71db7a 100644
@@ -58,6 +58,7 @@ static int mmc_queue_thread(void *d)
  	do {
  		struct request *req = NULL;
  		struct mmc_queue_req *tmp;
+		unsigned int cmd_flags = 0;
 
  		spin_lock_irq(q->queue_lock);
  		set_current_state(TASK_INTERRUPTIBLE);
@@ -67,12 +68,19 @@ static int mmc_queue_thread(void *d)
 
  		if (req || mq->mqrq_prev->req) {
  			set_current_state(TASK_RUNNING);
+			cmd_flags = req ? req->cmd_flags : 0;
  			mq->issue_fn(mq, req);
 

drivers/mmc/card/queue.c static int mmc_queue_thread(void *d) · line 83

Quoted 10 lines
drivers/mmc/card/queue.c +6 -0
  			/*
  			 * Current request becomes previous request
  			 * and vice versa.
+			 * In case of special requests, current request
+			 * has been finished. Do not remain it to previous
+			 * request.
  			 */
+			if (cmd_flags & REQ_DISCARD || cmd_flags & REQ_FLUSH)
+				mq->mqrq_cur->req = NULL;
+

It is better to define control mask, REQ_CONTROL_MASK, which will include all control/special requests. Then, when additional requests will be added, there will be no need to change here.

Another option - to clean mq->mqrq_cur->req immediately after executing a special request in mmc_blk_issue_rq().
mq->mqrq_prev->brq.mrq.data = NULL; mq->mqrq_prev->req = NULL; tmp =
mq->mqrq_prev;

#2 lore raw
In reply to Seungwon Jeon

Hello Jeon,

Quoted 32 lines · Seungwon Jeon

Unlike normal r/w request, special requests(discard, flush) is finished with a one-time issue_fn. Request change to mqrq_prev makes unnecessary call.

---
  drivers/mmc/card/queue.c |    8 ++++++++
  1 files changed, 8 insertions(+), 0 deletions(-)
drivers/mmc/card/queue.c +2 -0
index fadf52e..a71db7a 100644
@@ -58,6 +58,7 @@ static int mmc_queue_thread(void *d)
  	do {
  		struct request *req = NULL;
  		struct mmc_queue_req *tmp;
+		unsigned int cmd_flags = 0;
 
  		spin_lock_irq(q->queue_lock);
  		set_current_state(TASK_INTERRUPTIBLE);
@@ -67,12 +68,19 @@ static int mmc_queue_thread(void *d)
 
  		if (req || mq->mqrq_prev->req) {
  			set_current_state(TASK_RUNNING);
+			cmd_flags = req ? req->cmd_flags : 0;
  			mq->issue_fn(mq, req);
 
  			/*
  			 * Current request becomes previous request
  			 * and vice versa.

drivers/mmc/card/queue.c static int mmc_queue_thread(void *d) · line 86

Quoted 10 lines
drivers/mmc/card/queue.c +6 -0
+			 * In case of special requests, current request
+			 * has been finished. Do not remain it to previous
+			 * request.
  			 */
+			if (cmd_flags & REQ_DISCARD || cmd_flags & REQ_FLUSH)
+				mq->mqrq_cur->req = NULL;
+
  			mq->mqrq_prev->brq.mrq.data = NULL;
  			mq->mqrq_prev->req = NULL;
  			tmp = mq->mqrq_prev;

It is better to define control mask, REQ_CONTROL_MASK, which will include all control/special requests.

Then, when additional request will be added, there will be no need to change here, only update the mask.

Another option - to clean mq->mqrq_cur->req immediately after executing a special request in mmc_blk_issue_rq().

Signature · 4 lines
Konstantin Dorfman,
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center,
Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#3 lore raw
Quoted 32 lines · Konstantin Dorfman

Hello Jeon,

Quoted 28 lines · Seungwon Jeon

Unlike normal r/w request, special requests(discard, flush) is finished with a one-time issue_fn. Request change to mqrq_prev makes unnecessary call.

---
  drivers/mmc/card/queue.c |    8 ++++++++
  1 files changed, 8 insertions(+), 0 deletions(-)
drivers/mmc/card/queue.c +2 -0
index fadf52e..a71db7a 100644
@@ -58,6 +58,7 @@ static int mmc_queue_thread(void *d)
  	do {
  		struct request *req = NULL;
  		struct mmc_queue_req *tmp;
+		unsigned int cmd_flags = 0;
 
  		spin_lock_irq(q->queue_lock);
  		set_current_state(TASK_INTERRUPTIBLE);
@@ -67,12 +68,19 @@ static int mmc_queue_thread(void *d)
 
  		if (req || mq->mqrq_prev->req) {
  			set_current_state(TASK_RUNNING);
+			cmd_flags = req ? req->cmd_flags : 0;
  			mq->issue_fn(mq, req);
 
Quoted 16 lines
Quoted 4 lines
drivers/mmc/card/queue.c +0 -0
  			/*
  			 * Current request becomes previous request
  			 * and vice versa.

drivers/mmc/card/queue.c static int mmc_queue_thread(void *d) · line 86

Quoted 10 lines
drivers/mmc/card/queue.c +6 -0
+			 * In case of special requests, current request
+			 * has been finished. Do not remain it to previous
+			 * request.
  			 */
+			if (cmd_flags & REQ_DISCARD || cmd_flags & REQ_FLUSH)
+				mq->mqrq_cur->req = NULL;
+
  			mq->mqrq_prev->brq.mrq.data = NULL;
  			mq->mqrq_prev->req = NULL;
  			tmp = mq->mqrq_prev;

It is better to define control mask, REQ_CONTROL_MASK, which will include all control/special requests.

Agree, it's better.

Quoted 6 lines

Then, when additional request will be added, there will be no need to change here, only update the mask.

Another option - to clean mq->mqrq_cur->req immediately after executing a special request in mmc_blk_issue_rq().

Yes, I also approached it with the same idea at the beginning. But it seems that 'queue.c' has a role of management of two requests, while 'block.c' just uses these request. It makes sense?

Thanks,
Seungwon Jeon

Quoted 11 lines

--
Konstantin Dorfman,
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
Quoted 52 lines · Seungwon Jeon
Quoted 32 lines · Konstantin Dorfman

Hello Jeon,

Quoted 28 lines · Seungwon Jeon

Unlike normal r/w request, special requests(discard, flush) is finished with a one-time issue_fn. Request change to mqrq_prev makes unnecessary call.

---
   drivers/mmc/card/queue.c |    8 ++++++++
   1 files changed, 8 insertions(+), 0 deletions(-)
drivers/mmc/card/queue.c +2 -0
index fadf52e..a71db7a 100644
@@ -58,6 +58,7 @@ static int mmc_queue_thread(void *d)
   	do {
   		struct request *req = NULL;
   		struct mmc_queue_req *tmp;
+		unsigned int cmd_flags = 0;
 
   		spin_lock_irq(q->queue_lock);
   		set_current_state(TASK_INTERRUPTIBLE);
@@ -67,12 +68,19 @@ static int mmc_queue_thread(void *d)
 
   		if (req || mq->mqrq_prev->req) {
   			set_current_state(TASK_RUNNING);
+			cmd_flags = req ? req->cmd_flags : 0;
   			mq->issue_fn(mq, req);
 
Quoted 16 lines
Quoted 4 lines
drivers/mmc/card/queue.c +0 -0
   			/*
   			 * Current request becomes previous request
   			 * and vice versa.

drivers/mmc/card/queue.c static int mmc_queue_thread(void *d) · line 86

Quoted 10 lines
drivers/mmc/card/queue.c +6 -0
+			 * In case of special requests, current request
+			 * has been finished. Do not remain it to previous
+			 * request.
   			 */
+			if (cmd_flags & REQ_DISCARD || cmd_flags & REQ_FLUSH)
+				mq->mqrq_cur->req = NULL;
+
   			mq->mqrq_prev->brq.mrq.data = NULL;
   			mq->mqrq_prev->req = NULL;
   			tmp = mq->mqrq_prev;

It is better to define control mask, REQ_CONTROL_MASK, which will include all control/special requests.

Agree, it's better.

Quoted 1 line
Quoted 8 lines
Quoted 5 lines

Then, when additional request will be added, there will be no need to change here, only update the mask.

Another option - to clean mq->mqrq_cur->req immediately after executing a special request in mmc_blk_issue_rq().

Yes, I also approached it with the same idea at the beginning. But it seems that 'queue.c' has a role of management of two requests, while 'block.c' just uses these request. It makes sense?

Sure, agree with you.

Thanks,

Signature · 4 lines
Konstantin Dorfman,
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center,
Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation