From: Matthew Dillon Date: Sat, 14 Aug 2010 17:53:43 +0000 (-0700) Subject: kernel - flag when bogus_page's are present X-Git-Tag: v2.9.0~533 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/e158420cacc687adbb028becd3750427f0f25873 kernel - flag when bogus_page's are present * Flag a buffer when bogus pages are present. Add B_HASBOGUS to b_flags. Certain in-place read operations, such as decryption, must allocate a copy if the original buffer contains bogus pages. --- diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 26d7a8b61f..13b128b0fc 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1399,6 +1399,7 @@ brelse(struct buf *bp) bp->b_xio.xio_pages[j] = mtmp; } } + bp->b_flags &= ~B_HASBOGUS; if ((bp->b_flags & B_INVAL) == 0) { pmap_qenter(trunc_page((vm_offset_t)bp->b_data), @@ -3704,6 +3705,7 @@ bpdone(struct buf *bp, int elseit) foff = (foff + PAGE_SIZE) & ~(off_t)PAGE_MASK; iosize -= resid; } + bp->b_flags &= ~B_HASBOGUS; if (obj) vm_object_pip_wakeupn(obj, 0); rel_mplock(); @@ -3839,6 +3841,7 @@ vfs_unbusy_pages(struct buf *bp) vm_page_flag_clear(m, PG_ZERO); vm_page_io_finish(m); } + bp->b_flags &= ~B_HASBOGUS; vm_object_pip_wakeupn(obj, 0); } } @@ -3962,6 +3965,7 @@ retry: * this also covers the dirty case. */ bp->b_xio.xio_pages[i] = bogus_page; + bp->b_flags |= B_HASBOGUS; bogus++; } else if (m->valid & m->dirty) { /* diff --git a/sys/sys/buf.h b/sys/sys/buf.h index c12bc52828..ea87d42ebd 100644 --- a/sys/sys/buf.h +++ b/sys/sys/buf.h @@ -293,7 +293,7 @@ struct buf { #define B_HASHED 0x00000040 /* Indexed via v_rbhash_tree */ #define B_DELWRI 0x00000080 /* Delay I/O until buffer reused. */ #define B_BNOCLIP 0x00000100 /* EOF clipping b_bcount not allowed */ -#define B_UNUSED9 0x00000200 +#define B_HASBOGUS 0x00000200 /* Contains bogus pages */ #define B_EINTR 0x00000400 /* I/O was interrupted */ #define B_ERROR 0x00000800 /* I/O error occurred. */ #define B_UNUSED12 0x00001000 /* Unused */