Re: [dm-devel] Re: [RFC PATCH 2/8] rqbased-dm: add block layer hook

Kiyoshi Ueda
2006-12-22T19:47:00Z

Hi Mike,

On Fri, 22 Dec 2006 01:18:44 -0600, Mike Christie <michaelc@cs.wisc.edu> wrote:
> > In addition to the suggested approach, what do you think about
> > adding a new flag to req->cmd_flags which lets the end_io() handler
> > not to return bio to upper layer?
> > It will be useful for multipathing and can be done even within
> > the current __end_that_request_first().
> > For example,
> >
> > static int __end_that_request_first()
> > {
> > .....
> > error = 0;
> > if (end_io_error(uptodate))
> > error = !uptodate ? -EIO : uptodate;
> > .....
> > if (error && (req->cmd_flags & "NEW_FLAG"))
> > return 0; /* Tell the driver to call end_that_request_last() */
> >
> > total_types = bio_nbytes = 0;
> > while ((bio = req->bio) != NULL) {
> > ..... /* process of finishing bios */
> > }
> > .....
> > }
> >
>
> Who would call end_that_request_first with the new flag set? The scsi
> layer or multipath layer?

Multipath layer sets the new flag.
SCSI layer of an underlying device calls __end_that_request_first()
for a cloned request. And original bios which were issued to a dm
device will be completed through the cloned request when no error
occurs on the clone. When an error occurs, the completion process of
the bios are skipped.

Thanks,
Kiyoshi Ueda