Re: [libvirt PATCH 1/4] util: add a helper method for controlling the COW flag on btrfs

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

 



On Thu, Jul 23, 2020 at 14:00:40 +0100, Daniel Berrange wrote:
> On Thu, Jul 23, 2020 at 02:57:32PM +0200, Peter Krempa wrote:
> > On Mon, Jul 20, 2020 at 18:33:19 +0100, Daniel Berrange wrote:
> > > btrfs defaults to performing copy-on-write for files. This is often
> > > undesirable for VM images, so we need to be able to control whether this
> > > behaviour is used.
> > > 
> > > The virFileSetCOW() will allow for this. We use a tristate, since out of
> > > the box, we want the default behaviour attempt to disable cow, but only
> > > on btrfs, silently do nothing on non-btrfs. If someone explicitly asks
> > > to disable/enable cow, then we want to raise a hard error on non-btrfs.
> > > 
> > > Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
> > > ---
> > >  src/libvirt_private.syms |  1 +
> > >  src/util/virfile.c       | 76 ++++++++++++++++++++++++++++++++++++++++
> > >  src/util/virfile.h       |  3 ++
> > >  3 files changed, 80 insertions(+)

[...]

> > > +    if (buf.f_type != BTRFS_SUPER_MAGIC) {
> > > +        if (state == VIR_TRISTATE_BOOL_ABSENT) {
> > 
> > Can't we handle the _ABSENT case before even attempting to open the
> > file?
> 
> This would require us to use statfs() instad of fstatfs() in order to
> check the super magic. I'm not seeing that improves things.

I definitely agree. But adding a function which does non-obvious things
without any comment pointing to the non-obvious behaviour isn't good
practice either.




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux