Re: Wrong free clusters count on FAT32

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



OGAWA Hirofumi <[email protected]> wrote:
> DervishD <[email protected]> writes:

>>     Probably it's stupid to update the free clusters count at mount time
>> (sorry if so...) but it looks like a good idea to me. And of course, I
>> don't mean to update the value _on disk_, but the kernel's idea of free
>> clusters (so even FAT filesystems mounted R/O will report correct
>> values).
> 
> It would add the limitation to following simple usage,
> 
> # mount -t vfat /dev/sda1 /mnt
>         # cp -a * /mnt
>         # umount
> 
> if /dev/sda1 was the large and slow device, "mount" will need several
> minutes to counts free clusters. I think the user will be hard to
> accept the several minutes at "mount".

I simulated recalculating the FAT using a suboptimal perl script on my
32 GB FAT32 partition on a 40 GB drive. The results should show the worst
case for my system.

The results were below 2 seconds (optimized perl at 0.5 s) on my AMD Athlon
XP 2400+. (BTW: I don't think the device speed itself will be relevant in
many cases even if you'd asume a slow link, since you'll need to read the
FAT anyway.)

I think this is acceptable, and on this system, I'd like to enable
recalculating by default. On slower systems, you'll need to chose another
default.

I think you'll want that option as a module parameter to make all users happy.
And while you're at it, fmask and dmask are good candidates for module
parameters, too.-)


# echo 3 > /proc/sys/vm/drop_caches

# /usr/bin/time sh -c "dd if=/dev/hda2 bs=$((77834925/64)) count=4 | perl -e
'"'use POSIX;while (sysread STDIN,$x,4) {$n++ if $x eq "\0\0\0\0"} print
$n*32,"\n"'\'
4+0 records in
4+0 records out
13954720
0.76user 0.60system 0:01.95elapsed 69%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (8major+1583minor)pagefaults 0swaps

# /usr/bin/time sh -c "dd if=/dev/hda2 bs=$((77834925/64)) count=4 | perl -e
'"'use POSIX;while (sysread STDIN,$x,4) {$n++ if $x eq "\0\0\0\0"} print
$n*32,"\n"'\'
4+0 records in
4+0 records out
13955392
0.74user 0.69system 0:01.50elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+1591minor)pagefaults 0swaps

# /usr/bin/time sh -c "dd if=/dev/hda2 bs=$((77834925/64)) count=4 | perl -e
'"'use POSIX;while (sysread STDIN,$x,4096) {for (unpack "L*",$x){$n++ if !$_}}
print $n*32,"\n"'\'
4+0 records in
4+0 records out
13955392
0.43user 0.06system 0:00.50elapsed 97%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+1599minor)pagefaults 0swaps


-- 
The worse the weather, the more you are required to be out in it. 

Friß, Spammer: [email protected] [email protected]
 [email protected] [email protected]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux