Print this page
OS-881 To workaround OS-580 add support to only invalidate mappings from a single process


   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.

  24  */
  25 
  26 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  27 /*        All Rights Reserved   */
  28 
  29 /*
  30  * University Copyright- Copyright (c) 1982, 1986, 1988
  31  * The Regents of the University of California
  32  * All Rights Reserved
  33  *
  34  * University Acknowledgment- Portions of this document are derived from
  35  * software developed by the University of California, Berkeley, and its
  36  * contributors.
  37  */
  38 
  39 #ifndef _SYS_BUF_H
  40 #define _SYS_BUF_H
  41 
  42 #include <sys/types32.h>
  43 #include <sys/t_lock.h>


 169 
 170 /* Not part of the DDI */
 171 #define B_WANTED        0x0080          /* issue wakeup when BUSY goes off */
 172 #define B_AGE           0x000200        /* delayed write for correct aging */
 173 #define B_ASYNC         0x000400        /* don't wait for I/O completion */
 174 #define B_DELWRI        0x000800        /* delayed write-wait til buf needed */
 175 #define B_STALE         0x001000        /* on av_* list; invalid contents */
 176 #define B_DONTNEED      0x002000        /* after write, need not be cached */
 177 #define B_REMAPPED      0x004000        /* buffer is kernel addressable */
 178 #define B_FREE          0x008000        /* free page when done */
 179 #define B_INVAL         0x010000        /* destroy page when done */
 180 #define B_FORCE         0x020000        /* semi-permanent removal from cache */
 181 #define B_NOCACHE       0x080000        /* don't cache block when released */
 182 #define B_TRUNC         0x100000        /* truncate page without I/O */
 183 #define B_SHADOW        0x200000        /* is b_shadow field valid? */
 184 #define B_RETRYWRI      0x400000        /* retry write til works or bfinval */
 185 #define B_FAILFAST      0x1000000       /* Fail promptly if device goes away */
 186 #define B_STARTED       0x2000000       /* io:::start probe called for buf */
 187 #define B_ABRWRITE      0x4000000       /* Application based recovery active */
 188 #define B_PAGE_NOWAIT   0x8000000       /* Skip the page if it is locked */

 189 
 190 /*
 191  * There is some confusion over the meaning of B_FREE and B_INVAL and what
 192  * the use of one over the other implies.
 193  *
 194  * In both cases, when we are done with the page (buffer) we want to free
 195  * up the page.  In the case of B_FREE, the page will go to the cachelist.
 196  * In the case of B_INVAL, the page will be destroyed (hashed out of it's
 197  * vnode) and placed on the freelist.  Beyond this, there is no difference
 198  * between the sole use of these two flags.  In both cases, IO will be done
 199  * if the page is not yet committed to storage.
 200  *






 201  * In order to discard pages without writing them back, (B_INVAL | B_TRUNC)
 202  * should be used.
 203  *
 204  * Use (B_INVAL | B_FORCE) to force the page to be destroyed even if we
 205  * could not successfuly write out the page.
 206  */
 207 
 208 /*
 209  * Insq/Remq for the buffer hash lists.
 210  */
 211 #define bremhash(bp) { \
 212         ASSERT((bp)->b_forw != NULL); \
 213         ASSERT((bp)->b_back != NULL); \
 214         (bp)->b_back->b_forw = (bp)->b_forw; \
 215         (bp)->b_forw->b_back = (bp)->b_back; \
 216         (bp)->b_forw = (bp)->b_back = NULL; \
 217 }
 218 #define binshash(bp, dp) { \
 219         ASSERT((bp)->b_forw == NULL); \
 220         ASSERT((bp)->b_back == NULL); \




   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  * Copyright 2012 Joyent, Inc.  All rights reserved.
  25  */
  26 
  27 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  28 /*        All Rights Reserved   */
  29 
  30 /*
  31  * University Copyright- Copyright (c) 1982, 1986, 1988
  32  * The Regents of the University of California
  33  * All Rights Reserved
  34  *
  35  * University Acknowledgment- Portions of this document are derived from
  36  * software developed by the University of California, Berkeley, and its
  37  * contributors.
  38  */
  39 
  40 #ifndef _SYS_BUF_H
  41 #define _SYS_BUF_H
  42 
  43 #include <sys/types32.h>
  44 #include <sys/t_lock.h>


 170 
 171 /* Not part of the DDI */
 172 #define B_WANTED        0x0080          /* issue wakeup when BUSY goes off */
 173 #define B_AGE           0x000200        /* delayed write for correct aging */
 174 #define B_ASYNC         0x000400        /* don't wait for I/O completion */
 175 #define B_DELWRI        0x000800        /* delayed write-wait til buf needed */
 176 #define B_STALE         0x001000        /* on av_* list; invalid contents */
 177 #define B_DONTNEED      0x002000        /* after write, need not be cached */
 178 #define B_REMAPPED      0x004000        /* buffer is kernel addressable */
 179 #define B_FREE          0x008000        /* free page when done */
 180 #define B_INVAL         0x010000        /* destroy page when done */
 181 #define B_FORCE         0x020000        /* semi-permanent removal from cache */
 182 #define B_NOCACHE       0x080000        /* don't cache block when released */
 183 #define B_TRUNC         0x100000        /* truncate page without I/O */
 184 #define B_SHADOW        0x200000        /* is b_shadow field valid? */
 185 #define B_RETRYWRI      0x400000        /* retry write til works or bfinval */
 186 #define B_FAILFAST      0x1000000       /* Fail promptly if device goes away */
 187 #define B_STARTED       0x2000000       /* io:::start probe called for buf */
 188 #define B_ABRWRITE      0x4000000       /* Application based recovery active */
 189 #define B_PAGE_NOWAIT   0x8000000       /* Skip the page if it is locked */
 190 #define B_INVALCURONLY  0x10000000      /* invalidate only for curproc */
 191 
 192 /*
 193  * There is some confusion over the meaning of B_FREE and B_INVAL and what
 194  * the use of one over the other implies.
 195  *
 196  * In both cases, when we are done with the page (buffer) we want to free
 197  * up the page.  In the case of B_FREE, the page will go to the cachelist.
 198  * In the case of B_INVAL, the page will be destroyed (hashed out of it's
 199  * vnode) and placed on the freelist.  Beyond this, there is no difference
 200  * between the sole use of these two flags.  In both cases, IO will be done
 201  * if the page is not yet committed to storage.
 202  *
 203  * The B_INVALCURONLY flag modifies the behavior of the B_INVAL flag and is
 204  * intended to be used in conjunction with B_INVAL.  B_INVALCURONLY has no
 205  * meaning on its own.  When both B_INVALCURONLY and B_INVAL are set, then
 206  * the mapping for the page is only invalidated for the current process.
 207  * In this case, the page is not destroyed unless this was the final mapping.
 208  *
 209  * In order to discard pages without writing them back, (B_INVAL | B_TRUNC)
 210  * should be used.
 211  *
 212  * Use (B_INVAL | B_FORCE) to force the page to be destroyed even if we
 213  * could not successfuly write out the page.
 214  */
 215 
 216 /*
 217  * Insq/Remq for the buffer hash lists.
 218  */
 219 #define bremhash(bp) { \
 220         ASSERT((bp)->b_forw != NULL); \
 221         ASSERT((bp)->b_back != NULL); \
 222         (bp)->b_back->b_forw = (bp)->b_forw; \
 223         (bp)->b_forw->b_back = (bp)->b_back; \
 224         (bp)->b_forw = (bp)->b_back = NULL; \
 225 }
 226 #define binshash(bp, dp) { \
 227         ASSERT((bp)->b_forw == NULL); \
 228         ASSERT((bp)->b_back == NULL); \