Re: One more bio for for floppy users in 2.5.33..

From: Linus Torvalds (torvalds@transmeta.com)
Date: Thu Sep 05 2002 - 15:48:49 EST


Btw, the update to do partial completion will need a few more fixes: right
now the different callers of "bio->bi_end_io(bio)" are not very careful
about updating the bio information, since no bi_end_io() function has had
any reason to care before.

That turns the 2-liner patch into slightly more, since for example the
failure cases in __make_request() need to make sure that they pass in the
right size/sector count. So the

                ....
        end_io:
                bio->bi_end_io(bio);
                return 0;

would become something like

                ....
        end_io:
                bio->bi_size = 0;
                bio->bi_end_io(bio, nr_sectors);
                return 0;

if we had this interface.

To avoid those kinds of silly bugs and to avoid havind the bi_end_io()
function have to look up all the bio information, maybe the end_io calling
convention really should be

        void bio_end_io(struct bio *bio,
                unsigned int completed,
                unsigned int left,
                unsigned int uptodate);

and then a failure would just be

        bio->bi_end_io(bio, nr_sectors, 0, 0);

and the end-io function would have all the information it needs to decide
how much has been done / is left undone directly in the arguments.

One final question would be whether we would want to make all of these
byte counts, for some future networked block device where we might be
getting the completions back in odd-sized chunks, for example? Right now
much of the bio code already is able to handle byte-sized stuff, and it
might be nice to not have to maintain byte counts in NBD if the bio layer
already does it anyway..

                Linus

-
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/



This archive was generated by hypermail 2b29 : Sat Sep 07 2002 - 22:00:26 EST