linux-um archives
 help / color / mirror / Atom feed
From: BlaisorBlade <blaisorblade_spam@yahoo.it>
To: Werner Almesberger <werner@almesberger.net>, jdike@addtoit.com
Cc: user-mode-linux-devel@lists.sourceforge.net
Subject: Re: [uml-devel] patch: use elv_queue_empty
Date: Sun, 22 Feb 2004 19:33:32 +0100	[thread overview]
Message-ID: <200402221933.32232.blaisorblade_spam@yahoo.it> (raw)
In-Reply-To: <20040208181109.G1325@almesberger.net>

Alle 22:11, domenica 8 febbraio 2004, Werner Almesberger ha scritto:
> This patch makes UBD a little more compatible with alternative
> elevators that may not use a single request queue.

> --- linux-2.6.1/arch/um/drivers/ubd_kern.c.orig	Sun Feb  8 17:16:51 2004
> +++ linux-2.6.1/arch/um/drivers/ubd_kern.c	Sun Feb  8 17:17:32 2004
> @@ -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){

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
-- 
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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

      parent reply	other threads:[~2004-02-22 19:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-08 21:11 [uml-devel] patch: use elv_queue_empty Werner Almesberger
2004-02-12 15:55 ` [uml-devel] " Jeff Dike
2004-02-22 18:33 ` BlaisorBlade [this message]

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=200402221933.32232.blaisorblade_spam@yahoo.it \
    --to=blaisorblade_spam@yahoo.it \
    --cc=jdike@addtoit.com \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    --cc=werner@almesberger.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox