mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-28 16:43:09 +00:00
Chop DIOCGDELETE from userland up in 1024 sector chunks to give geom_disk
or any other bio chopping geom a reasonable size of work. Check for delivered signals between chunks, because the request size and service time is unbounded.
This commit is contained in:
parent
bfa0795b00
commit
015a11e695
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=174674
@ -245,7 +245,7 @@ g_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread
|
||||
struct g_geom *gp;
|
||||
struct g_consumer *cp;
|
||||
struct g_kerneldump kd;
|
||||
off_t offset, length;
|
||||
off_t offset, length, chunk;
|
||||
int i, error;
|
||||
u_int u;
|
||||
|
||||
@ -308,7 +308,23 @@ g_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
error = g_delete_data(cp, offset, length);
|
||||
while (length > 0) {
|
||||
chunk = length;
|
||||
if (chunk > 1024 * cp->provider->sectorsize)
|
||||
chunk = 1024 * cp->provider->sectorsize;
|
||||
error = g_delete_data(cp, offset, chunk);
|
||||
length -= chunk;
|
||||
offset += chunk;
|
||||
if (error)
|
||||
break;
|
||||
/*
|
||||
* Since the request size is unbounded, the service
|
||||
* time is likewise. We make this ioctl interruptible
|
||||
* by checking for signals for each bio.
|
||||
*/
|
||||
if (SIGPENDING(td))
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case DIOCGIDENT:
|
||||
error = g_io_getattr("GEOM::ident", cp, &i, data);
|
||||
|
Loading…
Reference in New Issue
Block a user