[dm-devel] [PATCH for-4.2 2/3] block, dm: don't copy bios for request clones

Junichi Nomura j-nomura at ce.jp.nec.com
Tue May 26 06:20:43 UTC 2015


On 05/22/15 22:14, Mike Snitzer wrote:
> From: Christoph Hellwig <hch at lst.de>
> 
> Currently dm-multipath has to clone the bios for every request sent
> to the lower devices, which wastes cpu cycles and ties down memory.
> 
> This patch instead adds a new REQ_CLONE flag that instructs req_bio_endio
> to not complete bios attached to a request, which we set on clone
> requests similar to bios in a flush sequence.  With this change I/O
> errors on a path failure only get propagated to dm-multipath, which
> can then either resubmit the I/O or complete the bios on the original
> request.
..
> @@ -128,7 +128,8 @@ static void req_bio_endio(struct request *rq, struct bio *bio,
>  	bio_advance(bio, nbytes);
>  
>  	/* don't actually finish bio if it's part of flush sequence */
> -	if (bio->bi_iter.bi_size == 0 && !(rq->cmd_flags & REQ_FLUSH_SEQ))
> +	if (bio->bi_iter.bi_size == 0 &&
> +	    !(rq->cmd_flags & (REQ_FLUSH_SEQ|REQ_CLONE)))
>  		bio_endio(bio, error);
>  }

Not completing bios is not sufficient.
If you advance the bi_iter to the end, you need to somehow rewind it
or the re-submission will be incomplete, that would end up as a data
corruption...

-- 
Jun'ichi Nomura, NEC Corporation




More information about the dm-devel mailing list