
On Tue, Apr 27, 2010 at 04:43:08PM -0600, Eric Blake wrote:
On 04/27/2010 01:35 PM, Daniel P. Berrange wrote:
* src/qemu/qemu_driver.c: Implementation of virDomainGetBlockInfo * src/util/storage_file.h: Add DEV_BSIZE * src/storage/storage_backend.c: Remove DEV_BSIZE
+ if (S_ISREG(sb.st_mode)) { +#ifndef __MINGW32__ + info->physical = (unsigned long long)sb.st_blocks * + (unsigned long long)DEV_BSIZE;
Is it worth checking sb.st_blksize rather than DEV_BSIZE on XSI systems where that is part of struct stat? In particular, POSIX allows the block size to be file-system dependent, and some file systems (like NTFS) have 4k rather than 512 as the block size (is anyone daring enough to use NTFS for raw file storage?).
This code is essentially identical to code in storage_backend.c & in the future I will unify it. We did originally use sb.st_blksize in the storage_backend.c impl, but this was not actually correct because it gives the preferred size for efficient I/O, which is not the same as the filesystem block size :-( Hence we have to hardcode 512. The commit was this one, sadly no details in the commit message, but they'll be in the mail archive somewhere: commit e807e4d9e9a766bd00a89b0a9c179edfad52773c Author: Cole Robinson <crobinso@redhat.com> Date: Fri Apr 3 14:13:02 2009 +0000 Fix sparse volume allocation reporting. Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|