Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Mar 2017 07:54:29 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r315705 - stable/10/sys/geom
Message-ID:  <201703220754.v2M7sTmP086587@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Wed Mar 22 07:54:29 2017
New Revision: 315705
URL: https://svnweb.freebsd.org/changeset/base/315705

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

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

Modified: stable/10/sys/geom/geom_dev.c
==============================================================================
--- stable/10/sys/geom/geom_dev.c	Wed Mar 22 07:53:57 2017	(r315704)
+++ stable/10/sys/geom/geom_dev.c	Wed Mar 22 07:54:29 2017	(r315705)
@@ -480,7 +480,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;
@@ -540,6 +540,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?201703220754.v2M7sTmP086587>