[Virtio-fs] [PATCH 4/4] virtiofsd: use fallocate(2) instead posix_fallocate(3)

Miklos Szeredi mszeredi at redhat.com
Wed Apr 17 14:25:36 UTC 2019


On Wed, Apr 17, 2019 at 4:05 PM Dr. David Alan Gilbert
<dgilbert at redhat.com> wrote:
>
> * Miklos Szeredi (mszeredi at redhat.com) wrote:
> > On Wed, Apr 17, 2019 at 3:18 PM Dr. David Alan Gilbert
> > <dgilbert at redhat.com> wrote:
> > >
> > > * Liu Bo (bo.liu at linux.alibaba.com) wrote:
> > > > From: Xiaoguang Wang <xiaoguang.wang at linux.alibaba.com>
> > > >
> > > > This is because posix_fallocate(3) does not support FALLOC_FL_KEEP_SIZE
> > > > and FALLOC_FL_PUNCH_HOLE. Our underlying host filesystem is ext4 and
> > > > ext4 supports FALLOC_FL_KEEP_SIZE and FALLOC_FL_PUNCH_HOLE well, so
> > > > this change will be ok.
> > > >
> > > > Signed-off-by: Xiaoguang Wang <xiaoguang.wang at linux.alibaba.com>
> > >
> > >   We need to check what 'fuse' expects - is it defined what
> > > fallocate features it has, and what the semantics are?
> >
> > The patch looks good to me.
> >
> > Fuse (the kernel part) supports FALLOC_FL_KEEP_SIZE and
> > FALLOC_FL_PUNCH_HOLE, but returns EOPNOTSUPP for any other flag.
> >
> > Even if, at a later time, fuse starts supporting additional fallocate
> > flags, then the passthrough implementation calling fallocate(2) should
> > be fine.
>
> OK, so then I'll take this patch; would it make sense for it to be sent
> to upstream fuse?

It would have to be wrapped in #ifdef HAVE_FALLOCATE to make it
portable.   Otherwise I don't see why not.

Thanks,
Miklos




More information about the Virtio-fs mailing list