UBIFS synchronisation questions about file create/delete
Hi,
I'm using UBIFS (git://git.infradead.org/~dedekind/ubifs-v2.6.27.git)
on an ARM device with OneNAND flash.
I've been reading the documentation, FAQ, ... about sync/fsync/fdatasync and the
write-back buffers, but there are still some things I don't understand.
I create a file with vi, write some data in it, close it, don't call sync. Then
after waiting 10 minutes I cut the power. When the system is restarted, the file is
not there anymore?! Is this normal behavior? Shouldn't there be at least a file of 0 bytes because "UBIFS operations which change directory entries are synchronous"?
Doesn't this mean that creating or deleting a file entry doesn't require a sync ?
Thanks,
Ronny Dierckx
Quoted 9 lines · Ronny Dierckx
Hi,
I'm using UBIFS (
git://git.infradead.org/~dedekind/ubifs-v2.6.27.git)
on an ARM device with OneNAND flash.I've been reading the documentation, FAQ, ... about sync/fsync/fdatasync and the
write-back buffers, but there are still some things I don't understand.
Quoted 8 lines
I create a file with vi, write some data in it, close it, don't call sync. Then after waiting 10 minutes I cut the power. When the system is restarted, the file is
not there anymore?! Is this normal behavior? Shouldn't there be at least a file of 0 bytes because "UBIFS operations which change directory entries are synchronous"?
Doesn't this mean that creating or deleting a file entry doesn't require a sync ?
No it is not normal behaviour.
10 minutes is long enough for everything to be written and flushed. The file should be completely intact.
No UBIFS operations which change directory entries are not entirely synchronous. There is a NAND-page-sized buffer which must be flushed. It is flushed every 5 seconds or so. Otherwise you must do some kind of sync.
I can only guess that that version of UBIFS is somehow broken.
Please send a bug report as described here:
http://www.linux-mtd.infradead.org/doc/ubifs.html#L_how_send_bugreport
but set the Default message level to 1.
Quoted 2 lines · Adrian Hunter
10 minutes is long enough for everything to be written and flushed. The file should be completely intact.
Unless laptop_mode is used. It is normally for letting disks spin down by not flushing writes quickly.
-- Jamie
Quoted 4 lines
No it is not normal behaviour.
10 minutes is long enough for everything to be written and flushed. The
file
Quoted 8 lines
should be completely intact.
No UBIFS operations which change directory entries are not entirely synchronous. There is a NAND-page-sized buffer which must be flushed. It is flushed every 5 seconds or so. Otherwise you must do some kind of sync.
I can only guess that that version of UBIFS is somehow broken.
Hi Adrian,
I tried some different versions fromgit://git.infradead.org/~dedekind/ubifs-v2.6.27.git
and the problem is caused by commit " UBIFS: fix 64-bit divisions in debug print "9d016dc4b3006ef3493b21442394028614e26da5 :
dbg_io("set timer for jhead %d, %llu millisecs", wbuf->jhead,
- ktime_to_ns(wbuf->hardlimit)/USEC_PER_SEC); - hrtimer_start(&wbuf->timer, wbuf->hardlimit, HRTIMER_MODE_REL); + div_u64(ktime_to_ns(wbuf->hardlimit), USEC_PER_SEC));
}
As you can see the timer is no longer started. Could you please fix this ?
Thanks,
Ronny Dierckx
Quoted 26 lines · Ronny Dierckx
Quoted 3 lines
No it is not normal behaviour.
10 minutes is long enough for everything to be written and flushed. The
file
Quoted 8 lines
should be completely intact.
No UBIFS operations which change directory entries are not entirely synchronous. There is a NAND-page-sized buffer which must be flushed. It is flushed every 5 seconds or so. Otherwise you must do some kind of sync.
I can only guess that that version of UBIFS is somehow broken.
Hi Adrian,
I tried some different versions from
git://git.infradead.org/~dedekind/ubifs-v2.6.27.git
and the problem is caused by commit " UBIFS: fix 64-bit divisions in debug print "9d016dc4b3006ef3493b21442394028614e26da5:dbg_io("set timer for jhead %d, %llu millisecs",
wbuf->jhead,(quoted diff) +1
-2- ktime_to_ns(wbuf->hardlimit)/USEC_PER_SEC); - hrtimer_start(&wbuf->timer, wbuf->hardlimit, HRTIMER_MODE_REL); + div_u64(ktime_to_ns(wbuf->hardlimit), USEC_PER_SEC));}
Quoted 1 line
As you can see the timer is no longer started. Could you please fix this ?
It is Artem's git tree.
Artem, can you look at this?
Quoted 12 lines · Adrian Hunter
Quoted 12 lines
I tried some different versions from
git://git.infradead.org/~dedekind/ubifs-v2.6.27.git
and the problem is caused by commit " UBIFS: fix 64-bit divisions in debug print "9d016dc4b3006ef3493b21442394028614e26da5:dbg_io("set timer for jhead %d, %llu millisecs",
wbuf->jhead,(quoted diff) +1
-2- ktime_to_ns(wbuf->hardlimit)/USEC_PER_SEC); - hrtimer_start(&wbuf->timer, wbuf->hardlimit, HRTIMER_MODE_REL); + div_u64(ktime_to_ns(wbuf->hardlimit), USEC_PER_SEC));}
Quoted 5 lines
Quoted 1 line
As you can see the timer is no longer started. Could you please fix this ?
It is Artem's git tree.
Artem, can you look at this?
Done.
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)