1 /***************************************************************************** 2 3 Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License, version 2.0, 7 as published by the Free Software Foundation. 8 9 This program is also distributed with certain software (including 10 but not limited to OpenSSL) that is licensed under separate terms, 11 as designated in a particular file or component or in included license 12 documentation. The authors of MySQL hereby grant you an additional 13 permission to link the program and your derivative works with the 14 separately licensed software that they have included with MySQL. 15 16 This program is distributed in the hope that it will be useful, 17 but WITHOUT ANY WARRANTY; without even the implied warranty of 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 GNU General Public License, version 2.0, for more details. 20 21 You should have received a copy of the GNU General Public License along with 22 this program; if not, write to the Free Software Foundation, Inc., 23 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA 24 25 *****************************************************************************/ 26 27 /**************************************************//** 28 @file include/buf0types.h 29 The database buffer pool global types for the directory 30 31 Created 11/17/1995 Heikki Tuuri 32 *******************************************************/ 33 34 #ifndef buf0types_h 35 #define buf0types_h 36 37 #if defined(INNODB_PAGE_ATOMIC_REF_COUNT) && defined(HAVE_ATOMIC_BUILTINS) 38 #define PAGE_ATOMIC_REF_COUNT 39 #endif /* INNODB_PAGE_ATOMIC_REF_COUNT && HAVE_ATOMIC_BUILTINS */ 40 41 /** Buffer page (uncompressed or compressed) */ 42 struct buf_page_t; 43 /** Buffer block for which an uncompressed page exists */ 44 struct buf_block_t; 45 /** Buffer pool chunk comprising buf_block_t */ 46 struct buf_chunk_t; 47 /** Buffer pool comprising buf_chunk_t */ 48 struct buf_pool_t; 49 /** Buffer pool statistics struct */ 50 struct buf_pool_stat_t; 51 /** Buffer pool buddy statistics struct */ 52 struct buf_buddy_stat_t; 53 /** Doublewrite memory struct */ 54 struct buf_dblwr_t; 55 56 /** A buffer frame. @see page_t */ 57 typedef byte buf_frame_t; 58 59 /** Flags for flush types */ 60 enum buf_flush_t { 61 BUF_FLUSH_LRU = 0, /*!< flush via the LRU list */ 62 BUF_FLUSH_LIST, /*!< flush via the flush list 63 of dirty blocks */ 64 BUF_FLUSH_SINGLE_PAGE, /*!< flush via the LRU list 65 but only a single page */ 66 BUF_FLUSH_N_TYPES /*!< index of last element + 1 */ 67 }; 68 69 /** Algorithm to remove the pages for a tablespace from the buffer pool. 70 See buf_LRU_flush_or_remove_pages(). */ 71 enum buf_remove_t { 72 BUF_REMOVE_ALL_NO_WRITE, /*!< Remove all pages from the buffer 73 pool, don't write or sync to disk */ 74 BUF_REMOVE_FLUSH_NO_WRITE, /*!< Remove only, from the flush list, 75 don't write or sync to disk */ 76 BUF_REMOVE_FLUSH_WRITE /*!< Flush dirty pages to disk only 77 don't remove from the buffer pool */ 78 }; 79 80 /** Flags for io_fix types */ 81 enum buf_io_fix { 82 BUF_IO_NONE = 0, /**< no pending I/O */ 83 BUF_IO_READ, /**< read pending */ 84 BUF_IO_WRITE, /**< write pending */ 85 BUF_IO_PIN /**< disallow relocation of 86 block and its removal of from 87 the flush_list */ 88 }; 89 90 /** Alternatives for srv_checksum_algorithm, which can be changed by 91 setting innodb_checksum_algorithm */ 92 enum srv_checksum_algorithm_t { 93 SRV_CHECKSUM_ALGORITHM_CRC32, /*!< Write crc32, allow crc32, 94 innodb or none when reading */ 95 SRV_CHECKSUM_ALGORITHM_STRICT_CRC32, /*!< Write crc32, allow crc32 96 when reading */ 97 SRV_CHECKSUM_ALGORITHM_INNODB, /*!< Write innodb, allow crc32, 98 innodb or none when reading */ 99 SRV_CHECKSUM_ALGORITHM_STRICT_INNODB, /*!< Write innodb, allow 100 innodb when reading */ 101 SRV_CHECKSUM_ALGORITHM_NONE, /*!< Write none, allow crc32, 102 innodb or none when reading */ 103 SRV_CHECKSUM_ALGORITHM_STRICT_NONE /*!< Write none, allow none 104 when reading */ 105 }; 106 107 /** Parameters of binary buddy system for compressed pages (buf0buddy.h) */ 108 /* @{ */ 109 /** Zip shift value for the smallest page size */ 110 #define BUF_BUDDY_LOW_SHIFT UNIV_ZIP_SIZE_SHIFT_MIN 111 112 /** Smallest buddy page size */ 113 #define BUF_BUDDY_LOW (1U << BUF_BUDDY_LOW_SHIFT) 114 115 /** Actual number of buddy sizes based on current page size */ 116 #define BUF_BUDDY_SIZES (UNIV_PAGE_SIZE_SHIFT - BUF_BUDDY_LOW_SHIFT) 117 118 /** Maximum number of buddy sizes based on the max page size */ 119 #define BUF_BUDDY_SIZES_MAX (UNIV_PAGE_SIZE_SHIFT_MAX \ 120 - BUF_BUDDY_LOW_SHIFT) 121 122 /** twice the maximum block size of the buddy system; 123 the underlying memory is aligned by this amount: 124 this must be equal to UNIV_PAGE_SIZE */ 125 #define BUF_BUDDY_HIGH (BUF_BUDDY_LOW << BUF_BUDDY_SIZES) 126 /* @} */ 127 128 #endif /* buf0types.h */ 129