[Yaffs-archive] Re: YAFFS Support added for page caching.

Luc Van Oostenryck luc.vanoostenryck@easynet.be
Thu, 22 Aug 2002 22:50:00 +0200


Charles Manning wrote:
> I don't know what this will do to robustness and I'm interested to know what 
> people experience.
> 
> IMHO: If you want robustness (eg killing power without doing a umount), stick 
> with the uncached configuration.
> 
> -- Charles
> 
> 
> On Wed, 21 Aug 2002 11:54, Charles Manning wrote:
> 
>>Hi Yaffsers
>>
>>Files checked in: yaffs_fs.c, Makefile.
>>
>>I have added support for generic read/write which uses Linux's disk
>>caching. This should (??has the potential to??) improve performance on
>>unaligned writes.
>>
>>This feature is  compile-time selectable (CONFIG_YAFFS_GENERIC_RW).  If you
>>comment out the define in the Makefile you get direct read/write. You get
>>to play & choose.
>>
>>Enjoy.
>>
>>-- Charles
>>

Yaffsers,

I have a bit played with it today and I have found that it have the same correctness
robustness as the direct way.

One minor problem is that when a file written his content is not put in the cache.
The following patchlet for yaffs_commit_write() solve it.

--- yaffs-20020821/yaffs_fs.c   Wed Aug 21 22:03:04 2002
+++ yaffs/yaffs_fs.c    Thu Aug 22 22:34:35 2002
@@ -320,27 +320,31 @@ static int yaffs_prepare_write(struct fi
  static int yaffs_commit_write(struct file *f, struct page *pg, unsigned offset, unsigned to)
  {

         void *addr = page_address(pg) + offset;
         loff_t pos = (((loff_t)pg->index) << PAGE_CACHE_SHIFT) + offset;
         int nBytes = to - offset;
         int nWritten;

         unsigned spos = pos;
         unsigned saddr = addr;

         T((KERN_DEBUG"yaffs_commit_write addr %x pos %x nBytes %d\n",saddr,spos,nBytes));

         nWritten = yaffs_file_write(f,addr, nBytes, &pos);

         if(nWritten != nBytes)
         {
                 T((KERN_DEBUG"yaffs_commit_write not same size nWritten %d  nBytes %d\n",nWritten,nBytes));
                 SetPageError(pg);
                 ClearPageUptodate(pg);
         }
+       else
+       {
+               SetPageUptodate(pg);
+       }

         T((KERN_DEBUG"yaffs_commit_write returning %d\n",nWritten));

         return nWritten;

  }



---------------------------------------------------------------------------------------
This mailing list is hosted by Toby Churchill open software (www.toby-churchill.org).
If mailing list membership is no longer wanted you can remove yourself from the list by 
sending an email to yaffs-request@toby-churchill.org with the text "unsubscribe" 
(without the quotes) as the subject.