Re: [RFC PATCH] jbd2: no need to repeat in jbd2_journal_add_journal_head

From: Jan Kara
Date: Wed Jan 29 2020 - 11:20:43 EST


On Wed 29-01-20 17:57:00, Liu Song wrote:
> From: Liu Song <liu.song11@xxxxxxxxxx>
>
> In "journal_alloc_journal_head" use "GFP_NOFS | __GFP_NOFAIL"
> as the alloc flag, so it will retry until memory allocation
> is successful. Then we do not need to do extra repeat.
>
> Signed-off-by: Liu Song <liu.song11@xxxxxxxxxx>

Thanks for the patch. It looks good. You can add:

Reviewed-by: Jan Kara <jack@xxxxxxx>

Honza

> ---
> fs/jbd2/journal.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
> index 5e408ee24a1a..1a9aaf07cecd 100644
> --- a/fs/jbd2/journal.c
> +++ b/fs/jbd2/journal.c
> @@ -2503,7 +2503,6 @@ struct journal_head *jbd2_journal_add_journal_head(struct buffer_head *bh)
> struct journal_head *jh;
> struct journal_head *new_jh = NULL;
>
> -repeat:
> if (!buffer_jbd(bh))
> new_jh = journal_alloc_journal_head();
>
> @@ -2515,11 +2514,6 @@ struct journal_head *jbd2_journal_add_journal_head(struct buffer_head *bh)
> (atomic_read(&bh->b_count) > 0) ||
> (bh->b_page && bh->b_page->mapping));
>
> - if (!new_jh) {
> - jbd_unlock_bh_journal_head(bh);
> - goto repeat;
> - }
> -
> jh = new_jh;
> new_jh = NULL; /* We consumed it */
> set_buffer_jbd(bh);
> --
> 2.20.1
>
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR