Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:adblocks_clear() - Remove a range of bad blocks to the table

Proto:int badblocks_clear(struct badblocks *bb, sector_t s, int sectors)

Type:int

Parameter:

TypeParameterName
struct badblocks *bb
sector_ts
intsectors
335  target = s + sectors
336  rv = 0
338  If shift from sectors to block size * a -ve shift means badblocks are * disabled. > 0 Then
345  s += (1 << shift from sectors to block size * a -ve shift means badblocks are * disabled.) - 1
346  s >>= shift from sectors to block size * a -ve shift means badblocks are * disabled.
347  target >>= shift from sectors to block size * a -ve shift means badblocks are * disabled.
348  sectors = target - s
351  write_seqlock_irq( & lock)
353  p = badblock list
354  lo = 0
355  hi = count of bad blocks
357  When hi - lo > 1 cycle
358  mid = (lo + hi) / 2
359  a = BB_OFFSET(p[mid])
361  If a < target Then lo = mid
363  Else hi = mid
366  If hi > lo Then
371  If BB_OFFSET(p[lo]) + BB_LEN(p[lo]) > target && BB_OFFSET(p[lo]) < target Then
374  ack = BB_ACK(p[lo])
375  a = BB_OFFSET(p[lo])
376  end = a + BB_LEN(p[lo])
378  If a < s Then
389  p[lo] = BB_MAKE(target, end - target, ack)
391  hi = lo
392  lo--
394  When lo >= 0 && BB_OFFSET(p[lo]) + BB_LEN(p[lo]) > s && BB_OFFSET(p[lo]) < target cycle
398  If BB_OFFSET(p[lo]) < s Then
400  ack = BB_ACK(p[lo])
401  start = BB_OFFSET(p[lo])
403  p[lo] = BB_MAKE(start, s - start, ack)
405  Break
407  lo--
412  If hi - lo > 1 Then
413  memmove(p + lo + 1, p + hi, ( count of bad blocks - hi) * 8)
414  count of bad blocks -= hi - lo - 1
418  badblocks_update_acked(bb)
419  changed = 1
420  out :
421  write_sequnlock_irq( & lock)
422  Return rv