lkml.org 
[lkml]   [2010]   [Oct]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 1/2] amiga floppy: Stop sharing request queue across multiple gendisks
From
On Thu, Sep 23, 2010 at 21:54, Vivek Goyal <vgoyal@redhat.com> wrote:
> o Use one request queue per gendisk instead of sharing request queue
>
> o Don't have hardware. No compile testing or run time testing done. Completely
>  untested.
>
> Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
> ---
>  drivers/block/amiflop.c |   59 ++++++++++++++++++++++++++++++++++++++--------
>  1 files changed, 48 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c
> index 76f114f..ead8b77 100644
> --- a/drivers/block/amiflop.c
> +++ b/drivers/block/amiflop.c
> @@ -114,8 +114,6 @@ static unsigned long int fd_def_df0 = FD_DD_3;     /* default for df0 if it does
>  module_param(fd_def_df0, ulong, 0);
>  MODULE_LICENSE("GPL");
>
> -static struct request_queue *floppy_queue;
> -
>  /*
>  *  Macros
>  */
> @@ -164,6 +162,7 @@ static volatile int selected = -1;  /* currently selected drive */
>  static int writepending;
>  static int writefromint;
>  static char *raw_buf;
> +static int fdc_queue;
>
>  static DEFINE_SPINLOCK(amiflop_lock);
>
> @@ -1334,6 +1333,42 @@ static int get_track(int drive, int track)
>        return -1;
>  }
>
> +/*
> + * Round-robin between our available drives, doing one request from each
> + */
> +static struct request *set_next_request(void)
> +{
> +       struct request_queue *q;
> +       int cnt = FD_MAX_UNITS;
> +       struct request *rq;
> +
> +       /* Find next queue we can dispatch from */
> +       fdc_queue = fdc_queue + 1;
> +       if (fdc_queue == FD_MAX_UNITS)
> +               fdc_queue = 0;
> +
> +       for(cnt = FD_MAX_UNITS; cnt > 0, cnt--) {
> +
> +               if (unit[fdc_queue].type->code == FD_NODRIVE) {
> +                       if (++fdc_queue == FD_MAX_UNITS)
> +                               fdc_queue = 0;
> +                       cotinue;
> +               }
> +
> +               q = unit[fdc_queue].gendisk->queue;
> +               if (q) {
> +                       rq = blk_fetch_request(q);
> +                       if (rq)
> +                               break;
> +               }
> +
> +               if (++fdc_queue == FD_MAX_UNITS)
> +                       fdc_queue = 0;
> +       }
> +
> +       return rq;
> +}

drivers/block/amiflop.c:1344: warning: ‘rq’ may be used uninitialized
in this function
drivers/block/ataflop.c:1402: warning: ‘rq’ may be used uninitialized
in this function

Should `rq' just be initialized to NULL? I looked at
floppy.c:set_next_request(), but it's
completely different.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2010-10-28 19:41    [W:0.150 / U:10.828 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site