public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* some questions regarding the write operation on JFFS2
@ 2005-01-19  3:21 Vahid Fereydunkolahi
  2005-01-19 13:15 ` Artem B. Bityuckiy
  0 siblings, 1 reply; 9+ messages in thread
From: Vahid Fereydunkolahi @ 2005-01-19  3:21 UTC (permalink / raw)
  To: linux-mtd

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 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: some questions regarding the write operation on JFFS2
  2005-01-19  3:21 some questions regarding the write operation on JFFS2 Vahid Fereydunkolahi
@ 2005-01-19 13:15 ` Artem B. Bityuckiy
  2005-01-19 17:41   ` Vahid Fereydunkolahi
  0 siblings, 1 reply; 9+ messages in thread
From: Artem B. Bityuckiy @ 2005-01-19 13:15 UTC (permalink / raw)
  To: Vahid Fereydunkolahi; +Cc: linux-mtd

On Tue, 18 Jan 2005, Vahid Fereydunkolahi wrote:

> 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.

> 
>     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.

> 
> Thank you so much in advance,
> --vahid
You're welcome :-)

> 
> 
> 		
> __________________________________ 
> 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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: some questions regarding the write operation on JFFS2
  2005-01-19 13:15 ` Artem B. Bityuckiy
@ 2005-01-19 17:41   ` Vahid Fereydunkolahi
  2005-01-19 17:46     ` Artem B. Bityuckiy
  0 siblings, 1 reply; 9+ messages in thread
From: Vahid Fereydunkolahi @ 2005-01-19 17:41 UTC (permalink / raw)
  To: Artem B. Bityuckiy; +Cc: linux-mtd


--- "Artem B. Bityuckiy" <dedekind@infradead.org>
wrote:

> On Tue, 18 Jan 2005, Vahid Fereydunkolahi wrote:
> 
> > 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.

Does JFFS2 guarantee that if there is a partial write
then the data will be ignored? 

> 
> > 
> >     2) Does SYNC has any meaning when using the
> JFFS2.
> > As fas as I noticed the write operations are
> > forwarded 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.
> 
> > 
> > Thank you so much in advance,
> > --vahid
> You're welcome :-)
> 
> > 
> > 
> > 		
> > __________________________________ 
> > 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.
> 



		
__________________________________ 
Do you Yahoo!? 
Read only the mail you want - Yahoo! Mail SpamGuard. 
http://promotions.yahoo.com/new_mail 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: some questions regarding the write operation on JFFS2
  2005-01-19 17:41   ` Vahid Fereydunkolahi
@ 2005-01-19 17:46     ` Artem B. Bityuckiy
  2005-01-19 18:43       ` Vahid Fereydunkolahi
  0 siblings, 1 reply; 9+ messages in thread
From: Artem B. Bityuckiy @ 2005-01-19 17:46 UTC (permalink / raw)
  To: Vahid Fereydunkolahi; +Cc: MTD List

On Wed, 19 Jan 2005, Vahid Fereydunkolahi wrote:

> 
> --- "Artem B. Bityuckiy" <dedekind@infradead.org>
> wrote:
> 
> > On Tue, 18 Jan 2005, Vahid Fereydunkolahi wrote:
> > 
> > > 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.
> 
> Does JFFS2 guarantee that if there is a partial write
> then the data will be ignored? 
Yes it does.

> 
> > 
> > > 
> > >     2) Does SYNC has any meaning when using the
> > JFFS2.
> > > As fas as I noticed the write operations are
> > > forwarded 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.
> > 
> > > 
> > > Thank you so much in advance,
> > > --vahid
> > You're welcome :-)
> > 
> > > 
> > > 
> > > 		
> > > __________________________________ 
> > > 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.
> > 
> 
> 
> 
> 		
> __________________________________ 
> 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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: some questions regarding the write operation on JFFS2
  2005-01-19 17:46     ` Artem B. Bityuckiy
@ 2005-01-19 18:43       ` Vahid Fereydunkolahi
  2005-01-19 18:53         ` David Woodhouse
  2005-01-19 19:04         ` Artem B. Bityuckiy
  0 siblings, 2 replies; 9+ messages in thread
From: Vahid Fereydunkolahi @ 2005-01-19 18:43 UTC (permalink / raw)
  To: Artem B. Bityuckiy; +Cc: MTD List

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" <dedekind@infradead.org>
wrote:

> On Wed, 19 Jan 2005, Vahid Fereydunkolahi wrote:
> 
> > 
> > --- "Artem B. Bityuckiy" <dedekind@infradead.org>
> > wrote:
> > 
> > > On Tue, 18 Jan 2005, Vahid Fereydunkolahi wrote:
> > > 
> > > > 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.
> > 
> > Does JFFS2 guarantee that if there is a partial
> write
> > then the data will be ignored? 
> Yes it does.
> 
> > 
> > > 
> > > > 
> > > >     2) Does SYNC has any meaning when using
> the
> > > JFFS2.
> > > > As fas as I noticed the write operations are
> > > > forwarded 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.
> > > 
> > > > 
> > > > Thank you so much in advance,
> > > > --vahid
> > > You're welcome :-)
> > > 
> > > > 
> > > > 
> > > > 		
> > > > __________________________________ 
> > > > 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.
> > > 
> > 
> > 
> > 
> > 		
> > __________________________________ 
> > 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.
> 



		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses. 
http://promotions.yahoo.com/new_mail

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: some questions regarding the write operation on JFFS2
  2005-01-19 18:43       ` Vahid Fereydunkolahi
@ 2005-01-19 18:53         ` David Woodhouse
  2005-01-19 19:04           ` Vahid Fereydunkolahi
  2005-01-19 19:04         ` Artem B. Bityuckiy
  1 sibling, 1 reply; 9+ messages in thread
From: David Woodhouse @ 2005-01-19 18:53 UTC (permalink / raw)
  To: Vahid Fereydunkolahi; +Cc: MTD List

On Wed, 2005-01-19 at 10:43 -0800, Vahid Fereydunkolahi wrote:
> 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.

-- 
dwmw2

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: some questions regarding the write operation on JFFS2
  2005-01-19 18:43       ` Vahid Fereydunkolahi
  2005-01-19 18:53         ` David Woodhouse
@ 2005-01-19 19:04         ` Artem B. Bityuckiy
  1 sibling, 0 replies; 9+ messages in thread
From: Artem B. Bityuckiy @ 2005-01-19 19:04 UTC (permalink / raw)
  To: Vahid Fereydunkolahi; +Cc: MTD List

On Wed, 19 Jan 2005, Vahid Fereydunkolahi wrote:

> 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
> 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.

> 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.

> 
> Can this happen?
> 
> --vahid
> --- "Artem B. Bityuckiy" <dedekind@infradead.org>
> wrote:
> 
> > On Wed, 19 Jan 2005, Vahid Fereydunkolahi wrote:
> > 
> > > 
> > > --- "Artem B. Bityuckiy" <dedekind@infradead.org>
> > > wrote:
> > > 
> > > > On Tue, 18 Jan 2005, Vahid Fereydunkolahi wrote:
> > > > 
> > > > > 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.
> > > 
> > > Does JFFS2 guarantee that if there is a partial
> > write
> > > then the data will be ignored? 
> > Yes it does.
> > 
> > > 
> > > > 
> > > > > 
> > > > >     2) Does SYNC has any meaning when using
> > the
> > > > JFFS2.
> > > > > As fas as I noticed the write operations are
> > > > > forwarded 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.
> > > > 
> > > > > 
> > > > > Thank you so much in advance,
> > > > > --vahid
> > > > You're welcome :-)
> > > > 
> > > > > 
> > > > > 
> > > > > 		
> > > > > __________________________________ 
> > > > > 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.
> > > > 
> > > 
> > > 
> > > 
> > > 		
> > > __________________________________ 
> > > 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.
> > 
> 
> 
> 
> 		
> __________________________________ 
> 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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: some questions regarding the write operation on JFFS2
  2005-01-19 18:53         ` David Woodhouse
@ 2005-01-19 19:04           ` Vahid Fereydunkolahi
  2005-01-19 19:07             ` David Woodhouse
  0 siblings, 1 reply; 9+ messages in thread
From: Vahid Fereydunkolahi @ 2005-01-19 19:04 UTC (permalink / raw)
  To: David Woodhouse; +Cc: MTD List

> 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 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: some questions regarding the write operation on JFFS2
  2005-01-19 19:04           ` Vahid Fereydunkolahi
@ 2005-01-19 19:07             ` David Woodhouse
  0 siblings, 0 replies; 9+ messages in thread
From: David Woodhouse @ 2005-01-19 19:07 UTC (permalink / raw)
  To: Vahid Fereydunkolahi; +Cc: MTD List

On Wed, 2005-01-19 at 11:04 -0800, Vahid Fereydunkolahi wrote:
> 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.

-- 
dwmw2

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-01-19 19:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-19  3:21 some questions regarding the write operation on JFFS2 Vahid Fereydunkolahi
2005-01-19 13:15 ` Artem B. Bityuckiy
2005-01-19 17:41   ` Vahid Fereydunkolahi
2005-01-19 17:46     ` Artem B. Bityuckiy
2005-01-19 18:43       ` Vahid Fereydunkolahi
2005-01-19 18:53         ` David Woodhouse
2005-01-19 19:04           ` Vahid Fereydunkolahi
2005-01-19 19:07             ` David Woodhouse
2005-01-19 19:04         ` Artem B. Bityuckiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox