ubifs: sync() causes writes even if nothing is changed

Artem Bityutskiy dedekind1 at gmail.com
Thu Oct 21 04:32:11 EDT 2010

On Thu, 2010-10-21 at 10:23 +0200, Sebastian Andrzej Siewior wrote:
> Artem Bityutskiy wrote:
> >> From a quick glance at the ubifs code, this might come out of the
> >> garbage collector that is triggered on every sync() and writes
> >> something even if nothing has changed.
> >>
> >> Is that really needed?
> > 
> > I briefly looked, and UBIFS is doing a lot of I/O in that case, which is
> > unnecessary and should not be done, I'll need to investigate this.
>  From what I've seen from the code there are two parts:
> - writing "unwritten" data (the write back part I guess). Nothing is done
>    here as long as no data is queued
> - writing the journal. The first step seems to be to write a node "begin
>    write" and the last one is "end write".
> Since hjk sees only two erases I would guess that they are initiated by 
> the "journal begin" & "end" requests.

Yeah, the UBIFS must be writing the commit start and commit end nodes,
and then erasing the previous log LEB (all this is done in log.c). As
soon as I have time I'll look at this, I really do not have time right
now. And there is Matthiew's problem which is actually quite big, but
for some reasons affects only him :-)

May be it is just matter of looking at all journal heads and if they are
empty, do nothing and return from ubifs_commit().

Adrian, would you help with this, may be?

Best Regards,
Artem Bityutskiy (Артём Битюцкий)

More information about the linux-mtd mailing list