Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F140786725
D28899.id86187.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.id86187.diff
View Options
Index: sys/dev/md/md.c
===================================================================
--- sys/dev/md/md.c
+++ sys/dev/md/md.c
@@ -877,7 +877,7 @@
struct buf *pb;
bus_dma_segment_t *vlist;
struct thread *td;
- off_t iolen, iostart, len, zerosize;
+ off_t iolen, iostart, len;
int ma_offs, npages;
switch (bp->bio_cmd) {
@@ -885,9 +885,8 @@
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:
@@ -916,6 +915,10 @@
VOP_UNLOCK(vp);
vn_finished_write(mp);
return (error);
+ } else if (bp->bio_cmd == BIO_DELETE) {
+ error = vn_deallocate(vp, bp->bio_offset, bp->bio_length, 0, 0,
+ sc->cred, NOCRED, td);
+ return (error);
}
auio.uio_offset = (vm_ooffset_t)bp->bio_offset;
@@ -923,25 +926,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
Mon, Dec 29, 1:03 AM (1 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27347936
Default Alt Text
D28899.id86187.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