Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:block\bfq-iosched.c Create Date:2022-07-28 17:54:01
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Lifted from AS - choose which of rq1 and rq2 that is best served now.* We choose the request that is closer to the head right now. Distance* behind the head is penalized and only allowed to a certain extent.

Proto:static struct request *bfq_choose_req(struct bfq_data *bfqd, struct request *rq1, struct request *rq2, sector_t last)

Type:struct request

Parameter:

TypeParameterName
struct bfq_data *bfqd
struct request *rq1
struct request *rq2
sector_tlast
444  d1 = 0 , d2 = 0
448  wrap = 0
450  If Not rq1 || rq1 == rq2 Then Return rq2
452  If Not rq2 Then Return rq1
455  If rq_is_sync(rq1) && Not rq_is_sync(rq2) Then Return rq1
457  Else if rq_is_sync(rq2) && Not rq_is_sync(rq1) Then Return rq2
459  If op and common flags & REQ_META && Not ( op and common flags & REQ_META) Then Return rq1
461  Else if op and common flags & REQ_META && Not ( op and common flags & REQ_META) Then Return rq2
464  s1 = lk_rq_pos() : the current sector* blk_rq_bytes() : bytes left in the entire request* blk_rq_cur_bytes() : bytes left in the current segment* blk_rq_err_bytes() : bytes left till the next error boundary* blk_rq_sectors() : sectors left in the entire
465  s2 = lk_rq_pos() : the current sector* blk_rq_bytes() : bytes left in the entire request* blk_rq_cur_bytes() : bytes left in the current segment* blk_rq_err_bytes() : bytes left till the next error boundary* blk_rq_sectors() : sectors left in the entire
470  back_max = maximum allowed backward seek * 2
477  If s1 >= last Then d1 = s1 - last
479  Else if s1 + back_max >= last Then d1 = (last - s1) * weight of backward seeks wrt forward ones
481  Else wrap |= quest 1 wraps
484  If s2 >= last Then d2 = s2 - last
486  Else if s2 + back_max >= last Then d2 = (last - s2) * weight of backward seeks wrt forward ones
488  Else wrap |= quest 2 wraps
498  Case wrap == 0
499  If d1 < d2 Then Return rq1
501  Else if d2 < d1 Then Return rq2
504  If s1 >= s2 Then Return rq1
506  Else Return rq2
509  Case wrap == quest 2 wraps
510  Return rq1
511  Case wrap == quest 1 wraps
512  Return rq2
513  Case wrap == quest 1 wraps | quest 2 wraps
514  Default
521  If s1 <= s2 Then Return rq1
523  Else Return rq2
Caller
NameDescribe
bfq_find_next_rq
bfq_add_request
bfq_request_merged