Re: [PATCH] ext4: return an error when a journal block is not mapped

From: Jan Kara

Date: Thu Oct 08 2026 - 06:11:02 EST


On Thu 08-10-26 10:32:06, Markus Elfring wrote:
> …
> > +++ b/fs/ext4/super.c
> > @@ -5967,7 +5967,7 @@ static int ext4_journal_bmap(journal_t *journal, sector_t *block)
> > "journal bmap failed: block %llu ret %d\n",
> > *block, ret);
> > jbd2_journal_abort(journal, ret ? ret : -EFSCORRUPTED);
> > - return ret;
> > + return ret ? ret : -EFSCORRUPTED;
> > }
> > *block = map.m_pblk;
> > return 0;
>
> Would you expect that an optimiser will avoid a duplicate expression here?
> How do you think about to adjust this implementation detail another bit?

I don't think we care about a duplicate expression in this path but yes,
perhaps doing:
if (!ret)
ret = -EFSCORRUPTED;
before calling jbd2_journal_abort() would be a tad bit cleaner.

Honza
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR