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

Re: [libvirt] [PATCH 4/5] Implement virDomainGetBlockInfo in QEMU driver



On Wed, Apr 28, 2010 at 11:58:15AM +0100, Daniel P. Berrange wrote:
> 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.

  Yeah I remember the issue, it was rather painful trying to do things
the Right Way actually led to a bug, fairly nasty.

> 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.

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


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