~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/include/buf0buf.ic

  • Committer: Brian Aker
  • Date: 2010-10-12 05:21:02 UTC
  • Revision ID: brian@tangent.org-20101012052102-9yrbu1ye7n8n4b6n
Remove dead code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (C) 1995, 2010, Innobase Oy. All Rights Reserved.
4
 
Copyright (C) 2008, Google Inc.
 
3
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
 
4
Copyright (c) 2008, Google Inc.
5
5
 
6
6
Portions of this file contain modifications contributed and copyrighted by
7
7
Google, Inc. Those modifications are gratefully acknowledged and are described
31
31
*******************************************************/
32
32
 
33
33
#include "mtr0mtr.h"
 
34
#ifndef UNIV_HOTBACKUP
34
35
#include "buf0flu.h"
35
36
#include "buf0lru.h"
36
37
#include "buf0rea.h"
37
 
#include "srv0srv.h"
38
 
 
39
 
/*********************************************************************//**
40
 
Gets the current size of buffer buf_pool in bytes.
41
 
@return size in bytes */
42
 
UNIV_INLINE
43
 
ulint
44
 
buf_pool_get_curr_size(void)
45
 
/*========================*/
46
 
{
47
 
        return(srv_buf_pool_curr_size);
48
 
}
49
 
 
50
 
/********************************************************************//**
51
 
Calculates the index of a buffer pool to the buf_pool[] array.
52
 
@return the position of the buffer pool in buf_pool[] */
53
 
UNIV_INLINE
54
 
ulint
55
 
buf_pool_index(
56
 
/*===========*/
57
 
        const buf_pool_t*       buf_pool)       /*!< in: buffer pool */
58
 
{
59
 
        ulint   i = buf_pool - buf_pool_ptr;
60
 
        ut_ad(i < MAX_BUFFER_POOLS);
61
 
        ut_ad(i < srv_buf_pool_instances);
62
 
        return(i);
63
 
}
64
 
 
65
 
/******************************************************************//**
66
 
Returns the buffer pool instance given a page instance
67
 
@return buf_pool */
68
 
UNIV_INLINE
69
 
buf_pool_t*
70
 
buf_pool_from_bpage(
71
 
/*================*/
72
 
        const buf_page_t*       bpage) /*!< in: buffer pool page */
73
 
{
74
 
        ulint   i;
75
 
        i = bpage->buf_pool_index;
76
 
        ut_ad(i < srv_buf_pool_instances);
77
 
        return(&buf_pool_ptr[i]);
78
 
}
79
 
 
80
 
/******************************************************************//**
81
 
Returns the buffer pool instance given a block instance
82
 
@return buf_pool */
83
 
UNIV_INLINE
84
 
buf_pool_t*
85
 
buf_pool_from_block(
86
 
/*================*/
87
 
        const buf_block_t*      block) /*!< in: block */
88
 
{
89
 
        return(buf_pool_from_bpage(&block->page));
90
 
}
91
 
 
92
 
/*********************************************************************//**
93
 
Gets the current size of buffer buf_pool in pages.
94
 
@return size in pages*/
95
 
UNIV_INLINE
96
 
ulint
97
 
buf_pool_get_n_pages(void)
98
 
/*======================*/
99
 
{
100
 
        return(buf_pool_get_curr_size() / UNIV_PAGE_SIZE);
101
 
}
102
38
 
103
39
/********************************************************************//**
104
40
Reads the freed_page_clock of a buffer block.
109
45
/*==========================*/
110
46
        const buf_page_t*       bpage)  /*!< in: block */
111
47
{
112
 
        /* This is sometimes read without holding buf_pool->mutex. */
 
48
        /* This is sometimes read without holding buf_pool_mutex. */
113
49
        return(bpage->freed_page_clock);
114
50
}
115
51
 
136
72
/*=====================*/
137
73
        const buf_page_t*       bpage)  /*!< in: block to make younger */
138
74
{
139
 
        buf_pool_t*             buf_pool = buf_pool_from_bpage(bpage);
140
 
 
141
 
        if (UNIV_UNLIKELY(buf_pool->freed_page_clock == 0)) {
142
 
                /* If eviction has not started yet, do not update the
143
 
                statistics or move blocks in the LRU list.  This is
144
 
                either the warm-up phase or an in-memory workload. */
145
 
                return(FALSE);
146
 
        } else if (buf_LRU_old_threshold_ms && bpage->old) {
147
 
                unsigned        access_time = buf_page_is_accessed(bpage);
148
 
 
149
 
                if (access_time > 0
150
 
                    && ((ib_uint32_t) (ut_time_ms() - access_time))
151
 
                    >= buf_LRU_old_threshold_ms) {
152
 
                        return(TRUE);
153
 
                }
154
 
 
155
 
                buf_pool->stat.n_pages_not_made_young++;
156
 
                return(FALSE);
 
75
        return(buf_pool->freed_page_clock
 
76
               >= buf_page_get_freed_page_clock(bpage)
 
77
               + 1 + (buf_pool->curr_size / 4));
 
78
}
 
79
 
 
80
/*********************************************************************//**
 
81
Gets the current size of buffer buf_pool in bytes.
 
82
@return size in bytes */
 
83
UNIV_INLINE
 
84
ulint
 
85
buf_pool_get_curr_size(void)
 
86
/*========================*/
 
87
{
 
88
        return(buf_pool->curr_size * UNIV_PAGE_SIZE);
 
89
}
 
90
 
 
91
/********************************************************************//**
 
92
Gets the smallest oldest_modification lsn for any page in the pool. Returns
 
93
zero if all modified pages have been flushed to disk.
 
94
@return oldest modification in pool, zero if none */
 
95
UNIV_INLINE
 
96
ib_uint64_t
 
97
buf_pool_get_oldest_modification(void)
 
98
/*==================================*/
 
99
{
 
100
        buf_page_t*     bpage;
 
101
        ib_uint64_t     lsn;
 
102
 
 
103
        buf_pool_mutex_enter();
 
104
 
 
105
        bpage = UT_LIST_GET_LAST(buf_pool->flush_list);
 
106
 
 
107
        if (bpage == NULL) {
 
108
                lsn = 0;
157
109
        } else {
158
 
                /* FIXME: bpage->freed_page_clock is 31 bits */
159
 
                return((buf_pool->freed_page_clock & ((1UL << 31) - 1))
160
 
                       > ((ulint) bpage->freed_page_clock
161
 
                          + (buf_pool->curr_size
162
 
                             * (BUF_LRU_OLD_RATIO_DIV - buf_pool->LRU_old_ratio)
163
 
                             / (BUF_LRU_OLD_RATIO_DIV * 4))));
 
110
                ut_ad(bpage->in_flush_list);
 
111
                lsn = bpage->oldest_modification;
164
112
        }
165
 
}
 
113
 
 
114
        buf_pool_mutex_exit();
 
115
 
 
116
        /* The returned answer may be out of date: the flush_list can
 
117
        change after the mutex has been released. */
 
118
 
 
119
        return(lsn);
 
120
}
 
121
 
 
122
/*******************************************************************//**
 
123
Increments the buf_pool clock by one and returns its new value. Remember
 
124
that in the 32 bit version the clock wraps around at 4 billion!
 
125
@return new clock value */
 
126
UNIV_INLINE
 
127
ulint
 
128
buf_pool_clock_tic(void)
 
129
/*====================*/
 
130
{
 
131
        ut_ad(buf_pool_mutex_own());
 
132
 
 
133
        buf_pool->ulint_clock++;
 
134
 
 
135
        return(buf_pool->ulint_clock);
 
136
}
 
137
#endif /* !UNIV_HOTBACKUP */
166
138
 
167
139
/*********************************************************************//**
168
140
Gets the state of a block.
308
280
}
309
281
 
310
282
/*********************************************************************//**
 
283
Determine the approximate LRU list position of a block.
 
284
@return LRU list position */
 
285
UNIV_INLINE
 
286
ulint
 
287
buf_page_get_LRU_position(
 
288
/*======================*/
 
289
        const buf_page_t*       bpage)  /*!< in: control block */
 
290
{
 
291
        ut_ad(buf_page_in_file(bpage));
 
292
        ut_ad(buf_pool_mutex_own());
 
293
 
 
294
        return(bpage->LRU_position);
 
295
}
 
296
 
 
297
/*********************************************************************//**
311
298
Gets the mutex of a block.
312
299
@return pointer to mutex protecting bpage */
313
300
UNIV_INLINE
316
303
/*===============*/
317
304
        const buf_page_t*       bpage)  /*!< in: pointer to control block */
318
305
{
319
 
        buf_pool_t*     buf_pool = buf_pool_from_bpage(bpage);
320
 
 
321
306
        switch (buf_page_get_state(bpage)) {
322
307
        case BUF_BLOCK_ZIP_FREE:
323
308
                ut_error;
324
309
                return(NULL);
325
310
        case BUF_BLOCK_ZIP_PAGE:
326
311
        case BUF_BLOCK_ZIP_DIRTY:
327
 
                return(&buf_pool->zip_mutex);
 
312
                return(&buf_pool_zip_mutex);
328
313
        default:
329
314
                return(&((buf_block_t*) bpage)->mutex);
330
315
        }
410
395
UNIV_INLINE
411
396
enum buf_io_fix
412
397
buf_block_get_io_fix(
413
 
/*=================*/
 
398
/*================*/
414
399
        const buf_block_t*      block)  /*!< in: pointer to the control block */
415
400
{
416
401
        return(buf_page_get_io_fix(&block->page));
425
410
        buf_page_t*     bpage,  /*!< in/out: control block */
426
411
        enum buf_io_fix io_fix) /*!< in: io_fix state */
427
412
{
428
 
#ifdef UNIV_DEBUG
429
 
        buf_pool_t*     buf_pool = buf_pool_from_bpage(bpage);
430
 
        ut_ad(buf_pool_mutex_own(buf_pool));
431
 
#endif
 
413
        ut_ad(buf_pool_mutex_own());
432
414
        ut_ad(mutex_own(buf_page_get_mutex(bpage)));
433
415
 
434
416
        bpage->io_fix = io_fix;
456
438
/*==================*/
457
439
        const buf_page_t*       bpage)  /*!< control block being relocated */
458
440
{
459
 
#ifdef UNIV_DEBUG
460
 
        buf_pool_t*     buf_pool = buf_pool_from_bpage(bpage);
461
 
        ut_ad(buf_pool_mutex_own(buf_pool));
462
 
#endif
 
441
        ut_ad(buf_pool_mutex_own());
463
442
        ut_ad(mutex_own(buf_page_get_mutex(bpage)));
464
443
        ut_ad(buf_page_in_file(bpage));
465
444
        ut_ad(bpage->in_LRU_list);
477
456
/*============*/
478
457
        const buf_page_t*       bpage)  /*!< in: control block */
479
458
{
480
 
#ifdef UNIV_DEBUG
481
 
        buf_pool_t*     buf_pool = buf_pool_from_bpage(bpage);
482
 
        ut_ad(buf_pool_mutex_own(buf_pool));
483
 
#endif
484
459
        ut_ad(buf_page_in_file(bpage));
 
460
        ut_ad(buf_pool_mutex_own());
485
461
 
486
462
        return(bpage->old);
487
463
}
495
471
        buf_page_t*     bpage,  /*!< in/out: control block */
496
472
        ibool           old)    /*!< in: old */
497
473
{
498
 
#ifdef UNIV_DEBUG
499
 
        buf_pool_t*     buf_pool = buf_pool_from_bpage(bpage);
500
 
#endif /* UNIV_DEBUG */
501
474
        ut_a(buf_page_in_file(bpage));
502
 
        ut_ad(buf_pool_mutex_own(buf_pool));
 
475
        ut_ad(buf_pool_mutex_own());
503
476
        ut_ad(bpage->in_LRU_list);
504
477
 
505
478
#ifdef UNIV_LRU_DEBUG
506
 
        ut_a((buf_pool->LRU_old_len == 0) == (buf_pool->LRU_old == NULL));
507
 
        /* If a block is flagged "old", the LRU_old list must exist. */
508
 
        ut_a(!old || buf_pool->LRU_old);
509
 
 
510
 
        if (UT_LIST_GET_PREV(LRU, bpage) && UT_LIST_GET_NEXT(LRU, bpage)) {
511
 
                const buf_page_t*       prev = UT_LIST_GET_PREV(LRU, bpage);
512
 
                const buf_page_t*       next = UT_LIST_GET_NEXT(LRU, bpage);
513
 
                if (prev->old == next->old) {
514
 
                        ut_a(prev->old == old);
515
 
                } else {
516
 
                        ut_a(!prev->old);
517
 
                        ut_a(buf_pool->LRU_old == (old ? bpage : next));
518
 
                }
 
479
        if (UT_LIST_GET_PREV(LRU, bpage) && UT_LIST_GET_NEXT(LRU, bpage)
 
480
            && UT_LIST_GET_PREV(LRU, bpage)->old
 
481
            == UT_LIST_GET_NEXT(LRU, bpage)->old) {
 
482
                ut_a(UT_LIST_GET_PREV(LRU, bpage)->old == old);
519
483
        }
520
484
#endif /* UNIV_LRU_DEBUG */
521
485
 
523
487
}
524
488
 
525
489
/*********************************************************************//**
526
 
Determine the time of first access of a block in the buffer pool.
527
 
@return ut_time_ms() at the time of first access, 0 if not accessed */
 
490
Determine if a block has been accessed in the buffer pool.
 
491
@return TRUE if accessed */
528
492
UNIV_INLINE
529
 
unsigned
 
493
ibool
530
494
buf_page_is_accessed(
531
495
/*=================*/
532
496
        const buf_page_t*       bpage)  /*!< in: control block */
533
497
{
534
498
        ut_ad(buf_page_in_file(bpage));
535
499
 
536
 
        return(bpage->access_time);
 
500
        return(bpage->accessed);
537
501
}
538
502
 
539
503
/*********************************************************************//**
543
507
buf_page_set_accessed(
544
508
/*==================*/
545
509
        buf_page_t*     bpage,          /*!< in/out: control block */
546
 
        ulint           time_ms)        /*!< in: ut_time_ms() */
 
510
        ibool           accessed)       /*!< in: accessed */
547
511
{
548
 
#ifdef UNIV_DEBUG
549
 
        buf_pool_t*     buf_pool = buf_pool_from_bpage(bpage);
550
 
        ut_ad(buf_pool_mutex_own(buf_pool));
551
 
#endif
552
512
        ut_a(buf_page_in_file(bpage));
 
513
        ut_ad(mutex_own(buf_page_get_mutex(bpage)));
553
514
 
554
 
        if (!bpage->access_time) {
555
 
                /* Make this the time of the first access. */
556
 
                bpage->access_time = time_ms;
557
 
        }
 
515
        bpage->accessed = accessed;
558
516
}
559
517
 
560
518
/*********************************************************************//**
745
703
/*========================*/
746
704
        const buf_block_t*      block)  /*!< in: block */
747
705
{
748
 
        ut_ad(block);
749
 
        ut_ad(buf_page_in_file(&block->page));
750
 
#ifdef UNIV_SYNC_DEBUG
751
 
        ut_ad(rw_lock_own(&(((buf_block_t*) block)->lock), RW_LOCK_EXCLUSIVE)
752
 
              || rw_lock_own(&(((buf_block_t*) block)->lock), RW_LOCK_SHARED));
753
 
#endif /* UNIV_SYNC_DEBUG */
754
706
        return(block->lock_hash_val);
755
707
}
756
708
 
757
709
/********************************************************************//**
 
710
Allocates a buffer block.
 
711
@return own: the allocated block, in state BUF_BLOCK_MEMORY */
 
712
UNIV_INLINE
 
713
buf_block_t*
 
714
buf_block_alloc(
 
715
/*============*/
 
716
        ulint   zip_size)       /*!< in: compressed page size in bytes,
 
717
                                or 0 if uncompressed tablespace */
 
718
{
 
719
        buf_block_t*    block;
 
720
 
 
721
        block = buf_LRU_get_free_block(zip_size);
 
722
 
 
723
        buf_block_set_state(block, BUF_BLOCK_MEMORY);
 
724
 
 
725
        return(block);
 
726
}
 
727
 
 
728
/********************************************************************//**
758
729
Frees a buffer block which does not contain a file page. */
759
730
UNIV_INLINE
760
731
void
762
733
/*===========*/
763
734
        buf_block_t*    block)  /*!< in, own: block to be freed */
764
735
{
765
 
        buf_pool_t*     buf_pool = buf_pool_from_bpage((buf_page_t*)block);
766
 
 
767
 
        buf_pool_mutex_enter(buf_pool);
 
736
        buf_pool_mutex_enter();
768
737
 
769
738
        mutex_enter(&block->mutex);
770
739
 
774
743
 
775
744
        mutex_exit(&block->mutex);
776
745
 
777
 
        buf_pool_mutex_exit(buf_pool);
 
746
        buf_pool_mutex_exit();
778
747
}
779
748
#endif /* !UNIV_HOTBACKUP */
780
749
 
848
817
        buf_block_t*    block)  /*!< in: block */
849
818
{
850
819
#ifdef UNIV_SYNC_DEBUG
851
 
        buf_pool_t*     buf_pool = buf_pool_from_bpage((buf_page_t*)block);
852
 
 
853
 
        ut_ad((buf_pool_mutex_own(buf_pool)
 
820
        ut_ad((buf_pool_mutex_own()
854
821
               && (block->page.buf_fix_count == 0))
855
822
              || rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
856
823
#endif /* UNIV_SYNC_DEBUG */
929
896
}
930
897
 
931
898
/******************************************************************//**
932
 
Returns the buffer pool instance given space and offset of page
933
 
@return buffer pool */
934
 
UNIV_INLINE
935
 
buf_pool_t*
936
 
buf_pool_get(
937
 
/*==========*/
938
 
        ulint   space,  /*!< in: space id */
939
 
        ulint   offset) /*!< in: offset of the page within space */
940
 
{
941
 
        ulint   fold;
942
 
        ulint   index;
943
 
        ulint   ignored_offset;
944
 
 
945
 
        ignored_offset = offset >> 6; /* 2log of BUF_READ_AHEAD_AREA (64)*/
946
 
        fold = buf_page_address_fold(space, ignored_offset);
947
 
        index = fold % srv_buf_pool_instances;
948
 
        return(&buf_pool_ptr[index]);
949
 
}
950
 
 
951
 
/******************************************************************//**
952
 
Returns the buffer pool instance given its array index
953
 
@return buffer pool */
954
 
UNIV_INLINE
955
 
buf_pool_t*
956
 
buf_pool_from_array(
957
 
/*================*/
958
 
        ulint   index)          /*!< in: array index to get
959
 
                                buffer pool instance from */
960
 
{
961
 
        ut_ad(index < MAX_BUFFER_POOLS);
962
 
        ut_ad(index < srv_buf_pool_instances);
963
 
        return(&buf_pool_ptr[index]);
964
 
}
965
 
 
966
 
/******************************************************************//**
967
899
Returns the control block of a file page, NULL if not found.
968
900
@return block, NULL if not found */
969
901
UNIV_INLINE
970
902
buf_page_t*
971
 
buf_page_hash_get_low(
972
 
/*==================*/
973
 
        buf_pool_t*     buf_pool,       /*!< buffer pool instance */
974
 
        ulint           space,          /*!< in: space id */
975
 
        ulint           offset,         /*!< in: offset of the page
976
 
                                        within space */
977
 
        ulint           fold)           /*!< in: buf_page_address_fold(
978
 
                                        space, offset) */
 
903
buf_page_hash_get(
 
904
/*==============*/
 
905
        ulint   space,  /*!< in: space id */
 
906
        ulint   offset) /*!< in: offset of the page within space */
979
907
{
980
908
        buf_page_t*     bpage;
 
909
        ulint           fold;
981
910
 
982
911
        ut_ad(buf_pool);
983
 
        ut_ad(buf_pool_mutex_own(buf_pool));
984
 
        ut_ad(fold == buf_page_address_fold(space, offset));
 
912
        ut_ad(buf_pool_mutex_own());
985
913
 
986
914
        /* Look for the page in the hash table */
987
915
 
 
916
        fold = buf_page_address_fold(space, offset);
 
917
 
988
918
        HASH_SEARCH(hash, buf_pool->page_hash, fold, buf_page_t*, bpage,
989
919
                    ut_ad(bpage->in_page_hash && !bpage->in_zip_hash
990
920
                          && buf_page_in_file(bpage)),
993
923
                ut_a(buf_page_in_file(bpage));
994
924
                ut_ad(bpage->in_page_hash);
995
925
                ut_ad(!bpage->in_zip_hash);
996
 
#if UNIV_WORD_SIZE == 4
997
 
                /* On 32-bit systems, there is no padding in
998
 
                buf_page_t.  On other systems, Valgrind could complain
999
 
                about uninitialized pad bytes. */
1000
926
                UNIV_MEM_ASSERT_RW(bpage, sizeof *bpage);
1001
 
#endif
1002
 
        }
1003
 
 
1004
 
        return(bpage);
1005
 
}
1006
 
 
1007
 
/******************************************************************//**
1008
 
Returns the control block of a file page, NULL if not found.
1009
 
@return block, NULL if not found or not a real control block */
1010
 
UNIV_INLINE
1011
 
buf_page_t*
1012
 
buf_page_hash_get(
1013
 
/*==============*/
1014
 
        buf_pool_t*     buf_pool,       /*!< in: buffer pool instance */
1015
 
        ulint           space,          /*!< in: space id */
1016
 
        ulint           offset)         /*!< in: offset of the page
1017
 
                                        within space */
1018
 
{
1019
 
        buf_page_t*     bpage;
1020
 
        ulint           fold    = buf_page_address_fold(space, offset);
1021
 
 
1022
 
        bpage   = buf_page_hash_get_low(buf_pool, space, offset, fold);
1023
 
 
1024
 
        if (bpage && buf_pool_watch_is_sentinel(buf_pool, bpage)) {
1025
 
                bpage = NULL;
1026
927
        }
1027
928
 
1028
929
        return(bpage);
1036
937
buf_block_t*
1037
938
buf_block_hash_get(
1038
939
/*===============*/
1039
 
        buf_pool_t*     buf_pool,       /*!< in: buffer pool instance */
1040
 
        ulint           space,          /*!< in: space id */
1041
 
        ulint           offset)         /*!< in: offset of the page
1042
 
                                        within space */
 
940
        ulint   space,  /*!< in: space id */
 
941
        ulint   offset) /*!< in: offset of the page within space */
1043
942
{
1044
 
        buf_block_t*    block;
1045
 
 
1046
 
        block = buf_page_get_block(buf_page_hash_get(buf_pool, space, offset));
1047
 
 
1048
 
        return(block);
 
943
        return(buf_page_get_block(buf_page_hash_get(space, offset)));
1049
944
}
1050
945
 
1051
946
/********************************************************************//**
1063
958
        ulint   offset) /*!< in: page number */
1064
959
{
1065
960
        const buf_page_t*       bpage;
1066
 
        buf_pool_t*             buf_pool = buf_pool_get(space, offset);
1067
 
 
1068
 
        buf_pool_mutex_enter(buf_pool);
1069
 
 
1070
 
        bpage = buf_page_hash_get(buf_pool, space, offset);
1071
 
 
1072
 
        buf_pool_mutex_exit(buf_pool);
 
961
 
 
962
        buf_pool_mutex_enter();
 
963
 
 
964
        bpage = buf_page_hash_get(space, offset);
 
965
 
 
966
        buf_pool_mutex_exit();
1073
967
 
1074
968
        return(bpage != NULL);
1075
969
}
1083
977
        buf_page_t*     bpage)          /*!< in: buffer block */
1084
978
{
1085
979
        buf_block_t*    block;
1086
 
        buf_pool_t*     buf_pool = buf_pool_from_bpage(bpage);
1087
980
 
1088
981
        ut_ad(bpage);
1089
982
        ut_a(bpage->buf_fix_count > 0);
1091
984
        switch (buf_page_get_state(bpage)) {
1092
985
        case BUF_BLOCK_ZIP_PAGE:
1093
986
        case BUF_BLOCK_ZIP_DIRTY:
1094
 
                mutex_enter(&buf_pool->zip_mutex);
 
987
                mutex_enter(&buf_pool_zip_mutex);
1095
988
                bpage->buf_fix_count--;
1096
 
                mutex_exit(&buf_pool->zip_mutex);
 
989
                mutex_exit(&buf_pool_zip_mutex);
1097
990
                return;
1098
991
        case BUF_BLOCK_FILE_PAGE:
1099
992
                block = (buf_block_t*) bpage;
1112
1005
                break;
1113
1006
        }
1114
1007
 
1115
 
        
1116
1008
        ut_error;
1117
1009
}
1118
1010
 
1124
1016
buf_page_release(
1125
1017
/*=============*/
1126
1018
        buf_block_t*    block,          /*!< in: buffer block */
1127
 
        ulint           rw_latch)       /*!< in: RW_S_LATCH, RW_X_LATCH,
 
1019
        ulint           rw_latch,       /*!< in: RW_S_LATCH, RW_X_LATCH,
1128
1020
                                        RW_NO_LATCH */
 
1021
        mtr_t*          mtr)            /*!< in: mtr */
1129
1022
{
1130
1023
        ut_ad(block);
1131
1024
 
1132
1025
        ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
1133
1026
        ut_a(block->page.buf_fix_count > 0);
1134
1027
 
 
1028
        if (rw_latch == RW_X_LATCH && mtr->modifications) {
 
1029
                buf_pool_mutex_enter();
 
1030
                buf_flush_note_modification(block, mtr);
 
1031
                buf_pool_mutex_exit();
 
1032
        }
 
1033
 
1135
1034
        mutex_enter(&block->mutex);
1136
1035
 
1137
1036
#ifdef UNIV_SYNC_DEBUG
1164
1063
        sync_thread_add_level(&block->lock, level);
1165
1064
}
1166
1065
#endif /* UNIV_SYNC_DEBUG */
1167
 
/********************************************************************//**
1168
 
Acquire mutex on all buffer pool instances. */
1169
 
UNIV_INLINE
1170
 
void
1171
 
buf_pool_mutex_enter_all(void)
1172
 
/*==========================*/
1173
 
{
1174
 
        ulint   i;
1175
 
 
1176
 
        for (i = 0; i < srv_buf_pool_instances; i++) {
1177
 
                buf_pool_t*     buf_pool;
1178
 
 
1179
 
                buf_pool = buf_pool_from_array(i);
1180
 
                buf_pool_mutex_enter(buf_pool);
1181
 
        }
1182
 
}
1183
 
 
1184
 
/********************************************************************//**
1185
 
Release mutex on all buffer pool instances. */
1186
 
UNIV_INLINE
1187
 
void
1188
 
buf_pool_mutex_exit_all(void)
1189
 
/*=========================*/
1190
 
{
1191
 
        ulint   i;
1192
 
 
1193
 
        for (i = 0; i < srv_buf_pool_instances; i++) {
1194
 
                buf_pool_t*     buf_pool;
1195
 
 
1196
 
                buf_pool = buf_pool_from_array(i);
1197
 
                buf_pool_mutex_exit(buf_pool);
1198
 
        }
1199
 
}
1200
1066
#endif /* !UNIV_HOTBACKUP */