Re: [PATCH] ide-floppy: use scatterlists for pio transfers

From: Bartlomiej Zolnierkiewicz
Date: Thu Aug 07 2008 - 13:15:45 EST


On Wednesday 06 August 2008, Borislav Petkov wrote:
> On Wed, Aug 06, 2008 at 06:05:00PM +0200, Bartlomiej Zolnierkiewicz wrote:
> >
> > Hi,
> >
> > On Tuesday 05 August 2008, Borislav Petkov wrote:
> > > Hi Bart,
> > >
> > > here's my first stab at using scatterlists in ide-floppy. I've adapted your
> > > ide-scsi version to fit in here. The change here is that i use pc->b_count as
> > > a sort-of completion counter to know when i'm at the end of the sg element and
> > > be able to switch to the next/finish transfer. I've tested the patch with the
> > > Iomega ZIP drive i have here - it works. We should do some more testing first
> > > though, before sending it upstream.
> >
> > [...]
> >
> > > @@ -569,7 +577,7 @@ static void idefloppy_create_rw_cmd(idefloppy_floppy_t *floppy,
> > > memcpy(rq->cmd, pc->c, 12);
> > >
> > > pc->rq = rq;
> > > - pc->b_count = cmd == READ ? 0 : rq->bio->bi_size;
> > > + pc->b_count = 0;
> > > if (rq->cmd_flags & REQ_RW)
> > > pc->flags |= PC_FLAG_WRITING;
> > > pc->buf = NULL;
> >
> > Don't we also need to zero pc->b_count in idefloppy_blockpc_cmd()?
> >
> > [ idefloppy_init_pc() clears whole pc so ->b_count assignment
> > to zero is not strictly necessary ]
>
> We probably should and i should've probably hit that during testing and maybe
> hit an OOPS along that path but we don't do REQ_TYPE_BLOCK_PC in ide-floppy
> yet, as it appears, and since idefloppy_blockpc_cmd() is only called when
> blk_pc_request(rq) that's why this one doesn't matter here. We should consider
> it though when we convert to using BLOCK_PC type rq's.

Unless somebody tries to use SG_IO ioctl (however I don't know if anybody has
actually ever tried so it as well may be that it hasn't worked before...).

Anyway I applied the patch and fixed pc->b_count while at it (just-in-case).
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/