Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Jul 2013 15:51:29 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r252956 - head/sys/fs/ext2fs
Message-ID:  <201307071551.r67FpTBu042266@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Sun Jul  7 15:51:28 2013
New Revision: 252956
URL: http://svnweb.freebsd.org/changeset/base/252956

Log:
  Implement SEEK_HOLE/SEEK_DATA for ext2fs.
  
  Merged from r236044 on UFS.
  
  MFC after:	3 days

Modified:
  head/sys/fs/ext2fs/ext2_vnops.c

Modified: head/sys/fs/ext2fs/ext2_vnops.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_vnops.c	Sun Jul  7 15:50:01 2013	(r252955)
+++ head/sys/fs/ext2fs/ext2_vnops.c	Sun Jul  7 15:51:28 2013	(r252956)
@@ -48,6 +48,7 @@
 #include <sys/systm.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>
@@ -92,6 +93,7 @@ static vop_close_t	ext2_close;
 static vop_create_t	ext2_create;
 static vop_fsync_t	ext2_fsync;
 static vop_getattr_t	ext2_getattr;
+static vop_ioctl_t	ext2_ioctl;
 static vop_link_t	ext2_link;
 static vop_mkdir_t	ext2_mkdir;
 static vop_mknod_t	ext2_mknod;
@@ -122,6 +124,7 @@ struct vop_vector ext2_vnodeops = {
 	.vop_fsync =		ext2_fsync,
 	.vop_getattr =		ext2_getattr,
 	.vop_inactive =		ext2_inactive,
+	.vop_ioctl =		ext2_ioctl,
 	.vop_link =		ext2_link,
 	.vop_lookup =		vfs_cache_lookup,
 	.vop_mkdir =		ext2_mkdir,
@@ -1427,6 +1430,9 @@ ext2_pathconf(struct vop_pathconf_args *
 	case _PC_NO_TRUNC:
 		*ap->a_retval = 1;
 		return (0);
+	case _PC_MIN_HOLE_SIZE:
+		*ap->a_retval = ap->a_vp->v_mount->mnt_stat.f_iosize;
+		return(0);
 	default:
 		return (EINVAL);
 	}
@@ -1702,6 +1708,20 @@ ext2_read(struct vop_read_args *ap)
 	return (error);
 }
 
+static int
+ext2_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);
+	}
+}
+
 /*
  * Vnode op for writing.
  */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307071551.r67FpTBu042266>