some questions regarding the write operation on JFFS2
Hi All,
I traced the write operation from the Linux kernel to
the JFFS2. I have some questions:
1) Is there any chance that there could be some
partial writes on the NAND flash (if power failure happens during write operation).
2) Does SYNC has any meaning when using the JFFS2.
As fas as I noticed the write operations are formwarded to the MTD device, and they are not cached.
Thank you so much in advance,
--vahid
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail
Quoted 6 lines · Vahid Fereydunkolahi
Hi All,
I traced the write operation from the Linux kernel to
the JFFS2. I have some questions:
1) Is there any chance that there could be some
partial writes on the NAND flash (if power failure happens during write operation).
Yes, there is chance.
Quoted 4 lines
2) Does SYNC has any meaning when using the JFFS2.
As fas as I noticed the write operations are formwarded to the MTD device, and they are not cached.
For NAND JFFS2 has per-NAND page buffer, so sync flushes it. see jffs2/wbuf.c.
Quoted 3 lines
Thank you so much in advance,
--vahid
You're welcome :-)
Quoted 12 lines
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
--
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.
--- "Artem B. Bityuckiy" <[email protected]>
Quoted 11 lines · wrote:
Quoted 2 lines · Vahid Fereydunkolahi
Hi All,
I traced the write operation from the Linuxkernel to
Quoted 2 lines
the JFFS2. I have some questions:
1) Is there any chance that there could besome
Quoted 2 lines
partial writes on the NAND flash (if power failure happens during write operation).
Yes, there is chance.
Does JFFS2 guarantee that if there is a partial write then the data will be ignored?
Quoted 19 lines
Quoted 3 lines
2) Does SYNC has any meaning when using the
JFFS2.
Quoted 2 lines
As fas as I noticed the write operations are
forwarded to the MTD device, and they are notcached.
For NAND JFFS2 has per-NAND page buffer, so sync
flushes it. seejffs2/wbuf.c.Quoted 3 lines
Thank you so much in advance,
--vahidYou're welcome :-)
Quoted 3 lines
Quoted 8 lines
Quoted 3 lines
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! MailSpamGuard.
Quoted 3 lines
______________________________________________________
Quoted 3 lines
Quoted 2 lines
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Quoted 7 lines
Quoted 1 line
--
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail
Quoted 11 lines · Vahid Fereydunkolahi
--- "Artem B. Bityuckiy" <[email protected]>
Quoted 7 lines · wrote:
Quoted 2 lines · Vahid Fereydunkolahi
Hi All,
I traced the write operation from the Linuxkernel to
Quoted 2 lines
the JFFS2. I have some questions:
1) Is there any chance that there could be
Quoted 7 lines
Quoted 4 lines
some
Quoted 2 lines
partial writes on the NAND flash (if power failure happens during write operation).
Yes, there is chance.
Does JFFS2 guarantee that if there is a partial write then the data will be ignored?
Yes it does.
Quoted 44 lines
Quoted 20 lines
Quoted 4 lines
2) Does SYNC has any meaning when using the
JFFS2.
Quoted 2 lines
As fas as I noticed the write operations are
forwarded to the MTD device, and they are notcached.
For NAND JFFS2 has per-NAND page buffer, so sync
flushes it. seejffs2/wbuf.c.Quoted 3 lines
Thank you so much in advance,
--vahidYou're welcome :-)
Quoted 3 lines
Quoted 8 lines
Quoted 3 lines
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! MailSpamGuard.
Quoted 3 lines
______________________________________________________
Quoted 3 lines
Quoted 2 lines
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Quoted 7 lines
Quoted 1 line
--
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.
Quoted 5 lines
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail
--
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.
If the application calls a write system call, which is more than the VFS page size, then the VFS will break this write operation based on the size of the page. this means that JFFS2 does not have any knowledge about the
whole write operation. If power failure happens during the write operation, the data can be written partially.
Can this happen?
--vahid
--- "Artem B. Bityuckiy" <[email protected]>
Quoted 21 lines · wrote:
Quoted 13 lines · Vahid Fereydunkolahi
--- "Artem B. Bityuckiy" <[email protected]>
Quoted 9 lines · wrote:
Quoted 2 lines · Vahid Fereydunkolahi
Hi All,
I traced the write operation from the Linuxkernel to
Quoted 2 lines
the JFFS2. I have some questions:
1) Is there any chance that there could besome
Quoted 1 line
partial writes on the NAND flash (if power
failure
Quoted 4 lines
Quoted 2 lines
Quoted 1 line
happens during write operation).
Yes, there is chance.
Does JFFS2 guarantee that if there is a partial
write
Quoted 34 lines
Quoted 1 line
then the data will be ignored?
Yes it does.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
2) Does SYNC has any meaning when using
the
Quoted 25 lines
Quoted 24 lines
JFFS2.
Quoted 2 lines
As fas as I noticed the write operations are
forwarded to the MTD device, and they are notcached.
For NAND JFFS2 has per-NAND page buffer, so sync
flushes it. seejffs2/wbuf.c.Quoted 3 lines
Thank you so much in advance,
--vahidYou're welcome :-)
Quoted 6 lines
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! MailSpamGuard.
Quoted 3 lines
______________________________________________________
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Quoted 14 lines
Quoted 11 lines
Quoted 7 lines
Quoted 1 line
--
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.Quoted 3 lines
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail
Quoted 9 lines
SpamGuard.
Quoted 2 lines
--
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.
__________________________________
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail
Quoted 5 lines · Vahid Fereydunkolahi
If the application calls a write system call, which is more than the VFS page size, then the VFS will break this write operation based on the size of the page. this means that JFFS2 does not have any knowledge about the whole write operation. If power failure happens during the write operation, the data can be written partially.
Please don't top-post. Read http://david.woodhou.se/email.html
What you say is true -- the data can be written partially. This is true for all file systems, and doesn't even need a power failure -- if you ask them to write a certain amount, they may write less than that and then return.
Signature · 1 line
dwmw2
Quoted 2 lines · Vahid Fereydunkolahi
If the application calls a write system call, which is more than the VFS page size, then the VFS will break
"VFS page size" = physical mem page size = PAGE_SIZE = 4K on x86
Quoted 4 lines
this write operation based on the size of the page. this means that JFFS2 does not have any knowledge about the
whole write operation.
I fo you write X bytes and X = PAGE_SIZE + Y, Y < PAGE_SIZE, and you write to PAGE_SIZE-aligned offset in the file (0 for example), VFS will ask JFFS2 first to write PAGE_SIZE bytes, then Y bytes. Yes, JFFS2 does not know about X, only PAGE_SIZE and Y.
Quoted 3 lines
If power failure happens during
the write operation, the data can be written partially.
Yes, if JFFS2 have already written PAGE_SIZE, and then you reboots uncleanly, you will lost your Y bytes. You may reboot your board uncleanly during the fist (PAGE_SIZE) write operation, so you will lost all X bytes.
In any case, JFFS2 will ignore the partially written data when you mount it next time.
In general, it is good to think you may lost any data which you have written after mount/last fsync/syncfs.
Quoted 96 lines
Can this happen?
--vahid
--- "Artem B. Bityuckiy" <[email protected]>Quoted 21 lines · wrote:
Quoted 13 lines · Vahid Fereydunkolahi
--- "Artem B. Bityuckiy" <[email protected]>
Quoted 9 lines · wrote:
Quoted 2 lines · Vahid Fereydunkolahi
Hi All,
I traced the write operation from the Linuxkernel to
Quoted 2 lines
the JFFS2. I have some questions:
1) Is there any chance that there could besome
Quoted 1 line
partial writes on the NAND flash (if power
failure
Quoted 4 lines
Quoted 2 lines
Quoted 1 line
happens during write operation).
Yes, there is chance.
Does JFFS2 guarantee that if there is a partial
write
Quoted 34 lines
Quoted 1 line
then the data will be ignored?
Yes it does.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
2) Does SYNC has any meaning when using
the
Quoted 25 lines
Quoted 24 lines
JFFS2.
Quoted 2 lines
As fas as I noticed the write operations are
forwarded to the MTD device, and they are notcached.
For NAND JFFS2 has per-NAND page buffer, so sync
flushes it. seejffs2/wbuf.c.Quoted 3 lines
Thank you so much in advance,
--vahidYou're welcome :-)
Quoted 6 lines
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! MailSpamGuard.
Quoted 3 lines
______________________________________________________
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Quoted 14 lines
Quoted 11 lines
Quoted 7 lines
Quoted 1 line
--
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.Quoted 3 lines
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! MailQuoted 9 lines
SpamGuard.
Quoted 2 lines
--
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.
Quoted 5 lines
__________________________________
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail
--
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.
Quoted 8 lines
What you say is true -- the data can be written partially. This is true
for all file systems, and doesn't even need a power failure -- if you
ask them to write a certain amount, they may write less than that and
then return.
Does this mean that even a small write which may
bypass one page, can be written partially?
--vahid
__________________________________
Do you Yahoo!?
The all-new My Yahoo! - What will yours do?
http://my.yahoo.com
Quoted 2 lines · Vahid Fereydunkolahi
Does this mean that even a small write which may
bypass one page, can be written partially?
Yes. On _any_ file system that is a theoretical possibility. Any userspace software which assumes otherwise is broken.
Signature · 1 line
dwmw2