kernel - flag when bogus_page's are present
authorMatthew Dillon <dillon@apollo.backplane.com>
Sat, 14 Aug 2010 17:53:43 +0000 (10:53 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sat, 14 Aug 2010 17:53:43 +0000 (10:53 -0700)
* 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.

sys/kern/vfs_bio.c
sys/sys/buf.h

index 26d7a8b..13b128b 100644 (file)
@@ -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) {
                                /*
index c12bc52..ea87d42 100644 (file)
@@ -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 */