Function report |
Source Code:block\badblocks.c |
Create Date:2022-07-28 17:24:23 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:adblocks_set() - Add a range of bad blocks to the table
Proto:int badblocks_set(struct badblocks *bb, sector_t s, int sectors, int acknowledged)
Type:int
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct badblocks * | bb | |
| sector_t | s | |
| int | sectors | |
| int | acknowledged |
| 168 | rv = 0 |
| 171 | If shift from sectors to block size * a -ve shift means badblocks are * disabled. < 0 Then Return 1 |
| 185 | write_seqlock_irqsave( & lock, flags) |
| 187 | p = badblock list |
| 188 | lo = 0 |
| 189 | hi = count of bad blocks |
| 216 | Else ack = ack && acknowledged |
| 221 | If e - a <= BB_MAX_LEN Then |
| 224 | Else |
| 228 | If BB_LEN(p[lo]) != BB_MAX_LEN Then p[lo] = BB_MAKE(a, BB_MAX_LEN, ack) |
| 230 | s = a + BB_MAX_LEN |
| 235 | If sectors && hi < count of bad blocks Then |
| 248 | ack = acknowledged |
| 249 | Else ack = ack && acknowledged |
| 253 | If e - a <= BB_MAX_LEN Then |
| 256 | Else |
| 258 | s = a + BB_MAX_LEN |
| 262 | hi++ |
| 265 | If sectors == 0 && hi < count of bad blocks Then |
| 273 | If s >= a && newlen < BB_MAX_LEN Then |
| 289 | rv = 1 |
| 290 | Break |
| 291 | Else |
| 292 | this_sectors = sectors |
| 296 | count of bad blocks ++ |
| 298 | If this_sectors > BB_MAX_LEN Then this_sectors = BB_MAX_LEN |
| 300 | p[hi] = BB_MAKE(s, this_sectors, acknowledged) |
| 301 | sectors -= this_sectors |
| 302 | s += this_sectors |
| 306 | changed = 1 |
| 307 | If Not acknowledged Then there probably are unacknowledged * bad blocks. This is only cleared * when a read discovers none = 1 |
| 309 | Else badblocks_update_acked(bb) |
| 311 | write_sequnlock_irqrestore( & lock, flags) |
| 313 | Return rv |
| Name | Describe |
|---|---|
| badblocks_store | adblocks_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: |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |