svn commit: r315704 - stable/11/sys/geom

Alexander Motin mav at FreeBSD.org
Wed Mar 22 07:53:58 UTC 2017


Author: mav
Date: Wed Mar 22 07:53:57 2017
New Revision: 315704
URL: https://svnweb.freebsd.org/changeset/base/315704

Log:
  MFC r314908: When chunking large DIOCGDELETE, do it on stripe edge.

Modified:
  stable/11/sys/geom/geom_dev.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/geom/geom_dev.c
==============================================================================
--- stable/11/sys/geom/geom_dev.c	Wed Mar 22 07:52:25 2017	(r315703)
+++ stable/11/sys/geom/geom_dev.c	Wed Mar 22 07:53:57 2017	(r315704)
@@ -458,7 +458,7 @@ g_dev_ioctl(struct cdev *dev, u_long cmd
 {
 	struct g_consumer *cp;
 	struct g_provider *pp;
-	off_t offset, length, chunk;
+	off_t offset, length, chunk, odd;
 	int i, error;
 
 	cp = dev->si_drv2;
@@ -518,6 +518,13 @@ g_dev_ioctl(struct cdev *dev, u_long cmd
 			    g_dev_del_max_sectors * cp->provider->sectorsize) {
 				chunk = g_dev_del_max_sectors *
 				    cp->provider->sectorsize;
+				if (cp->provider->stripesize > 0) {
+					odd = (offset + chunk +
+					    cp->provider->stripeoffset) %
+					    cp->provider->stripesize;
+					if (chunk > odd)
+						chunk -= odd;
+				}
 			}
 			error = g_delete_data(cp, offset, chunk);
 			length -= chunk;


More information about the svn-src-stable mailing list