~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/include/buf0buddy.h

  • Committer: Lee Bieber
  • Date: 2010-11-07 19:34:48 UTC
  • mfrom: (1910.1.2 build)
  • Revision ID: kalebral@gmail.com-20101107193448-64kdu912qej354sh
Merge Stewart - including adapting and expanding the "differences from mysql" page from the wiki.
Merge Stewart - fix bug 668143: drizzleslap with --commit runs second iteration data load in a transaction

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (C) 2006, 2009, Innobase Oy. All Rights Reserved.
 
3
Copyright (c) 2006, 2009, Innobase Oy. All Rights Reserved.
4
4
 
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
36
36
 
37
37
/**********************************************************************//**
38
38
Allocate a block.  The thread calling this function must hold
39
 
buf_pool->mutex and must not hold buf_pool->zip_mutex or any
40
 
block->mutex.  The buf_pool->mutex may only be released and reacquired
 
39
buf_pool_mutex and must not hold buf_pool_zip_mutex or any
 
40
block->mutex.  The buf_pool_mutex may only be released and reacquired
41
41
if lru != NULL.  This function should only be used for allocating
42
42
compressed page frames or control blocks (buf_page_t).  Allocated
43
43
control blocks must be properly initialized immediately after
44
44
buf_buddy_alloc() has returned the memory, before releasing
45
 
buf_pool->mutex.
 
45
buf_pool_mutex.
46
46
@return allocated block, possibly NULL if lru == NULL */
47
47
UNIV_INLINE
48
48
void*
49
49
buf_buddy_alloc(
50
50
/*============*/
51
 
        buf_pool_t*     buf_pool,
52
 
                        /*!< buffer pool in which the block resides */
53
51
        ulint   size,   /*!< in: block size, up to UNIV_PAGE_SIZE */
54
52
        ibool*  lru)    /*!< in: pointer to a variable that will be assigned
55
53
                        TRUE if storage was allocated from the LRU list
56
 
                        and buf_pool->mutex was temporarily released,
 
54
                        and buf_pool_mutex was temporarily released,
57
55
                        or NULL if the LRU list should not be used */
58
56
        __attribute__((malloc));
59
57
 
63
61
void
64
62
buf_buddy_free(
65
63
/*===========*/
66
 
        buf_pool_t*     buf_pool,
67
 
                        /*!< buffer pool in which the block resides */
68
64
        void*   buf,    /*!< in: block to be freed, must not be
69
65
                        pointed to by the buffer pool */
70
66
        ulint   size)   /*!< in: block size, up to UNIV_PAGE_SIZE */
71
67
        __attribute__((nonnull));
72
68
 
 
69
/** Statistics of buddy blocks of a given size. */
 
70
struct buf_buddy_stat_struct {
 
71
        /** Number of blocks allocated from the buddy system. */
 
72
        ulint           used;
 
73
        /** Number of blocks relocated by the buddy system. */
 
74
        ib_uint64_t     relocated;
 
75
        /** Total duration of block relocations, in microseconds. */
 
76
        ib_uint64_t     relocated_usec;
 
77
};
 
78
 
 
79
/** Statistics of buddy blocks of a given size. */
 
80
typedef struct buf_buddy_stat_struct buf_buddy_stat_t;
 
81
 
 
82
/** Statistics of the buddy system, indexed by block size.
 
83
Protected by buf_pool_mutex. */
 
84
extern buf_buddy_stat_t buf_buddy_stat[BUF_BUDDY_SIZES + 1];
 
85
 
73
86
#ifndef UNIV_NONINL
74
87
# include "buf0buddy.ic"
75
88
#endif