svn commit: r236795 - stable/9/sys/ufs/ufs

Konstantin Belousov kib at FreeBSD.org
Sat Jun 9 08:09:17 UTC 2012


Author: kib
Date: Sat Jun  9 08:09:16 2012
New Revision: 236795
URL: http://svn.freebsd.org/changeset/base/236795

Log:
  MFC r236044:
  Implement SEEK_HOLE/SEEK_DATA for UFS.

Modified:
  stable/9/sys/ufs/ufs/ufs_vnops.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/ufs/ufs/ufs_vnops.c
==============================================================================
--- stable/9/sys/ufs/ufs/ufs_vnops.c	Sat Jun  9 08:07:38 2012	(r236794)
+++ stable/9/sys/ufs/ufs/ufs_vnops.c	Sat Jun  9 08:09:16 2012	(r236795)
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/namei.h>
 #include <sys/kernel.h>
 #include <sys/fcntl.h>
+#include <sys/filio.h>
 #include <sys/stat.h>
 #include <sys/bio.h>
 #include <sys/buf.h>
@@ -104,6 +105,7 @@ static int ufs_chown(struct vnode *, uid
 static vop_close_t	ufs_close;
 static vop_create_t	ufs_create;
 static vop_getattr_t	ufs_getattr;
+static vop_ioctl_t	ufs_ioctl;
 static vop_link_t	ufs_link;
 static int ufs_makeinode(int mode, struct vnode *, struct vnode **, struct componentname *);
 static vop_markatime_t	ufs_markatime;
@@ -2513,6 +2515,9 @@ ufs_pathconf(ap)
 		*ap->a_retval = 0;
 #endif
 		break;
+	case _PC_MIN_HOLE_SIZE:
+		*ap->a_retval = ap->a_vp->v_mount->mnt_stat.f_iosize;
+		break;
 	case _PC_ASYNC_IO:
 		/* _PC_ASYNC_IO should have been handled by upper layers. */
 		KASSERT(0, ("_PC_ASYNC_IO should not get here"));
@@ -2746,6 +2751,20 @@ bad:
 	return (error);
 }
 
+static int
+ufs_ioctl(struct vop_ioctl_args *ap)
+{
+
+	switch (ap->a_command) {
+	case FIOSEEKDATA:
+	case FIOSEEKHOLE:
+		return (vn_bmap_seekhole(ap->a_vp, ap->a_command,
+		    (off_t *)ap->a_data, ap->a_cred));
+	default:
+		return (ENOTTY);
+	}
+}
+
 /* Global vfs data structures for ufs. */
 struct vop_vector ufs_vnodeops = {
 	.vop_default =		&default_vnodeops,
@@ -2760,6 +2779,7 @@ struct vop_vector ufs_vnodeops = {
 	.vop_create =		ufs_create,
 	.vop_getattr =		ufs_getattr,
 	.vop_inactive =		ufs_inactive,
+	.vop_ioctl =		ufs_ioctl,
 	.vop_link =		ufs_link,
 	.vop_lookup =		vfs_cache_lookup,
 	.vop_markatime =	ufs_markatime,


More information about the svn-src-stable-9 mailing list