Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:lk_register_queue - register a block layer queue with sysfs*@disk: Disk of which the request queue should be registered with sysfs.

Proto:int blk_register_queue(struct gendisk *disk)

Type:int

Parameter:

TypeParameterName
struct gendisk *disk
933  dev = disk_to_dev(disk)
934  q = queue
935  bool has_elevator = false
937  If WARN_ON(!q) Then Return -ENXIO
940  WARN_ONCE(blk_queue_registered(q), "%s is registering an already registered queue\n", kobject_name( & kobj))
953  If Not blk_queue_init_done(q) Then
954  lk_queue_flag_set - atomically set a queue flag*@flag: flag to be set*@q: request queue
955  percpu_ref_switch_to_percpu - switch a percpu_ref to percpu mode*@ref: percpu_ref to switch to percpu mode* There's no reason to use this function for the usual reference counting.* To re-use an expired ref, use percpu_ref_reinit().
958  ret = blk_trace_init_sysfs(dev)
959  If ret Then Return ret
962  mutex_lock( & sysfs_dir_lock)
964  ret = kobject_add() - The main kobject add function.*@kobj: the kobject to add*@parent: pointer to the parent of the kobject.*@fmt: format to name the kobject with.* The kobject name is set and added to the kobject hierarchy in this* function.
965  If ret < 0 Then
966  blk_trace_remove_sysfs(dev)
967  Go to unlock
970  ret = sysfs_create_group( & * queue kobject, & queue_attr_group)
971  If ret Then
972  blk_trace_remove_sysfs(dev)
973  kobject_del() - Unlink kobject from hierarchy.*@kobj: object.* This is the function that should be called to delete an object* successfully added via kobject_add().
974  kobject_put() - Decrement refcount for object.*@kobj: object.* Decrement the refcount, and if 0, call kobject_cleanup().
975  Go to unlock
978  If queue_is_mq(q) Then
979  __blk_mq_register_dev(dev, q)
980  blk_mq_debugfs_register(q)
983  mutex_lock( & sysfs_lock)
984  If elevator Then
985  ret = lv_register_queue is called from either blk_register_queue or* elevator_switch, elevator switch is prevented from being happen* in the two paths, so it is safe to not hold q->sysfs_lock.
986  If ret Then
992  Return ret
994  has_elevator = true
997  lk_queue_flag_set - atomically set a queue flag*@flag: flag to be set*@q: request queue
998  wbt_enable_default(q)
999  blk_throtl_register_queue(q)
1002  kobject_uevent - notify userspace by sending an uevent*@kobj: struct kobject that the action is happening to*@action: action that is happening* Returns 0 if kobject_uevent() is completed with success or the* corresponding error when it fails.
1003  If has_elevator Then kobject_uevent - notify userspace by sending an uevent*@kobj: struct kobject that the action is happening to*@action: action that is happening* Returns 0 if kobject_uevent() is completed with success or the* corresponding error when it fails.
1005  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
1007  ret = 0
1008  unlock :
1009  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
1010  Return ret
Caller
NameDescribe
__device_add_disk__device_add_disk - add disk information to kernel list*@parent: parent device for the disk*@disk: per-device partitioning information*@groups: Additional per-device sysfs groups*@register_queue: register the queue if set to true* This function registers