From manningc2@actrix.gen.nz Tue Apr 08 04:08:51 2008
Received: from smtp.firstline.co.nz ([203.167.210.162] helo=firstline.co.nz)
	by stoneboat.aleph1.co.uk with smtp (Exim 4.63)
	(envelope-from <manningc2@actrix.gen.nz>) id 1Jj4CK-0005fw-6Y
	for yaffs@lists.aleph1.co.uk; Tue, 08 Apr 2008 04:08:51 +0100
Received: (qmail 7256 invoked by uid 453); 8 Apr 2008 03:08:23 -0000
X-Virus-Checked: Checked by ClamAV on firstline.co.nz
Received: from Unknown (HELO [192.168.0.29]) (10.14.0.253)
	by firstline.co.nz (qpsmtpd/0.40) with ESMTP;
	Tue, 08 Apr 2008 15:08:23 +1200
From: Charles Manning <manningc2@actrix.gen.nz>
To: yaffs@lists.aleph1.co.uk
Date: Tue, 8 Apr 2008 15:08:22 +1200
User-Agent: KMail/1.9.6
References: <47F9C698.5060608@mizi.com>
	<200804081010.02409.manningc2@actrix.gen.nz>
	<47FAE05B.3050303@mizi.com>
In-Reply-To: <47FAE05B.3050303@mizi.com>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="euc-kr"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Message-Id: <200804081508.22696.manningc2@actrix.gen.nz>
X-SA-Exim-Connect-IP: 203.167.210.162
X-SA-Exim-Mail-From: manningc2@actrix.gen.nz
X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on
	stoneboat.aleph1.co.uk
X-Spam-Level: 
X-Spam-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_NEUTRAL
	autolearn=no version=3.2.3
X-SA-Exim-Version: 4.2.1 (built Tue, 09 Jan 2007 17:23:22 +0000)
X-SA-Exim-Scanned: Yes (on stoneboat.aleph1.co.uk)
Subject: Re: [Yaffs] mmap, power-off, and data is lost
X-BeenThere: yaffs@lists.aleph1.co.uk
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Discussion of YAFFS NAND flash filesystem <yaffs.lists.aleph1.co.uk>
List-Unsubscribe: <http://lists.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs>, 
	<mailto:yaffs-request@lists.aleph1.co.uk?subject=unsubscribe>
List-Archive: <http://lists.aleph1.co.uk/lurker/list/yaffs.html>
List-Post: <mailto:yaffs@lists.aleph1.co.uk>
List-Help: <mailto:yaffs-request@lists.aleph1.co.uk?subject=help>
List-Subscribe: <http://lists.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs>,
	<mailto:yaffs-request@lists.aleph1.co.uk?subject=subscribe>
X-List-Received-Date: Tue, 08 Apr 2008 03:08:51 -0000

On Tuesday 08 April 2008 15:02:51 Louis JANG wrote:
> Hi Charles,
>
> Charles Manning =BE=B4 =B1=DB:
> > On Monday 07 April 2008 19:00:40 Louis JANG wrote:
> >> Hi all,
> >>
> >> I'm using yaffs in several mobile platform, and using mmap interface to
> >> read/write contents of file in yaffs. it works well in normal situatio=
n,
> >> but it losts data when I turn off its power without unmount.
> >
> > With mmapping, the data lives in the page cache until it is flushed to
> > the fs.
> >
> > YAFFS will not see the data until the mmapping is flushed through. This
> > will only happen when the pages are sync'ed back to the fs  by msync() =
or
> >  when the page mapping is invalidated (page pushed out or munmap)
> >
> > As James says, msync should do what you need.
>
> I added msync before munmap, and data wasn't lost when I use MS_SYNC
> flag. I also tried with MS_ASYNC and wait about more than 10 seconds,
> but data was lost in this case.

The thing to do here is to inspect the kernel code (VFS and mmap code) and=
=20
determine what is actually happening during the MS_ASYNC case and munmap.

It could be that yaffs needs to do something on munmap, but I would have=20
expected the kernel mmap code to flush pahes on the unmap.

>
> However, the sample code invalidated mmap area by munmap already, and
> cached data should be flushed, but it wasn't. and I called sync command
> in shell also.
>
> Regards,
> Louis JANG
>
>
>
> _______________________________________________
> yaffs mailing list
> yaffs@lists.aleph1.co.uk
> http://lists.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs



