Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libpuffs libpuffs support for fallocate and fdiscard ope...
details: https://anonhg.NetBSD.org/src/rev/e6052e3a2ce0
branches: trunk
changeset: 333380:e6052e3a2ce0
user: manu <manu%NetBSD.org@localhost>
date: Fri Oct 31 13:56:04 2014 +0000
description:
libpuffs support for fallocate and fdiscard operations
diffstat:
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 | 28 ++++++++++++++++++++++++++--
5 files changed, 75 insertions(+), 11 deletions(-)
diffs (192 lines):
diff -r aa3b1c3b2c6f -r e6052e3a2ce0 lib/libpuffs/dispatcher.c
--- a/lib/libpuffs/dispatcher.c Fri Oct 31 13:52:41 2014 +0000
+++ b/lib/libpuffs/dispatcher.c Fri Oct 31 13:56:04 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dispatcher.c,v 1.47 2014/08/16 16:25:44 manu Exp $ */
+/* $NetBSD: dispatcher.c,v 1.48 2014/10/31 13:56:04 manu 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.47 2014/08/16 16:25:44 manu Exp $");
+__RCSID("$NetBSD: dispatcher.c,v 1.48 2014/10/31 13:56:04 manu 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 aa3b1c3b2c6f -r e6052e3a2ce0 lib/libpuffs/opdump.c
--- a/lib/libpuffs/opdump.c Fri Oct 31 13:52:41 2014 +0000
+++ b/lib/libpuffs/opdump.c Fri Oct 31 13:56:04 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.37 2014/10/31 13:56:04 manu 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.37 2014/10/31 13:56:04 manu 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 aa3b1c3b2c6f -r e6052e3a2ce0 lib/libpuffs/puffs.c
--- a/lib/libpuffs/puffs.c Fri Oct 31 13:52:41 2014 +0000
+++ b/lib/libpuffs/puffs.c Fri Oct 31 13:56:04 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.118 2014/10/31 13:56:04 manu 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.118 2014/10/31 13:56:04 manu 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 aa3b1c3b2c6f -r e6052e3a2ce0 lib/libpuffs/puffs.h
--- a/lib/libpuffs/puffs.h Fri Oct 31 13:52:41 2014 +0000
+++ b/lib/libpuffs/puffs.h Fri Oct 31 13:56:04 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: puffs.h,v 1.125 2014/08/16 16:25:44 manu Exp $ */
+/* $NetBSD: puffs.h,v 1.126 2014/10/31 13:56:04 manu 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 aa3b1c3b2c6f -r e6052e3a2ce0 lib/libpuffs/puffs_ops.3
--- a/lib/libpuffs/puffs_ops.3 Fri Oct 31 13:52:41 2014 +0000
+++ b/lib/libpuffs/puffs_ops.3 Fri Oct 31 13:56:04 2014 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: puffs_ops.3,v 1.39 2014/10/18 08:33:23 snj Exp $
+.\" $NetBSD: puffs_ops.3,v 1.40 2014/10/31 13:56:04 manu Exp $
.\"
.\" Copyright (c) 2007 Antti Kantee. All rights reserved.
.\"
@@ -227,7 +227,17 @@
.Fa "const struct puffs_cred *pcr"
.Fc
.Ft int
-.Fn puffs_node_print "struct puffs_usermount *pu" "puffs_cookie_t opc"
+.Fo puffs_node_fallocate
+.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "off_t pos" "off_t len"
+.Fc
+.Ft int
+.Fo puffs_node_fdiscard
+.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "off_t pos" "off_t len"
+.Fc
+.Ft int
+.Fo puffs_node_print
+.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc"
+.Fc
.Ft int
.Fo puffs_node_reclaim
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc"
@@ -800,6 +810,20 @@
in which
.Dv PUFFS_WRITE_FAF
is set for Fire-And-Forget operations.
+.It Fn puffs_node_fallocate "pu" "opc" "pos" "len"
+Allocate
+.Fa len
+bytes of backing store at offset
+.Fa pos
+for the node referenced by the cookie
+.Fa opc .
+.It Fn puffs_node_fdiscard "pu" "opc" "pos" "len"
+Free
+.Fa len
+bytes of backing store (creating a hole) at offset
+.Fa pos
+for the node referenced by the cookie
+.Fa opc .
.It Fn puffs_node_print "pu" "opc"
Print information about node.
This is used only for kernel-initiated diagnostic purposes.
Home |
Main Index |
Thread Index |
Old Index