public inbox for linux-m68k@lists.linux-m68k.org
 help / color / mirror / Atom feed
From: Vivek Goyal <vgoyal@redhat.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-kernel@vger.kernel.org, axboe@kernel.dk, hch@lst.de,
	Linux/m68k <linux-m68k@vger.kernel.org>
Subject: Re: [PATCH 1/2] amiga floppy: Stop sharing request queue across multiple gendisks
Date: Thu, 28 Oct 2010 14:08:53 -0400	[thread overview]
Message-ID: <20101028180853.GF30148@redhat.com> (raw)
In-Reply-To: <AANLkTi=KDqSu8PrR2JbNzwv_Z93G6X5MRqbEiSF9hVgH@mail.gmail.com>

On Thu, Oct 28, 2010 at 07:38:33PM +0200, Geert Uytterhoeven wrote:
> 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.
> 

I think we should explicitly initialize rq=NULL so that we don't return
a garbage value if we can't find any rq to dispatch.

I will send a patch to fix that. 

Thanks
Vivek

      reply	other threads:[~2010-10-28 18:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1285271646-2768-1-git-send-email-vgoyal@redhat.com>
2010-09-23 22:35 ` [RFT PATCH] amiga, atari floppy: Use one request queue per disk Vivek Goyal
2010-09-24  0:43   ` Andreas Bombe
2010-09-24  8:57   ` Jens Axboe
2010-09-25  9:18   ` Michael Schmitz
2010-09-25 11:43     ` Vivek Goyal
2010-11-21 20:18       ` Michael Schmitz
2010-11-22  7:10         ` Michael Schmitz
     [not found] ` <1285271646-2768-2-git-send-email-vgoyal@redhat.com>
2010-10-28 17:38   ` [PATCH 1/2] amiga floppy: Stop sharing request queue across multiple gendisks Geert Uytterhoeven
2010-10-28 18:08     ` Vivek Goyal [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=20101028180853.GF30148@redhat.com \
    --to=vgoyal@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=geert@linux-m68k.org \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.org \
    /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