Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Mar 2017 12:18:58 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r314908 - head/sys/geom
Message-ID:  <201703081218.v28CIw0t030331@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Wed Mar  8 12:18:58 2017
New Revision: 314908
URL: https://svnweb.freebsd.org/changeset/base/314908

Log:
  When chunking large DIOCGDELETE, do it on stripe edge.
  
  MFC after:	2 weeks

Modified:
  head/sys/geom/geom_dev.c

Modified: head/sys/geom/geom_dev.c
==============================================================================
--- head/sys/geom/geom_dev.c	Wed Mar  8 11:40:27 2017	(r314907)
+++ head/sys/geom/geom_dev.c	Wed Mar  8 12:18:58 2017	(r314908)
@@ -468,7 +468,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;
@@ -572,6 +572,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;



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