|
@@ -1372,17 +1372,17 @@ void pblk_pipeline_stop(struct pblk *pblk)
|
|
|
spin_unlock(&l_mg->free_lock);
|
|
|
}
|
|
|
|
|
|
-void pblk_line_replace_data(struct pblk *pblk)
|
|
|
+struct pblk_line *pblk_line_replace_data(struct pblk *pblk)
|
|
|
{
|
|
|
struct pblk_line_mgmt *l_mg = &pblk->l_mg;
|
|
|
- struct pblk_line *cur, *new;
|
|
|
+ struct pblk_line *cur, *new = NULL;
|
|
|
unsigned int left_seblks;
|
|
|
int is_next = 0;
|
|
|
|
|
|
cur = l_mg->data_line;
|
|
|
new = l_mg->data_next;
|
|
|
if (!new)
|
|
|
- return;
|
|
|
+ goto out;
|
|
|
l_mg->data_line = new;
|
|
|
|
|
|
spin_lock(&l_mg->free_lock);
|
|
@@ -1390,7 +1390,7 @@ void pblk_line_replace_data(struct pblk *pblk)
|
|
|
l_mg->data_line = NULL;
|
|
|
l_mg->data_next = NULL;
|
|
|
spin_unlock(&l_mg->free_lock);
|
|
|
- return;
|
|
|
+ goto out;
|
|
|
}
|
|
|
|
|
|
pblk_line_setup_metadata(new, l_mg, &pblk->lm);
|
|
@@ -1402,7 +1402,7 @@ retry_erase:
|
|
|
/* If line is not fully erased, erase it */
|
|
|
if (atomic_read(&new->left_eblks)) {
|
|
|
if (pblk_line_erase(pblk, new))
|
|
|
- return;
|
|
|
+ goto out;
|
|
|
} else {
|
|
|
io_schedule();
|
|
|
}
|
|
@@ -1413,7 +1413,7 @@ retry_setup:
|
|
|
if (!pblk_line_init_metadata(pblk, new, cur)) {
|
|
|
new = pblk_line_retry(pblk, new);
|
|
|
if (!new)
|
|
|
- return;
|
|
|
+ goto out;
|
|
|
|
|
|
goto retry_setup;
|
|
|
}
|
|
@@ -1421,7 +1421,7 @@ retry_setup:
|
|
|
if (!pblk_line_init_bb(pblk, new, 1)) {
|
|
|
new = pblk_line_retry(pblk, new);
|
|
|
if (!new)
|
|
|
- return;
|
|
|
+ goto out;
|
|
|
|
|
|
goto retry_setup;
|
|
|
}
|
|
@@ -1445,6 +1445,9 @@ retry_setup:
|
|
|
|
|
|
if (is_next)
|
|
|
pblk_rl_free_lines_dec(&pblk->rl, l_mg->data_next);
|
|
|
+
|
|
|
+out:
|
|
|
+ return new;
|
|
|
}
|
|
|
|
|
|
void pblk_line_free(struct pblk *pblk, struct pblk_line *line)
|