Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F112028723
D28899.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D28899.diff
View Options
diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c
--- a/sys/dev/md/md.c
+++ b/sys/dev/md/md.c
@@ -875,7 +875,7 @@
struct buf *pb;
bus_dma_segment_t *vlist;
struct thread *td;
- off_t iolen, iostart, len, zerosize;
+ off_t iolen, iostart, off, len;
int ma_offs, npages;
switch (bp->bio_cmd) {
@@ -883,9 +883,9 @@
auio.uio_rw = UIO_READ;
break;
case BIO_WRITE:
- case BIO_DELETE:
auio.uio_rw = UIO_WRITE;
break;
+ case BIO_DELETE:
case BIO_FLUSH:
break;
default:
@@ -897,6 +897,7 @@
pb = NULL;
piov = NULL;
ma_offs = bp->bio_ma_offset;
+ off = bp->bio_offset;
len = bp->bio_length;
/*
@@ -914,6 +915,11 @@
VOP_UNLOCK(vp);
vn_finished_write(mp);
return (error);
+ } else if (bp->bio_cmd == BIO_DELETE) {
+ error = vn_deallocate(vp, &off, &len, 0,
+ sc->flags & MD_ASYNC ? 0 : IO_SYNC, sc->cred, NOCRED);
+ bp->bio_resid = len;
+ return (error);
}
auio.uio_offset = (vm_ooffset_t)bp->bio_offset;
@@ -921,25 +927,7 @@
auio.uio_segflg = UIO_SYSSPACE;
auio.uio_td = td;
- if (bp->bio_cmd == BIO_DELETE) {
- /*
- * Emulate BIO_DELETE by writing zeros.
- */
- zerosize = ZERO_REGION_SIZE -
- (ZERO_REGION_SIZE % sc->sectorsize);
- auio.uio_iovcnt = howmany(bp->bio_length, zerosize);
- piov = malloc(sizeof(*piov) * auio.uio_iovcnt, M_MD, M_WAITOK);
- auio.uio_iov = piov;
- while (len > 0) {
- piov->iov_base = __DECONST(void *, zero_region);
- piov->iov_len = len;
- if (len > zerosize)
- piov->iov_len = zerosize;
- len -= piov->iov_len;
- piov++;
- }
- piov = auio.uio_iov;
- } else if ((bp->bio_flags & BIO_VLIST) != 0) {
+ if ((bp->bio_flags & BIO_VLIST) != 0) {
piov = malloc(sizeof(*piov) * bp->bio_ma_n, M_MD, M_WAITOK);
auio.uio_iov = piov;
vlist = (bus_dma_segment_t *)bp->bio_data;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 12, 7:16 PM (11 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17124735
Default Alt Text
D28899.diff (1 KB)
Attached To
Mode
D28899: md: Replace BIO_DELETE emulation with vn_deallocate(9)
Attached
Detach File
Event Timeline
Log In to Comment