[Bug 14914] files are created as sparse files when they shouldn't

wine-bugs at winehq.org wine-bugs at winehq.org
Tue Jul 6 13:20:55 CDT 2010


http://bugs.winehq.org/show_bug.cgi?id=14914


Alex Y. Shalimov <ashalimov at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ashalimov at gmail.com




--- Comment #33 from Alex Y. Shalimov <ashalimov at gmail.com>  2010-07-06 13:20:54 ---
I've almost wanted to report strange Wine behavior concerning files created in
uTorrent, but then I've found this topic. So I've made a little test program.
It preallocates 512M (big enough for testing) file test.dat (you can skip this
step), and then writes 4K chunks - randomly or sequentially (also skippable).
It has several command line switches:
-prealloc-only - don't write, create file only;
-write-only - don't preallocate, write only;
-sequential-write - writes chunks sequentially instead of randomly (which is
default).

Ok, let's play a little with it.

First comes Windows (Vista). I've used Microsoft's Contig tool to see file
fragmentation. File system is NTFS with default cluster size (4K).

filetest.exe
Preallocation is instant, but several first writes takes quite a long time.
Perhaps file is mapped to the memory? The result is absolutely unfragmented
file. Yes, there's only 1 fragment. So, in this case Windows obviously
completely preallocates it. Nice work, Billy!
N.B. I performed several tests, and sometimes got more fragments, but always
less than 10.

filetest.exe -write-only -sequential-write
Writing starts immediately. File has 27 fragments. Not bad either.

filetest.exe -write-only
The hardest one for FS. No preallocation and random write. Still, file has only
189 fragments, which quite impressive (considering it has 131072 chunks).
Perhaps FILE_FLAG_RANDOM_ACCESS flag doing its job.

A word about speed: since my Windows and Linux computers are very different, I
can't compare absolute speed of file operations. I would only note that erasing
temp.dat on Windows (bypassing Recycle Bin) is always instant. Moreover, I
recently deleted 30+ gigs in several files - it also went in the twinkling of
an eye. Unfortunately, not so on Linux - erasing big files can take minutes(!)

Now let's move to our old good Wine. The system is Ubuntu 10.04, with Ext3
filesystem and default 4K cluster (most typical case nowadays, I guess). To see
file fragmentation, I'm using filefrag of course.

filetest.exe
Well... The only good news is that my random cluster number generator seems to
be truly random :-) Aside from this, the result is quite predictable: test.dat
has 131057 fragments, which is just a little better than maximal 131072. No
doubt, file wasn't preallocated. Deleting it took 0.8 sec.

filetest.exe -write-only -sequential-write
Writing faster than first time. File has just 281 fragments. Seems like it's
the best I can get with Wine. Deleting it took 0.3 sec.

filetest.exe -write-only
And again, 131071 fragments. Sad, but expected.

Bottom line. File allocation DEFINITELY works differently in Windows and Wine.
Unfortunately, Windows does it better. The difference is negligible for small
files, but is quite noticeable for big ones. And in uTorrent, we usually deal
with really BIG ones.

I also encourage everyone to perform your own tests and report your findings.

Thanks!

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list