ftl: replace erase_block() with a direct call to flash_erase()
This commit is contained in:
parent
b0c53116d6
commit
1c396c407a
1 changed files with 2 additions and 19 deletions
|
@ -67,24 +67,6 @@ static int find_block_div(struct ftl_journal *j)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Erases an entire block by erasing the smallest units that can be erased that
|
||||
* span the block.
|
||||
*/
|
||||
static int erase_block(struct ftl_journal *j, uint32_t block)
|
||||
{
|
||||
uint32_t pages_per_block = j->log2_block_size - j->log2_erase_size;
|
||||
uint32_t page = block << pages_per_block;
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < UINT32_C(1) << pages_per_block; ++i) {
|
||||
if (flash_erase(j->dev, page + i,
|
||||
UINT32_C(1) << j->log2_erase_size) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void reset_journal(struct ftl_journal *j)
|
||||
{
|
||||
j->log2_erase_size = ilog2(4 * KIB);
|
||||
|
@ -578,7 +560,8 @@ static int prepare_head(struct ftl_journal *j)
|
|||
if (free_tail(j) < 0)
|
||||
return -1;
|
||||
|
||||
return erase_block(j, j->head >> log2_pages_per_block);
|
||||
return flash_erase(j->dev, j->head >> log2_pages_per_block,
|
||||
j->log2_block_size);
|
||||
}
|
||||
|
||||
/* Prepares the head for writing, writes the user page to the current available
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue