• Jens Axboe's avatar
    [PATCH] partial bio completion notification · 392aaa18
    Jens Axboe authored
    Make bio->bi_end_io() take bytes_done and actual error as argument. This
    enables partial completion of bio's, which is important for latency
    reasons (bio can be huge, for slow media we want page-by-page
    completions).
    
    I think I got most of the bi_end_io() functions out there, but I might
    have missed a few. For the record, if you don't care about partial
    completions and just want to be notified when the entire bio completes,
    add a
    
    	if (bio->bi_size)
    		return 1;
    
    to the top of your bi_end_io(). It should return 0 on completion.
    bio_endio() will decrement bio->bi_size appropriately, it's recommended
    for people to go through that. Otherwise they will have to control
    BIO_UPTODATE and bi_size decrement themselves, there's really no reason
    to do that. I've deliberately avoided doing any functional changes to
    any of the end_io functions, as I think that would only make the patch
    more complex. It's simple right now, but this being i/o paths I prefer
    (as usual) to be careful and take small steps. The mpage_end_io_read()
    do-vecs-at-the-time change can come right after this, for instance.
    392aaa18
page_io.c 3.93 KB