Page MenuHomeFreeBSD

D28899.diff
No OneTemporary

D28899.diff

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

Mime Type
text/plain
Expires
Mon, Sep 30, 11:31 AM (21 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
13181147
Default Alt Text
D28899.diff (1 KB)

Event Timeline