aboutsummaryrefslogtreecommitdiff
path: root/sys/geom
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2017-03-08 12:18:58 +0000
committerAlexander Motin <mav@FreeBSD.org>2017-03-08 12:18:58 +0000
commit4d5832bc128eed034f3bf91ed8e7239bc20ac381 (patch)
treef1e0c12a946d1e869219f9cb8c84e2a5f98e1cb4 /sys/geom
parent72e80cddc05ddba8364c7947ad5cf83833a4f17e (diff)
downloadsrc-4d5832bc128eed034f3bf91ed8e7239bc20ac381.tar.gz
src-4d5832bc128eed034f3bf91ed8e7239bc20ac381.zip
When chunking large DIOCGDELETE, do it on stripe edge.
MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=314908
Diffstat (limited to 'sys/geom')
-rw-r--r--sys/geom/geom_dev.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c
index 82f7d4bdb9c3..c95fc39c191c 100644
--- a/sys/geom/geom_dev.c
+++ b/sys/geom/geom_dev.c
@@ -468,7 +468,7 @@ g_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread
{
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, caddr_t data, int fflag, struct thread
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;