Re: [PATCH] block: Fix front merge check
From: Jens Axboe <axboe@kernel.dk>
Date: 2016-07-21 03:38:43
On 07/13/2016 07:23 PM, Damien Le Moal wrote:
Jens, On 7/14/16 01:19, Jens Axboe wrote:quoted
On 07/12/2016 10:23 PM, Damien Le Moal wrote:quoted
For a front merge, the maximum number of sectors of the request must be checked against the front merge BIO sector, not the current sector of the request.Why does this matter? The merging should only happen before we start the request, hence rq pos and first bio should be one and the same.The block device of SMR drives is set up as chunked with the chunk size equal to the drive zone size. Since write requests directed to sequential zones cannot cross zone boundaries, both the front merge code and the back merge code must ensure that requests resulting from a merge do not cross chunk boundaries. The back merge code does this well, but the front merge code fails to prevent merging when the BIO is the last write in a zone and the request is the first write in the following (empty) zone. The check against the request LBA does not prevent the merge as the request+bio size fit in the empty zone. The check must be against the BIO LBA to detect the chunk boundary crossing.
Ah that makes sense, it's on adding the new bio, not against the existing rq->bio. Applied for 4.8. -- Jens Axboe