Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:tg_with_in_bps_limit

Proto:static bool tg_with_in_bps_limit(struct throtl_grp *tg, struct bio *bio, unsigned long *wait)

Type:bool

Parameter:

TypeParameterName
struct throtl_grp *tg
struct bio *bio
unsigned long *wait
941  rw = Return the data direction, READ or WRITE.(bio)
944  bio_size = throtl_bio_data_size(bio)
946  jiffy_elapsed = jiffy_elapsed_rnd = jiffies - When did we start a new slice [rw]
949  If Not jiffy_elapsed Then jiffy_elapsed_rnd = throtl_slice
952  jiffy_elapsed_rnd = undup - round up to the next specified multiple*@x: the value to up*@y: multiple to round up to* Rounds @x up to next multiple of @y. If @y will always be a power* of 2, consider using the faster round_up().(jiffy_elapsed_rnd, throtl_slice)
954  tmp = tg_bps_limit(tg, rw) * jiffy_elapsed_rnd
955  do_div() is NOT a C function(tmp, HZ)
956  bytes_allowed = tmp
958  If Number of bytes disptached in current slice [rw] + bio_size <= bytes_allowed Then
959  If wait Then wait = 0
961  Return true
965  extra_bytes = Number of bytes disptached in current slice [rw] + bio_size - bytes_allowed
966  jiffy_wait = div64_u64 - unsigned 64bit divide with 64bit divisor*@dividend: 64bit dividend*@divisor: 64bit divisor* This implementation is a modified version of the algorithm proposed* by the book 'Hacker's Delight'. The original source and full proof
968  If Not jiffy_wait Then jiffy_wait = 1
975  jiffy_wait = jiffy_wait + jiffy_elapsed_rnd - jiffy_elapsed
976  If wait Then wait = jiffy_wait
978  Return false
Caller
NameDescribe
tg_may_dispatchReturns whether one can dispatch a bio or not. Also returns approx number* of jiffies to wait before this bio is with-in IO rate and can be dispatched