Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:__alloc_disk_node

Proto:struct gendisk *__alloc_disk_node(int minors, int node_id)

Type:struct gendisk

Parameter:

TypeParameterName
intminors
intnode_id
1473  If minors > DISK_MAX_PARTS Then
1474  printk - print a kernel message*@fmt: format string* This is printk(). It can be called from any context. We want it to work.* We try to grab the console_lock. If we succeed, it's easy - we log the* output and call the console drivers
1477  minors = DISK_MAX_PARTS
1480  disk = kzalloc_node - allocate zeroed memory from a particular memory node.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).*@node: memory node from which to allocate
1481  If disk Then
1482  If Not init_part_stats( & part0) Then
1483  kfree(disk)
1484  Return NULL
1486  init_rwsem( & lookup_sem)
1487  node_id = node_id
1489  free_part_stats( & part0)
1490  kfree(disk)
1491  Return NULL
1493  ptbl = cu_dereference_protected() - fetch RCU pointer when updates prevented*@p: The pointer to read, prior to dereferencing*@c: The conditions under which the dereference will take place* Return the value of the specified RCU-protected pointer, but omit( Array of pointers to partitions indexed by partno. * Protected with matching bdev lock but stat and other * non-critical accesses use RCU. Always access through * helpers., 1)
1494  cu_assign_pointer() - assign to RCU-protected pointer*@p: pointer to assign to*@v: value to assign (publish)* Assigns the specified value to the specified RCU-protected* pointer, ensuring that any concurrent RCU readers will see* any prior initialization(part[0], & part0)
1505  seqcount_init( & nr_sects_seq)
1506  If hd_ref_init( & part0) Then
1507  hd_free_part( & part0)
1508  kfree(disk)
1509  Return NULL
1512  maximum number of minors, =1 for * disks that can't be partitioned. = minors
1513  rand_initialize_disk(disk)
1514  class = block_class
1515  type = disk_type
1516  device_initialize(disk_to_dev(disk))
1518  Return disk