Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:adblocks_check() - check a given range for bad sectors*@bb: the badblocks structure that holds all badblock information*@s: sector (start) at which to check for badblocks*@sectors: number of sectors to check for badblocks*@first_bad: pointer to store

Proto:int badblocks_check(struct badblocks *bb, sector_t s, int sectors, sector_t *first_bad, int *bad_sectors)

Type:int

Parameter:

TypeParameterName
struct badblocks *bb
sector_ts
intsectors
sector_t *first_bad
int *bad_sectors
58  p = badblock list
60  target = s + sectors
63  If shift from sectors to block size * a -ve shift means badblocks are * disabled. > 0 Then
65  s >>= shift from sectors to block size * a -ve shift means badblocks are * disabled.
66  target += (1 << shift from sectors to block size * a -ve shift means badblocks are * disabled.) - 1
67  target >>= shift from sectors to block size * a -ve shift means badblocks are * disabled.
68  sectors = target - s
72  retry :
73  seq = Read side functions for starting and finalizing a read side section.
74  lo = 0
75  rv = 0
76  hi = count of bad blocks
86  When hi - lo > 1 cycle
87  mid = (lo + hi) / 2
88  a = BB_OFFSET(p[mid])
90  If a < target Then lo = mid
95  Else hi = mid
100  If hi > lo Then
104  When lo >= 0 && BB_OFFSET(p[lo]) + BB_LEN(p[lo]) > s cycle
106  If BB_OFFSET(p[lo]) < target Then
110  If rv != -1 && BB_ACK(p[lo]) Then rv = 1
112  Else rv = -1
114  first_bad = BB_OFFSET(p[lo])
115  bad_sectors = BB_LEN(p[lo])
117  lo--
121  If read_seqretry( & lock, seq) Then Go to retry
124  Return rv