--- Begin Message ---
Hi,
Amit Uttamchandani wrote:
On Tue, Aug 20, 2013 at 09:17:16AM +0200, Jean-Pierre André wrote:
Hi,
This is a bug in ntfs_attr_truncate_solid() leading to a sparse file instead
of a file whose space is fully allocated, which occurs when the data
is resident initially. You can avoid the bug by writing 4K bytes before
calling ntfs_attr_truncate_solid(). Attached is a patch to fix the bug.
Thanks. I applied the patch and it works as expected. Regarding writing
the 4K bytes before calling the truncate, I'm guess this is the cluster
size correct? If I formatted with cluster size 65K, then I will have to
write 65K before truncating.
No, the aim is to force the data to not be stored
in the base MFT record, by writing more than a
MFT record can hold. A MFT record generally is
a full sector, with a minimum of 1K, so writing 4K
is enough for 512-byte and 4K-byte sector disks.
Can you explain why you want to allocate space without writing to that
space, and how you would use the allocated space ?
Sure. The reason is to handle large files more efficiently. Thus, the
running application knows the size of the file, so it preallocates it.
Using your patch above, the preallocation is very fast. Now, the next
step is to get the extents/runlist similar to what FS_IOC_FIEMAP returns
for ext4.
Are you writing to the allocated space sequentially
or at random locations ? With NTFS, if you want to
write to an allocated space at a random place, you
will force the unwritten space up to the write location
to be zeroed. Example :
1) Allocate 4GB : the file size is still zero, and reading
at any location from the file returns zeroes.
2) Write 4K from the beginning : the file size is now
4K and 4K bytes can be read.
3) Write a few bytes near the end : nearly 4GB has
to be zeroed.
(Note : I have not checked how Windows behaves in
such conditions)
For writing to random locations, a sparse file is
probably better.
Regards
Jean-Pierre
--- End Message ---
------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
ntfs-3g-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel