From: SMTP%"dutter@platsol.com" 13-NOV-1997 17:25:03.19 To: "'Madhusudhan.Bhadri@blr.sni.de'" , "ntdev@atria.com" CC: Subj: RE: [ntdev] writethrough - Flushing to disk!!! Return-Path: owner-ntdev@atria.com Received: by arisia.gce.com (UCX V4.1-12C, OpenVMS V7.1 VAX); Thu, 13 Nov 1997 17:23:09 -0500 Received: by gw.atria.com id Thu, 13 Nov 1997 10:16:04 -0500 Received: from darkstar.bos.platsol.com by gw.atria.com id Thu, 13 Nov 1997 10:15:56 -0500 Received: from hl_78.platsol.com (cougar.bos.platsol.com [130.200.200.231]) by darkstar.bos.platsol.com (8.8.7/8.8.7) with SMTP id KAA02841; Thu, 13 Nov 1997 10:14:24 -0500 Received: by localhost with Microsoft MAPI; Thu, 13 Nov 1997 10:15:24 -0500 Message-ID: <01BCF01D.0E3E1A00.dutter@platsol.com> From: David Utter Reply-To: "dutter@platsol.com" To: "'Madhusudhan.Bhadri@blr.sni.de'" , "ntdev@atria.com" Subject: RE: [ntdev] writethrough - Flushing to disk!!! Date: Thu, 13 Nov 1997 10:15:23 -0500 Organization: Platinum technology Solutions X-Mailer: Microsoft Internet E-mail/MAPI - 8.0.0.4211 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: owner-ntdev@atria.com Precedence: bulk On a previous project, I ran into problems with the write-thru options as well (on an NTFS filesystem). After a lot of discussion and experimentation with Microsoft support engineers we came to the conclusion that just setting the FILE_FLAG_WRITE_THROUGH option in CreateFile was not sufficient. You also needed to set FILE_FLAG_NO_BUFFERING (which imposes a lot of other restrictions on how you can do I/O). Even this combination was not sufficient if you have a small file. According to the Microsoft engineers we talked to, NTFS does some optimizations for small files whereby it will put the user data into an unused part of a block containing meta-data so fewer disk blocks are needed for small files. Since the metadata is written out through a different algorithm, the user data doesn't get written through to the disk as expected. I don't recall exactly what 'small' was but I think it was around 2K. Hope this helps. ************************************************************ David Utter voice: 781-273-6420 Sr. Architect fax: 781-229-2969 PLATINUM technology Solutions email: dutter@platsol.com 8 New England Executive Park Burlington, MA 01803************************************************************ -----Original Message----- From: madhu [SMTP:Madhusudhan.Bhadri@blr.sni.de] Sent: Wednesday, November 12, 1997 11:46 PM To: ntdev@atria.com Subject: [ntdev] writethrough - Flushing to disk!!! Hi, We have a doubt in the behaviour of the NT CreateFile/OpenFile with FILE_WRITE_THROUGH option. We've 2 threads. One thread writes to the disk file and the other thread reads from the disk file. According to the Quick Ref For VC++ Ver 4.2, for "WriteFile" API, it doesn't ensure flush to disk. (It may cache it internally). Even the FlushFileBuffer doesn't seem to flush the buffer to disk. Has anybody faced this problem? Does it flush the write buffer to the disk or does it maintain an internal cache buffer and later on it flushes into the disk? We are facing a problem like the no. of bytes written to the disk (with WRITE_THROUGH_OPTION) is not consistent with another thread reading from the same file. (disk). The Read thread actually does a GetFileSize WIN32 API for that file before calling ReadFile WIN32 API. Sometimes, the FileSize obtained by GetFileSize is less than the no. of bytes written by WriteFile thread. Is there any other way to get the actual disk file size?? Waiting for a reply, Nirmala/madhu -- _________________________________________________________________ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [ To unsubscribe, send email to ntdev-request@atria.com with body UNSUBSCRIBE (the subject is ignored). ] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [ To unsubscribe, send email to ntdev-request@atria.com with body UNSUBSCRIBE (the subject is ignored). ]