Skip to contentSkip to conversation

patch: use elv_queue_empty

uml-devel Applied Werner Almesberger 3 participants 3 messages Feb 8, 2004 – Feb 22, 2004 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

This patch makes UBD a little more compatible with alternative elevators that may not use a single request queue.

It's for 2.6.1 with uml-patch-2.6.1-1.

- Werner

arch/um/drivers/ubd_kern.c renamed from arch/um/drivers/ubd_kern.c.orig +2 -2
@@ -1034,7 +1034,7 @@
 	int err, n;
 
 	if(thread_fd == -1){
-		while(!list_empty(&q->queue_head)){
+		while(!elv_queue_empty(q)){
 			req = elv_next_request(q);
 			err = prepare_request(req, &io_req);
 			if(!err){
@@ -1044,7 +1044,7 @@
 		}
 	}
 	else {
-		if(do_ubd || list_empty(&q->queue_head)) return;
+		if(do_ubd || elv_queue_empty(q)) return;
 		req = elv_next_request(q);
 		err = prepare_request(req, &io_req);
 		if(!err){
Signature · 14 lines
  _________________________________________________________________________
 / Werner Almesberger, Buenos Aires, Argentina     [email protected] /
/_http://www.almesberger.net/____________________________________________/


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Applied
#1 lore raw
Quoted 2 lines · Werner Almesberger

This patch makes UBD a little more compatible with alternative elevators that may not use a single request queue.

Applied, thanks.

Jeff

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#2 lore raw
In reply to Werner Almesberger

Alle 22:11, domenica 8 febbraio 2004, Werner Almesberger ha scritto:

Quoted 15 lines

This patch makes UBD a little more compatible with alternative elevators that may not use a single request queue.

arch/um/drivers/ubd_kern.c renamed from arch/um/drivers/ubd_kern.c.orig +1 -1
@@ -1034,7 +1034,7 @@
 	int err, n;
 
 	if(thread_fd == -1){
-		while(!list_empty(&q->queue_head)){
+		while(!elv_queue_empty(q)){
 			req = elv_next_request(q);
 			err = prepare_request(req, &io_req);
 			if(!err){

arch/um/drivers/ubd_kern.c line 1050

Quoted 8 lines
arch/um/drivers/ubd_kern.c renamed from arch/um/drivers/ubd_kern.c.orig +1 -1
@@ -1044,7 +1044,7 @@
 		}
 	}
 	else {
-		if(do_ubd || list_empty(&q->queue_head)) return;
+		if(do_ubd || elv_queue_empty(q)) return;
 		req = elv_next_request(q);
 		err = prepare_request(req, &io_req);
 		if(!err){

The old code was basically wrong - but Documentation/block/biodoc.txt recommends using just elv_next_request - i.e. instead of looping until elv_queue_empty(q) is true, just loop until elv_next_request returns NULL. Calling elv_queue_empty is meaningless to just check if queues are empty if we must not get a request right now, since that can save us the cost of dispatching pending requests. But this is not the case. So the code could become:

while (1) {
req = elv_next_request(q);
if (!req) break;
...}

and

if(do_ubd) return;
req = elv_next_request(q);
if (!req) return;

Any idea against / in favour of this?
Bye

Signature · 14 lines
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel