Source-Changes-HG archive

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

[src/netbsd-7]: src Pull up following revision(s) (requested by manu in ticke...



details:   https://anonhg.NetBSD.org/src/rev/87ef5a233ec6
branches:  netbsd-7
changeset: 798497:87ef5a233ec6
user:      snj <snj%NetBSD.org@localhost>
date:      Wed Nov 05 18:11:30 2014 +0000

description:
Pull up following revision(s) (requested by manu in ticket #181):
        lib/libperfuse/fuse.h: revision 1.6
        lib/libperfuse/ops.c: revision 1.78
        lib/libperfuse/perfuse.c: revision 1.35
        lib/libperfuse/perfuse_priv.h: revision 1.36
        lib/libpuffs/dispatcher.c: revision 1.48
        lib/libpuffs/opdump.c: revision 1.37
        lib/libpuffs/puffs.c: revision 1.118
        lib/libpuffs/puffs.h: revision 1.126
        lib/libpuffs/puffs_ops.3: revisions 1.40-1.41
        sys/fs/puffs/puffs_msgif.h: revision 1.82-1.83
        sys/fs/puffs/puffs_msgif.h: revision 1.82
        sys/fs/puffs/puffs_vnops.c: revision 1.196
Add PUFFS support for fallocate and fdiscard operations
--
libpuffs support for fallocate and fdiscard operations
--
Add PUFFS_HAVE_FALLOCATE in puffs_msgif.h so that filesystem can decide
at build time wether fallocate is usable
--
FUSE fallocate support
There seems to be no fdiscard FUSE operation at the moment, hence that
one is left unused.

diffstat:

 lib/libperfuse/fuse.h         |  13 ++++++-
 lib/libperfuse/ops.c          |  43 ++++++++++++++++++++-
 lib/libperfuse/perfuse.c      |   5 ++-
 lib/libperfuse/perfuse_priv.h |   5 ++-
 lib/libpuffs/dispatcher.c     |  32 +++++++++++++++-
 lib/libpuffs/opdump.c         |   6 ++-
 lib/libpuffs/puffs.c          |   6 ++-
 lib/libpuffs/puffs.h          |  14 +++++-
 lib/libpuffs/puffs_ops.3      |  30 +++++++++++++-
 sys/fs/puffs/puffs_msgif.h    |  22 +++++++++--
 sys/fs/puffs/puffs_vnops.c    |  84 ++++++++++++++++++++++++++++++++++++++++--
 11 files changed, 235 insertions(+), 25 deletions(-)

diffs (truncated from 503 to 300 lines):

diff -r e5edb26c6bf1 -r 87ef5a233ec6 lib/libperfuse/fuse.h
--- a/lib/libperfuse/fuse.h     Wed Nov 05 17:57:13 2014 +0000
+++ b/lib/libperfuse/fuse.h     Wed Nov 05 18:11:30 2014 +0000
@@ -1,4 +1,4 @@
-/*  $NetBSD: fuse.h,v 1.5 2011/12/28 17:33:53 manu Exp $ */
+/*  $NetBSD: fuse.h,v 1.5.18.1 2014/11/05 18:11:30 snj Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -169,6 +169,9 @@
        FUSE_DESTROY       = 38,
        FUSE_IOCTL         = 39,
        FUSE_POLL          = 40,
+       FUSE_NOTIFY_REPLY  = 41,
+       FUSE_BATCH_FORGET  = 42,
+       FUSE_FALLOCATE     = 43,
        FUSE_OPCODE_MAX,
 
        FUSE_CUSE_INIT     = 4096
@@ -441,6 +444,14 @@
        uint64_t        kh;
 };
 
+struct fuse_fallocate_in {
+       uint64_t        fh;
+       uint64_t        offset;
+       uint64_t        length;
+       uint32_t        mode;
+       uint32_t        padding;
+};
+
 #if 0 /* Duplicated in perfuse.h to avoid making fuse.h public */
 /* Send from kernel to proces */
 struct fuse_in_header {
diff -r e5edb26c6bf1 -r 87ef5a233ec6 lib/libperfuse/ops.c
--- a/lib/libperfuse/ops.c      Wed Nov 05 17:57:13 2014 +0000
+++ b/lib/libperfuse/ops.c      Wed Nov 05 18:11:30 2014 +0000
@@ -1,4 +1,4 @@
-/*  $NetBSD: ops.c,v 1.66.2.9 2014/10/30 12:38:15 martin Exp $ */
+/*  $NetBSD: ops.c,v 1.66.2.10 2014/11/05 18:11:30 snj Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -3635,9 +3635,48 @@
        error = xchg_msg(pu, opc, pm, NO_PAYLOAD_REPLY_LEN, wait_reply);
        if (error != 0)
                goto out;
-       
+               
        ps->ps_destroy_msg(pm);
+
 out:
        node_rele(opc);
        return error;
 }
+
+int
+perfuse_node_fallocate(struct puffs_usermount *pu, puffs_cookie_t opc,
+       off_t off, off_t len)
+{
+       struct perfuse_state *ps;
+       perfuse_msg_t *pm;
+       struct fuse_fallocate_in *fai;
+       int error;
+       
+       ps = puffs_getspecific(pu);
+       if (ps->ps_flags & PS_NO_FALLOCATE)
+               return EOPNOTSUPP;
+
+       node_ref(opc);
+
+       pm = ps->ps_new_msg(pu, opc, FUSE_FALLOCATE, sizeof(*fai), NULL);
+
+       fai = GET_INPAYLOAD(ps, pm, fuse_fallocate_in);
+       fai->fh = perfuse_get_fh(opc, FWRITE);
+       fai->offset = off;
+       fai->length = len;
+       fai->mode = 0;
+               
+       error = xchg_msg(pu, opc, pm, NO_PAYLOAD_REPLY_LEN, wait_reply);
+       if (error == EOPNOTSUPP || error == ENOSYS) {
+               ps->ps_flags |= PS_NO_FALLOCATE;
+               error = EOPNOTSUPP;
+       }
+       if (error != 0)
+               goto out;
+               
+       ps->ps_destroy_msg(pm);
+
+out:
+       node_rele(opc);
+       return error;
+}
diff -r e5edb26c6bf1 -r 87ef5a233ec6 lib/libperfuse/perfuse.c
--- a/lib/libperfuse/perfuse.c  Wed Nov 05 17:57:13 2014 +0000
+++ b/lib/libperfuse/perfuse.c  Wed Nov 05 18:11:30 2014 +0000
@@ -1,4 +1,4 @@
-/*  $NetBSD: perfuse.c,v 1.31.10.2 2014/09/11 12:17:10 martin Exp $ */
+/*  $NetBSD: perfuse.c,v 1.31.10.3 2014/11/05 18:11:30 snj Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -503,6 +503,9 @@
 #ifdef PUFFS_OPEN_IO_DIRECT 
        PUFFSOP_SET(pops, perfuse, node, open2);
 #endif /* PUFFS_OPEN_IO_DIRECT */
+#ifdef PUFFS_HAVE_FALLOCATE
+       PUFFSOP_SET(pops, perfuse, node, fallocate);
+#endif /* PUFFS_HAVE_FALLOCATE */
 
        /*
         * PUFFS_KFLAG_NOCACHE_NAME is required so that we can see changes
diff -r e5edb26c6bf1 -r 87ef5a233ec6 lib/libperfuse/perfuse_priv.h
--- a/lib/libperfuse/perfuse_priv.h     Wed Nov 05 17:57:13 2014 +0000
+++ b/lib/libperfuse/perfuse_priv.h     Wed Nov 05 18:11:30 2014 +0000
@@ -1,4 +1,4 @@
-/*  $NetBSD: perfuse_priv.h,v 1.32.2.2 2014/09/12 08:13:20 martin Exp $ */
+/*  $NetBSD: perfuse_priv.h,v 1.32.2.3 2014/11/05 18:11:30 snj Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -67,6 +67,7 @@
 #define PS_NO_ACCESS   0x0001  /* access is unimplemented; */
 #define PS_NO_CREAT    0x0004  /* create is unimplemented */
 #define PS_INLOOP      0x0008  /* puffs mainloop started */
+#define PS_NO_FALLOCATE        0x0010  /* fallocate is unimplemented */
        uint64_t ps_fsid;
        uint32_t ps_max_readahead;
        uint32_t ps_max_write;
@@ -277,6 +278,8 @@
 int perfuse_node_setattr_ttl(struct puffs_usermount *,
     puffs_cookie_t, struct vattr *, const struct puffs_cred *,
     struct timespec *, int);
+int perfuse_node_fallocate(struct puffs_usermount *,
+    puffs_cookie_t, off_t, off_t);
 
 struct perfuse_trace *perfuse_trace_begin(struct perfuse_state *, 
     puffs_cookie_t, perfuse_msg_t *);
diff -r e5edb26c6bf1 -r 87ef5a233ec6 lib/libpuffs/dispatcher.c
--- a/lib/libpuffs/dispatcher.c Wed Nov 05 17:57:13 2014 +0000
+++ b/lib/libpuffs/dispatcher.c Wed Nov 05 18:11:30 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dispatcher.c,v 1.46.4.1 2014/08/24 08:42:06 martin Exp $       */
+/*     $NetBSD: dispatcher.c,v 1.46.4.2 2014/11/05 18:11:31 snj Exp $  */
 
 /*
  * Copyright (c) 2006, 2007, 2008 Antti Kantee.  All Rights Reserved.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #if !defined(lint)
-__RCSID("$NetBSD: dispatcher.c,v 1.46.4.1 2014/08/24 08:42:06 martin Exp $");
+__RCSID("$NetBSD: dispatcher.c,v 1.46.4.2 2014/11/05 18:11:31 snj Exp $");
 #endif /* !lint */
 
 #include <sys/types.h>
@@ -1140,6 +1140,34 @@
                        break;
                }
 
+               case PUFFS_VN_FALLOCATE:
+               {
+                       struct puffs_vnmsg_fallocate *auxt = auxbuf;
+
+                       if (pops->puffs_node_fallocate == NULL) {
+                               error = EOPNOTSUPP;
+                               break;
+                       }
+
+                       error = pops->puffs_node_fallocate(pu,
+                           opcookie, auxt->pvnr_off, auxt->pvnr_len);
+                       break;
+               }
+
+               case PUFFS_VN_FDISCARD:
+               {
+                       struct puffs_vnmsg_fdiscard *auxt = auxbuf;
+
+                       if (pops->puffs_node_fdiscard == NULL) {
+                               error = EOPNOTSUPP;
+                               break;
+                       }
+
+                       error = pops->puffs_node_fdiscard(pu,
+                           opcookie, auxt->pvnr_off, auxt->pvnr_len);
+                       break;
+               }
+
                default:
                        printf("inval op %d\n", preq->preq_optype);
                        error = EINVAL;
diff -r e5edb26c6bf1 -r 87ef5a233ec6 lib/libpuffs/opdump.c
--- a/lib/libpuffs/opdump.c     Wed Nov 05 17:57:13 2014 +0000
+++ b/lib/libpuffs/opdump.c     Wed Nov 05 18:11:30 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: opdump.c,v 1.36 2012/03/15 02:02:21 joerg Exp $        */
+/*     $NetBSD: opdump.c,v 1.36.10.1 2014/11/05 18:11:31 snj Exp $     */
 
 /*
  * Copyright (c) 2005, 2006  Antti Kantee.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if !defined(lint)
-__RCSID("$NetBSD: opdump.c,v 1.36 2012/03/15 02:02:21 joerg Exp $");
+__RCSID("$NetBSD: opdump.c,v 1.36.10.1 2014/11/05 18:11:31 snj Exp $");
 #endif /* !lint */
 
 #include <sys/types.h>
@@ -117,6 +117,8 @@
        "PUFFS_VN_DELETEEXTATTR",
        "PUFFS_VN_SETEXTATTR",
        "PUFFS_VN_CLOSEEXTATTR",
+       "PUFFS_VN_FALLOCATE",
+       "PUFFS_VN_FDISCARD",
 };
 size_t puffsdump_vnop_count = __arraycount(puffsdump_vnop_revmap);
 
diff -r e5edb26c6bf1 -r 87ef5a233ec6 lib/libpuffs/puffs.c
--- a/lib/libpuffs/puffs.c      Wed Nov 05 17:57:13 2014 +0000
+++ b/lib/libpuffs/puffs.c      Wed Nov 05 18:11:30 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: puffs.c,v 1.117 2011/11/14 01:27:42 chs Exp $  */
+/*     $NetBSD: puffs.c,v 1.117.18.1 2014/11/05 18:11:31 snj Exp $     */
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #if !defined(lint)
-__RCSID("$NetBSD: puffs.c,v 1.117 2011/11/14 01:27:42 chs Exp $");
+__RCSID("$NetBSD: puffs.c,v 1.117.18.1 2014/11/05 18:11:31 snj Exp $");
 #endif /* !lint */
 
 #include <sys/param.h>
@@ -106,6 +106,8 @@
        FILLOP(setextattr,  SETEXTATTR);
        FILLOP(listextattr, LISTEXTATTR);
        FILLOP(deleteextattr, DELETEEXTATTR);
+       FILLOP(fallocate, FALLOCATE);
+       FILLOP(fdiscard, FDISCARD);
 }
 #undef FILLOP
 
diff -r e5edb26c6bf1 -r 87ef5a233ec6 lib/libpuffs/puffs.h
--- a/lib/libpuffs/puffs.h      Wed Nov 05 17:57:13 2014 +0000
+++ b/lib/libpuffs/puffs.h      Wed Nov 05 18:11:30 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: puffs.h,v 1.124.10.1 2014/08/24 08:42:06 martin Exp $  */
+/*     $NetBSD: puffs.h,v 1.124.10.2 2014/11/05 18:11:31 snj Exp $     */
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -252,8 +252,12 @@
            puffs_cookie_t, int);
        int (*puffs_node_open2)(struct puffs_usermount *,
            puffs_cookie_t, int, const struct puffs_cred *, int *);
+       int (*puffs_node_fallocate)(struct puffs_usermount *,
+           puffs_cookie_t, off_t, off_t);
+       int (*puffs_node_fdiscard)(struct puffs_usermount *,
+           puffs_cookie_t, off_t, off_t);
 
-       void *puffs_ops_spare[28];
+       void *puffs_ops_spare[26];
 };
 
 typedef        int (*pu_pathbuild_fn)(struct puffs_usermount *,
@@ -414,7 +418,11 @@
        int fsname##_node_reclaim2(struct puffs_usermount *,            \
            puffs_cookie_t, int);                                       \
        int fsname##_node_open2(struct puffs_usermount *,               \
-           puffs_cookie_t, int, const struct puffs_cred *, int *);
+           puffs_cookie_t, int, const struct puffs_cred *, int *);     \
+       int fsname##_node_fallocate(struct puffs_usermount *,           \
+           puffs_cookie_t, int, off_t, off_t);                         \
+       int fsname##_node_fdiscard(struct puffs_usermount *,            \
+           puffs_cookie_t, int, off_t, off_t);
 
 
 #define PUFFSOP_INIT(ops)                                              \
diff -r e5edb26c6bf1 -r 87ef5a233ec6 lib/libpuffs/puffs_ops.3
--- a/lib/libpuffs/puffs_ops.3  Wed Nov 05 17:57:13 2014 +0000
+++ b/lib/libpuffs/puffs_ops.3  Wed Nov 05 18:11:30 2014 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: puffs_ops.3,v 1.36.10.1 2014/08/24 08:42:06 martin Exp $
+.\"    $NetBSD: puffs_ops.3,v 1.36.10.2 2014/11/05 18:11:31 snj Exp $
 .\"
 .\" Copyright (c) 2007 Antti Kantee.  All rights reserved.
 .\"
@@ -23,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd August 16, 2014
+.Dd October 31, 2014
 .Dt PUFFS_OPS 3
 .Os
 .Sh NAME
@@ -227,7 +227,17 @@



Home | Main Index | Thread Index | Old Index