I have the same tool installed on Fedora 19, and I noticed in the .spec file a URL which lead to this page titled: Keeping filesystem images sparse. This page included some examples for creating test data so I ran the commands to create the corresponding files.
Example
$ dd if=/dev/zero of=fs.image bs=1024 seek=2000000 count=0
$ /sbin/mke2fs fs.image
$ ls -l fs.image
-rw-rw-r--. 1 saml saml 2048000000 Jan 4 21:42 fs.image
$ du -s fs.image
32052 fs.image
When I ran the zerofree -v command I got the following:
$ zerofree -v fs.image
...counting up percentages 0%-100%...
0/491394/500000
Interrogating with filefrag
When I used the tool filefrag to interrogate the fs.image file I got the following.
$ filefrag -v fs.image
Filesystem type is: ef53
File size of fs.image is 2048000000 (500000 blocks of 4096 bytes)
ext: logical_offset: physical_offset: length: expected: flags:
0: 0.. 620: 11714560.. 11715180: 621:
1: 32768.. 32769: 11716608.. 11716609: 2: 11715181:
2: 32892.. 33382: 11716732.. 11717222: 491: 11716610:
3: 65536.. 66026: 11722752.. 11723242: 491: 11717223:
...
The s_block_count referenced in your source code also coincided with the source code for my version of zerofree.c.
if ( verbose ) {
printf("\r%u/%u/%u\n", nonzero, free,
current_fs->super->s_blocks_count) ;
}
So we now know that s_blocks_count is the 500,000 blocks of 4096 bytes.
Interrogating with tune2fs
We can also query the image file fs.image using tune2fs.
$ sudo tune2fs -l fs.image | grep -i "block"
Block count: 500000
Reserved block count: 25000
Free blocks: 491394
First block: 0
Block size: 4096
Reserved GDT blocks: 122
Blocks per group: 32768
Inode blocks per group: 489
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
From this output we can definitely see that the 2nd and 3rd numbers being reported by zerofree are in fact:
Free blocks: 491394
Block count: 500000
Back to the source code
The 1st number being reported is in fact the number of blocks that are found that are not zero. This can be confirmed by looking at the actual source code for zerofree.
There is a counter called, nonzero which is getting incremented in the main loop that's analyzing the free blocks.
if ( i == current_fs->blocksize ) {
continue ;
}
++nonzero ;
if ( !dryrun ) {
ret = io_channel_write_blk(current_fs->io, blk, 1, empty) ;
if ( ret ) {
fprintf(stderr, "%s: error while writing block\n", argv[0]) ;
return 1 ;
}
}
Conclusion
So after some detailed analysis it would look like those numbers are as follows:
- number of nonzero free blocks encountered (which were subsequently zeroed)
- number of free blocks within the filesystem
- total number of blocks within the filesystem