Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:iolatency_set_limit

Proto:static ssize_t iolatency_set_limit(struct kernfs_open_file *of, char *buf, size_t nbytes, loff_t off)

Type:ssize_t

Parameter:

TypeParameterName
struct kernfs_open_file *of
char *buf
size_tnbytes
loff_toff
790  blkcg = css_to_blkcg(of_css(of))
795  lat_val = 0
798  enable = 0
800  ret = lkg_conf_prep - parse and prepare for per-blkg config update*@blkcg: target block cgroup*@pol: target policy*@input: input string*@ctx: blkg_conf_ctx to be filled* Parse per-blkg config update from @input and initialize @ctx with the* result
801  If ret Then Return ret
804  iolat = blkg_to_lat(blkg)
805  p = body
807  ret = -EINVAL
808  When tok = strsep - Split a string into tokens*@s: The string to be searched*@ct: The characters to search for* strsep() updates @s to point after the token, ready for the next call.* It returns empty tokens, too, behaving exactly like the libc function cycle
812  If sscanf - Unformat a buffer into a list of arguments*@buf: input buffer*@fmt: formatting of buffer*@...: resulting arguments != 2 Then Go to out
815  If Not strcmp(key, "target") Then
818  If Not strcmp(val, "max") Then lat_val = 0
822  Else Go to out
824  Else
825  Go to out
830  blkg = blkg
831  oldval = min_lat_nsec
833  enable = rn 1 for enabling iolatency, return -1 for disabling iolatency, otherwise* return 0.
834  If enable Then
835  WARN_ON_ONCE(!blk_get_queue( Pointer to the associated request_queue ))
836  lkg_get - get a blkg reference*@blkg: blkg to get* The caller should be holding an existing reference.
839  If oldval != min_lat_nsec Then
840  iolatency_clear_scaling(blkg)
843  ret = 0
844  out :
845  lkg_conf_finish - finish up per-blkg config update*@ctx: blkg_conf_ctx intiailized by blkg_conf_prep()* Finish up after per-blkg config update. This function must be paired* with blkg_conf_prep().
846  If ret == 0 && enable Then
847  tmp = blkg_to_lat(blkg)
848  blkiolat = blkiolat
850  blk_mq_freeze_queue( Pointer to the associated request_queue )
852  If enable == 1 Then atomic_inc( & enabled)
854  Else if enable == -1 Then atomic_dec( & enabled)
856  Else WARN_ON_ONCE(1)
859  blk_mq_unfreeze_queue( Pointer to the associated request_queue )
861  lkg_put - put a blkg reference*@blkg: blkg to put
862  blk_put_queue( Pointer to the associated request_queue )
864  Return If ret Else nbytes