函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\test_rhashtable.c Create Date:2022-07-27 07:29:10
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:test_rhltable

函数原型:static int __init test_rhltable(unsigned int entries)

返回类型:int

参数:

类型参数名称
unsigned intentries
276  如果entries恒等于0则entries等于1
279  rhl_test_objects等于vzalloc(array_size() - Calculate size of 2-dimensional array.*@a: dimension one*@b: dimension two* Calculates size of 2-dimensional array: @a *@b.* Returns: number of bytes needed to represent the array or SIZE_MAX on* overflow.)
281  如果非rhl_test_objects则返回:负ENOMEM
284  ret等于负ENOMEM
285  obj_in_table等于vzalloc(array_size() - Calculate size of 2-dimensional array.*@a: dimension one*@b: dimension two* Calculates size of 2-dimensional array: @a *@b.* Returns: number of bytes needed to represent the array or SIZE_MAX on* overflow.)
287  如果非obj_in_table则转到:out_free
290  err等于hltable_init - initialize a new hash list table*@hlt: hash list table to be initialized*@params: configuration parameters* Initializes a new hash list table.* See documentation for rhashtable_init.
291  如果WARN_ON(err)则转到:out_free
294  k等于prandom_u32()
295  ret等于0
296 i小于entries循环
297  id等于k
298  err等于hltable_insert - insert object into hash list table*@hlt: hash list table*@list: pointer to hash list head inside object*@params: hash table parameters* Will take the per bucket bitlock to protect against mutual mutations* on the same bucket
300  如果WARN(err, "error %d on element %d\n", err, i)则退出
302  如果err恒等于0则set_bit - Atomically set a bit in memory*@nr: the bit to set*@addr: the address to start counting from* This is a relaxed atomic operation (no implied memory barriers).* Note that @nr may be almost arbitrarily large; this function is not
306  如果errret等于err
309  打印信息("test %d add/delete pairs into rhlist\n", entries)
310 i小于entries循环
313  struct test_obj_val key = {id = k, }
318  _read_lock() - mark the beginning of an RCU read-side critical section* When synchronize_rcu() is invoked on one CPU while other CPUs* are within RCU read-side critical sections, then the* synchronize_rcu() is guaranteed to block until after all the other
319  h等于hltable_lookup - search hash list table*@hlt: hash table*@key: the pointer to the key*@params: hash table parameters* Computes the hash value for the key and traverses the bucket chain looking* for a entry with an identical key
320  如果WARN(!h, "key not found during iteration %d of %d", i, entries)则
322  退出
325  如果i
326  j等于i减1
328  如果WARN(pos == & list_node, "old element found, should be gone")则退出
333  cond_resched_rcu()
335  found = false
338  如果pos恒等于list_node
339  found = true
340  退出
344  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
346  如果WARN(!found, "element %d not found", i)则退出
349  err等于hltable_remove - remove object from hash list table*@hlt: hash list table*@list: pointer to hash list head inside object*@params: hash table parameters* Since the hash chain is single linked, the removal operation needs to
350  WARN(err, "rhltable_remove: err %d for iteration %d\n", err, i)
351  如果err恒等于0则lear_bit - Clears a bit in memory*@nr: Bit to clear*@addr: Address to start counting from* This is a relaxed atomic operation (no implied memory barriers).
355  如果ret恒等于0且errret等于err
358 i小于entries循环
359  WARN(st_bit - Determine whether a bit is set*@nr: bit number to test*@addr: Address to start counting from, "elem %d allegedly still present", i)
361  err等于hltable_insert - insert object into hash list table*@hlt: hash list table*@list: pointer to hash list head inside object*@params: hash table parameters* Will take the per bucket bitlock to protect against mutual mutations* on the same bucket
363  如果WARN(err, "error %d on element %d\n", err, i)则退出
365  如果err恒等于0则set_bit - Atomically set a bit in memory*@nr: the bit to set*@addr: the address to start counting from* This is a relaxed atomic operation (no implied memory barriers).* Note that @nr may be almost arbitrarily large; this function is not
369  打印信息("test %d random rhlist add/delete operations\n", entries)
370 j小于entries循环
371  i等于prandom_u32_max - returns a pseudo-random number in interval [0, ep_ro)*@ep_ro: right open interval endpoint* Returns a pseudo-random number that is in interval [0, ep_ro). Note* that the result depends on PRNG being well distributed in [0, ~0U]
372  prand等于prandom_u32()
374  cond_resched()
376  如果prand恒等于0则prand等于prandom_u32()
379  如果prand按位与1则
380  prand右移等于1位
381  继续下一循环
384  err等于hltable_remove - remove object from hash list table*@hlt: hash list table*@list: pointer to hash list head inside object*@params: hash table parameters* Since the hash chain is single linked, the removal operation needs to
387  如果WARN(err, "cannot remove element at slot %d", i)则继续下一循环
389  否则
390  如果WARN(err != - ENOENT, "removed non-existent element %d, error %d not %d", i, err, - ENOENT)则继续下一循环
395  如果prand按位与1则
396  prand右移等于1位
397  继续下一循环
400  err等于hltable_insert - insert object into hash list table*@hlt: hash list table*@list: pointer to hash list head inside object*@params: hash table parameters* Will take the per bucket bitlock to protect against mutual mutations* on the same bucket
401  如果err恒等于0则
404  否则
409  如果prand按位与1则
410  prand右移等于1位
411  继续下一循环
414  i等于prandom_u32_max - returns a pseudo-random number in interval [0, ep_ro)*@ep_ro: right open interval endpoint* Returns a pseudo-random number that is in interval [0, ep_ro). Note* that the result depends on PRNG being well distributed in [0, ~0U]
417  WARN(err, "cannot remove element at slot %d", i)
420  否则
422  WARN(err, "failed to insert object %d", i)
428 i小于entries循环
429  cond_resched()
430  err等于hltable_remove - remove object from hash list table*@hlt: hash list table*@list: pointer to hash list head inside object*@params: hash table parameters* Since the hash chain is single linked, the removal operation needs to
432  如果WARN(err, "cannot remove element at slot %d", i)则继续下一循环
434  否则
435  如果WARN(err != - ENOENT, "removed non-existent element, error %d not %d", err, - ENOENT)则继续下一循环
441  rhltable_destroy( & rhlt)
442  out_free :
443  vfree(rhl_test_objects)
444  vfree(obj_in_table)
445  返回:ret
调用者
名称描述
test_rht_init