函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:adblocks_set() - Add a range of bad blocks to the table

函数原型:int badblocks_set(struct badblocks *bb, sector_t s, int sectors, int acknowledged)

返回类型:int

参数:

类型参数名称
struct badblocks *bb
sector_ts
intsectors
intacknowledged
168  rv等于0
171  如果 shift from sectors to block size * a -ve shift means badblocks are * disabled.小于0则返回:1
175  如果 shift from sectors to block size * a -ve shift means badblocks are * disabled.
177  next等于ssectors
179  s右移等于 shift from sectors to block size * a -ve shift means badblocks are * disabled.
180  next加等于1左移 shift from sectors to block size * a -ve shift means badblocks are * disabled.位的值减1
181  next右移等于 shift from sectors to block size * a -ve shift means badblocks are * disabled.
182  sectors等于nexts
185  write_seqlock_irqsave( & lock, flags)
187  p等于 badblock list
188  lo等于0
189  hi等于 count of bad blocks
191 hilo大于1循环
192  mid等于lohi的和除2
193  a等于BB_OFFSET(p[mid])
195  如果a小于等于slo等于mid
197  否则hi等于mid
200  如果hi大于loBB_OFFSET(p[lo])大于shi等于lo
203  如果hi大于lo
207  a等于BB_OFFSET(p[lo])
208  e等于aBB_LEN(p[lo])
209  ack等于BB_ACK(p[lo])
211  如果e大于等于s
213  如果s恒等于assectors大于等于eack等于acknowledged
216  否则ack等于ackacknowledged
219  如果e小于ssectorse等于ssectors
221  如果ea小于等于BB_MAX_LEN
222  p[lo]等于BB_MAKE(a, e - a, ack)
223  s等于e
224  否则
228  如果BB_LEN(p[lo])不等于BB_MAX_LENp[lo]等于BB_MAKE(a, BB_MAX_LEN, ack)
230  s等于aBB_MAX_LEN
232  sectors等于es
235  如果sectorshi小于 count of bad blocks
239  a等于BB_OFFSET(p[hi])
240  e等于aBB_LEN(p[hi])
241  ack等于BB_ACK(p[hi])
243  如果a小于等于ssectors
245  如果e小于等于ssectors
247  e等于ssectors
248  ack等于acknowledged
249  否则ack等于ackacknowledged
252  a等于s
253  如果ea小于等于BB_MAX_LEN
254  p[hi]等于BB_MAKE(a, e - a, ack)
255  s等于e
256  否则
257  p[hi]等于BB_MAKE(a, BB_MAX_LEN, ack)
258  s等于aBB_MAX_LEN
260  sectors等于es
261  lo等于hi
262  hi自加
265  如果sectors恒等于0且hi小于 count of bad blocks
268  a等于BB_OFFSET(p[hi])
269  lolen等于BB_LEN(p[lo])
270  hilen等于BB_LEN(p[hi])
271  newlen等于lolenhilensa
273  如果s大于等于anewlen小于BB_MAX_LEN
275  ack等于BB_ACK(p[lo])且BB_ACK(p[hi])
277  p[lo]等于BB_MAKE(BB_OFFSET(p[lo]), newlen, ack)
283 sectors循环
289  rv等于1
290  退出
291  否则
292  this_sectors等于sectors
294  memmove(p + hi + 1, p + hi, ( count of bad blocks - hi) * 8)
301  sectors减等于this_sectors
302  s加等于this_sectors
306  changed等于1
307  如果非acknowledged there probably are unacknowledged * bad blocks. This is only cleared * when a read discovers none等于1
309  否则badblocks_update_acked(bb)
311  write_sequnlock_irqrestore( & lock, flags)
313  返回:rv
调用者
名称描述
badblocks_storeadblocks_store() - sysfs access to bad-blocks list*@bb: the badblocks structure that holds all badblock information*@page: buffer received from sysfs*@len: length of data received from sysfs*@unack: weather to show unacknowledged badblocks* Return: