On 2/6/24 02:28, Bart Van Assche wrote:
> On 2/1/24 23:30, Damien Le Moal wrote:
>> @@ -916,9 +888,8 @@ bool blk_update_request(struct request *req, 
>> blk_status_t error,
>>      if (blk_crypto_rq_has_keyslot(req) && nr_bytes >= blk_rq_bytes(req))
>>              __blk_crypto_rq_put_keyslot(req);
>>   
>> -    if (unlikely(error && !blk_rq_is_passthrough(req) &&
>> -                 !(req->rq_flags & RQF_QUIET)) &&
>> -                 !test_bit(GD_DEAD, &req->q->disk->state)) {
>> +    if (unlikely(error && !blk_rq_is_passthrough(req) && !quiet) &&
>> +        !test_bit(GD_DEAD, &req->q->disk->state)) {
> 
> The new indentation of !test_bit(GD_DEAD, &req->q->disk->state) looks odd to 
> me ...
> 
>>              blk_print_req_error(req, error);
>>              trace_block_rq_error(req, error, nr_bytes);
>>      }
>> @@ -930,12 +901,37 @@ bool blk_update_request(struct request *req, 
>> blk_status_t error,
>>              struct bio *bio = req->bio;
>>              unsigned bio_bytes = min(bio->bi_iter.bi_size, nr_bytes);
>>   
>> -            if (bio_bytes == bio->bi_iter.bi_size)
>> +            if (unlikely(error))
>> +                    bio->bi_status = error;
>> +
>> +            if (bio_bytes == bio->bi_iter.bi_size) {
>>                      req->bio = bio->bi_next;
> 
> The behavior has been changed compared to the original code: the original code
> only tests bio_bytes if error == 0. The new code tests bio_bytes no matter 
> what
> value the 'error' variable has. Is this behavior change intentional?

No. I do not think it is a problem though since if there is an error, bio_bytes
will always be less than bio->bi_iter.bi_size. I will tweak this to restore the
previous behavior.


-- 
Damien Le Moal
Western Digital Research


Reply via email to