~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-09 04:44:38 UTC
  • mto: (1827.1.1 trunk-drizzle)
  • mto: This revision was merged to the branch mainline in revision 1828.
  • Revision ID: brian@tangent.org-20101009044438-inypezfli460whto
First pass on moving show create schema out.

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.
 
3
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
4
4
Copyright (c) 2008, Google Inc.
5
5
 
6
6
Portions of this file contain modifications contributed and copyrighted by
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
 
Gets the current size of buffer buf_pool in pages.
52
 
@return size in pages*/
53
 
UNIV_INLINE
54
 
ulint
55
 
buf_pool_get_n_pages(void)
56
 
/*======================*/
57
 
{
58
 
        return(buf_pool_get_curr_size() / UNIV_PAGE_SIZE);
59
 
}
60
38
 
61
39
/********************************************************************//**
62
40
Reads the freed_page_clock of a buffer block.
67
45
/*==========================*/
68
46
        const buf_page_t*       bpage)  /*!< in: block */
69
47
{
70
 
        /* This is sometimes read without holding buf_pool->mutex. */
 
48
        /* This is sometimes read without holding buf_pool_mutex. */
71
49
        return(bpage->freed_page_clock);
72
50
}
73
51
 
94
72
/*=====================*/
95
73
        const buf_page_t*       bpage)  /*!< in: block to make younger */
96
74
{
97
 
        buf_pool_t*             buf_pool = buf_pool_from_bpage(bpage);
98
 
 
99
 
        if (UNIV_UNLIKELY(buf_pool->freed_page_clock == 0)) {
100
 
                /* If eviction has not started yet, do not update the
101
 
                statistics or move blocks in the LRU list.  This is
102
 
                either the warm-up phase or an in-memory workload. */
103
 
                return(FALSE);
104
 
        } else if (buf_LRU_old_threshold_ms && bpage->old) {
105
 
                unsigned        access_time = buf_page_is_accessed(bpage);
106
 
 
107
 
                if (access_time > 0
108
 
                    && ((ib_uint32_t) (ut_time_ms() - access_time))
109
 
                    >= buf_LRU_old_threshold_ms) {
110
 
                        return(TRUE);
111
 
                }
112
 
 
113
 
                buf_pool->stat.n_pages_not_made_young++;
114
 
                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;
115
109
        } else {
116
 
                /* FIXME: bpage->freed_page_clock is 31 bits */
117
 
                return((buf_pool->freed_page_clock & ((1UL << 31) - 1))
118
 
                       > ((ulint) bpage->freed_page_clock
119
 
                          + (buf_pool->curr_size
120
 
                             * (BUF_LRU_OLD_RATIO_DIV - buf_pool->LRU_old_ratio)
121
 
                             / (BUF_LRU_OLD_RATIO_DIV * 4))));
 
110
                ut_ad(bpage->in_flush_list);
 
111
                lsn = bpage->oldest_modification;
122
112
        }
123
 
}
 
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 */
124
138
 
125
139
/*********************************************************************//**
126
140
Gets the state of a block.
266
280
}
267
281
 
268
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
/*********************************************************************//**
269
298
Gets the mutex of a block.
270
299
@return pointer to mutex protecting bpage */
271
300
UNIV_INLINE
274
303
/*===============*/
275
304
        const buf_page_t*       bpage)  /*!< in: pointer to control block */
276
305
{
277
 
        buf_pool_t*     buf_pool = buf_pool_from_bpage(bpage);
278
 
 
279
306
        switch (buf_page_get_state(bpage)) {
280
307
        case BUF_BLOCK_ZIP_FREE:
281
308
                ut_error;
282
309
                return(NULL);
283
310
        case BUF_BLOCK_ZIP_PAGE:
284
311
        case BUF_BLOCK_ZIP_DIRTY:
285
 
                return(&buf_pool->zip_mutex);
 
312
                return(&buf_pool_zip_mutex);
286
313
        default:
287
314
                return(&((buf_block_t*) bpage)->mutex);
288
315
        }
368
395
UNIV_INLINE
369
396
enum buf_io_fix
370
397
buf_block_get_io_fix(
371
 
/*=================*/
 
398
/*================*/
372
399
        const buf_block_t*      block)  /*!< in: pointer to the control block */
373
400
{
374
401
        return(buf_page_get_io_fix(&block->page));
383
410
        buf_page_t*     bpage,  /*!< in/out: control block */
384
411
        enum buf_io_fix io_fix) /*!< in: io_fix state */
385
412
{
386
 
#ifdef UNIV_DEBUG
387
 
        buf_pool_t*     buf_pool = buf_pool_from_bpage(bpage);
388
 
        ut_ad(buf_pool_mutex_own(buf_pool));
389
 
#endif
 
413
        ut_ad(buf_pool_mutex_own());
390
414
        ut_ad(mutex_own(buf_page_get_mutex(bpage)));
391
415
 
392
416
        bpage->io_fix = io_fix;
414
438
/*==================*/
415
439
        const buf_page_t*       bpage)  /*!< control block being relocated */
416
440
{
417
 
#ifdef UNIV_DEBUG
418
 
        buf_pool_t*     buf_pool = buf_pool_from_bpage(bpage);
419
 
        ut_ad(buf_pool_mutex_own(buf_pool));
420
 
#endif
 
441
        ut_ad(buf_pool_mutex_own());
421
442
        ut_ad(mutex_own(buf_page_get_mutex(bpage)));
422
443
        ut_ad(buf_page_in_file(bpage));
423
444
        ut_ad(bpage->in_LRU_list);
435
456
/*============*/
436
457
        const buf_page_t*       bpage)  /*!< in: control block */
437
458
{
438
 
#ifdef UNIV_DEBUG
439
 
        buf_pool_t*     buf_pool = buf_pool_from_bpage(bpage);
440
 
        ut_ad(buf_pool_mutex_own(buf_pool));
441
 
#endif
442
459
        ut_ad(buf_page_in_file(bpage));
 
460
        ut_ad(buf_pool_mutex_own());
443
461
 
444
462
        return(bpage->old);
445
463
}
453
471
        buf_page_t*     bpage,  /*!< in/out: control block */
454
472
        ibool           old)    /*!< in: old */
455
473
{
456
 
#ifdef UNIV_DEBUG
457
 
        buf_pool_t*     buf_pool = buf_pool_from_bpage(bpage);
458
 
#endif /* UNIV_DEBUG */
459
474
        ut_a(buf_page_in_file(bpage));
460
 
        ut_ad(buf_pool_mutex_own(buf_pool));
 
475
        ut_ad(buf_pool_mutex_own());
461
476
        ut_ad(bpage->in_LRU_list);
462
477
 
463
478
#ifdef UNIV_LRU_DEBUG
464
 
        ut_a((buf_pool->LRU_old_len == 0) == (buf_pool->LRU_old == NULL));
465
 
        /* If a block is flagged "old", the LRU_old list must exist. */
466
 
        ut_a(!old || buf_pool->LRU_old);
467
 
 
468
 
        if (UT_LIST_GET_PREV(LRU, bpage) && UT_LIST_GET_NEXT(LRU, bpage)) {
469
 
                const buf_page_t*       prev = UT_LIST_GET_PREV(LRU, bpage);
470
 
                const buf_page_t*       next = UT_LIST_GET_NEXT(LRU, bpage);
471
 
                if (prev->old == next->old) {
472
 
                        ut_a(prev->old == old);
473
 
                } else {
474
 
                        ut_a(!prev->old);
475
 
                        ut_a(buf_pool->LRU_old == (old ? bpage : next));
476
 
                }
 
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);
477
483
        }
478
484
#endif /* UNIV_LRU_DEBUG */
479
485
 
481
487
}
482
488
 
483
489
/*********************************************************************//**
484
 
Determine the time of first access of a block in the buffer pool.
485
 
@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 */
486
492
UNIV_INLINE
487
 
unsigned
 
493
ibool
488
494
buf_page_is_accessed(
489
495
/*=================*/
490
496
        const buf_page_t*       bpage)  /*!< in: control block */
491
497
{
492
498
        ut_ad(buf_page_in_file(bpage));
493
499
 
494
 
        return(bpage->access_time);
 
500
        return(bpage->accessed);
495
501
}
496
502
 
497
503
/*********************************************************************//**
501
507
buf_page_set_accessed(
502
508
/*==================*/
503
509
        buf_page_t*     bpage,          /*!< in/out: control block */
504
 
        ulint           time_ms)        /*!< in: ut_time_ms() */
 
510
        ibool           accessed)       /*!< in: accessed */
505
511
{
506
 
#ifdef UNIV_DEBUG
507
 
        buf_pool_t*     buf_pool = buf_pool_from_bpage(bpage);
508
 
        ut_ad(buf_pool_mutex_own(buf_pool));
509
 
#endif
510
512
        ut_a(buf_page_in_file(bpage));
 
513
        ut_ad(mutex_own(buf_page_get_mutex(bpage)));
511
514
 
512
 
        if (!bpage->access_time) {
513
 
                /* Make this the time of the first access. */
514
 
                bpage->access_time = time_ms;
515
 
        }
 
515
        bpage->accessed = accessed;
516
516
}
517
517
 
518
518
/*********************************************************************//**
703
703
/*========================*/
704
704
        const buf_block_t*      block)  /*!< in: block */
705
705
{
706
 
        ut_ad(block);
707
 
        ut_ad(buf_page_in_file(&block->page));
708
 
#ifdef UNIV_SYNC_DEBUG
709
 
        ut_ad(rw_lock_own(&(((buf_block_t*) block)->lock), RW_LOCK_EXCLUSIVE)
710
 
              || rw_lock_own(&(((buf_block_t*) block)->lock), RW_LOCK_SHARED));
711
 
#endif /* UNIV_SYNC_DEBUG */
712
706
        return(block->lock_hash_val);
713
707
}
714
708
 
715
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
/********************************************************************//**
716
729
Frees a buffer block which does not contain a file page. */
717
730
UNIV_INLINE
718
731
void
720
733
/*===========*/
721
734
        buf_block_t*    block)  /*!< in, own: block to be freed */
722
735
{
723
 
        buf_pool_t*     buf_pool = buf_pool_from_bpage((buf_page_t*)block);
724
 
 
725
 
        buf_pool_mutex_enter(buf_pool);
 
736
        buf_pool_mutex_enter();
726
737
 
727
738
        mutex_enter(&block->mutex);
728
739
 
732
743
 
733
744
        mutex_exit(&block->mutex);
734
745
 
735
 
        buf_pool_mutex_exit(buf_pool);
 
746
        buf_pool_mutex_exit();
736
747
}
737
748
#endif /* !UNIV_HOTBACKUP */
738
749
 
806
817
        buf_block_t*    block)  /*!< in: block */
807
818
{
808
819
#ifdef UNIV_SYNC_DEBUG
809
 
        buf_pool_t*     buf_pool = buf_pool_from_bpage((buf_page_t*)block);
810
 
 
811
 
        ut_ad((buf_pool_mutex_own(buf_pool)
 
820
        ut_ad((buf_pool_mutex_own()
812
821
               && (block->page.buf_fix_count == 0))
813
822
              || rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
814
823
#endif /* UNIV_SYNC_DEBUG */
887
896
}
888
897
 
889
898
/******************************************************************//**
890
 
Returns the buffer pool instance given a page instance
891
 
@return buf_pool */
892
 
UNIV_INLINE
893
 
buf_pool_t*
894
 
buf_pool_from_bpage(
895
 
/*================*/
896
 
        const buf_page_t*       bpage) /*!< in: buffer pool page */
897
 
{
898
 
        /* Every page must be in some buffer pool. */
899
 
        ut_ad(bpage->buf_pool != NULL);
900
 
 
901
 
        return(bpage->buf_pool);
902
 
}
903
 
 
904
 
/******************************************************************//**
905
 
Returns the buffer pool instance given a block instance
906
 
@return buf_pool */
907
 
UNIV_INLINE
908
 
buf_pool_t*
909
 
buf_pool_from_block(
910
 
/*================*/
911
 
        const buf_block_t*      block) /*!< in: block */
912
 
{
913
 
        return(buf_pool_from_bpage(&block->page));
914
 
}
915
 
 
916
 
/******************************************************************//**
917
 
Returns the buffer pool instance given space and offset of page
918
 
@return buffer pool */
919
 
UNIV_INLINE
920
 
buf_pool_t*
921
 
buf_pool_get(
922
 
/*==========*/
923
 
        ulint   space,  /*!< in: space id */
924
 
        ulint   offset) /*!< in: offset of the page within space */
925
 
{
926
 
        ulint   fold;
927
 
        ulint   index;
928
 
        ulint   ignored_offset;
929
 
 
930
 
        ignored_offset = offset >> 6; /* 2log of BUF_READ_AHEAD_AREA (64)*/
931
 
        fold = buf_page_address_fold(space, ignored_offset);
932
 
        index = fold % srv_buf_pool_instances;
933
 
        return buf_pool_ptr[index];
934
 
}
935
 
 
936
 
/******************************************************************//**
937
 
Returns the buffer pool instance given its array index
938
 
@return buffer pool */
939
 
UNIV_INLINE
940
 
buf_pool_t*
941
 
buf_pool_from_array(
942
 
/*================*/
943
 
        ulint   index)          /*!< in: array index to get
944
 
                                buffer pool instance from */
945
 
{
946
 
        return buf_pool_ptr[index];
947
 
}
948
 
 
949
 
/******************************************************************//**
950
899
Returns the control block of a file page, NULL if not found.
951
900
@return block, NULL if not found */
952
901
UNIV_INLINE
953
902
buf_page_t*
954
 
buf_page_hash_get_low(
955
 
/*==================*/
956
 
        buf_pool_t*     buf_pool,       /*!< buffer pool instance */
957
 
        ulint           space,          /*!< in: space id */
958
 
        ulint           offset,         /*!< in: offset of the page
959
 
                                        within space */
960
 
        ulint           fold)           /*!< in: buf_page_address_fold(
961
 
                                        space, offset) */
 
903
buf_page_hash_get(
 
904
/*==============*/
 
905
        ulint   space,  /*!< in: space id */
 
906
        ulint   offset) /*!< in: offset of the page within space */
962
907
{
963
908
        buf_page_t*     bpage;
 
909
        ulint           fold;
964
910
 
965
911
        ut_ad(buf_pool);
966
 
        ut_ad(buf_pool_mutex_own(buf_pool));
967
 
        ut_ad(fold == buf_page_address_fold(space, offset));
 
912
        ut_ad(buf_pool_mutex_own());
968
913
 
969
914
        /* Look for the page in the hash table */
970
915
 
 
916
        fold = buf_page_address_fold(space, offset);
 
917
 
971
918
        HASH_SEARCH(hash, buf_pool->page_hash, fold, buf_page_t*, bpage,
972
919
                    ut_ad(bpage->in_page_hash && !bpage->in_zip_hash
973
920
                          && buf_page_in_file(bpage)),
976
923
                ut_a(buf_page_in_file(bpage));
977
924
                ut_ad(bpage->in_page_hash);
978
925
                ut_ad(!bpage->in_zip_hash);
979
 
#if UNIV_WORD_SIZE == 4
980
 
                /* On 32-bit systems, there is no padding in
981
 
                buf_page_t.  On other systems, Valgrind could complain
982
 
                about uninitialized pad bytes. */
983
926
                UNIV_MEM_ASSERT_RW(bpage, sizeof *bpage);
984
 
#endif
985
 
        }
986
 
 
987
 
        return(bpage);
988
 
}
989
 
 
990
 
/******************************************************************//**
991
 
Returns the control block of a file page, NULL if not found.
992
 
@return block, NULL if not found or not a real control block */
993
 
UNIV_INLINE
994
 
buf_page_t*
995
 
buf_page_hash_get(
996
 
/*==============*/
997
 
        buf_pool_t*     buf_pool,       /*!< in: buffer pool instance */
998
 
        ulint           space,          /*!< in: space id */
999
 
        ulint           offset)         /*!< in: offset of the page
1000
 
                                        within space */
1001
 
{
1002
 
        buf_page_t*     bpage;
1003
 
        ulint           fold    = buf_page_address_fold(space, offset);
1004
 
 
1005
 
        bpage   = buf_page_hash_get_low(buf_pool, space, offset, fold);
1006
 
 
1007
 
        if (bpage && buf_pool_watch_is_sentinel(buf_pool, bpage)) {
1008
 
                bpage = NULL;
1009
927
        }
1010
928
 
1011
929
        return(bpage);
1019
937
buf_block_t*
1020
938
buf_block_hash_get(
1021
939
/*===============*/
1022
 
        buf_pool_t*     buf_pool,       /*!< in: buffer pool instance */
1023
 
        ulint           space,          /*!< in: space id */
1024
 
        ulint           offset)         /*!< in: offset of the page
1025
 
                                        within space */
 
940
        ulint   space,  /*!< in: space id */
 
941
        ulint   offset) /*!< in: offset of the page within space */
1026
942
{
1027
 
        buf_block_t*    block;
1028
 
 
1029
 
        block = buf_page_get_block(buf_page_hash_get(buf_pool, space, offset));
1030
 
 
1031
 
        return(block);
 
943
        return(buf_page_get_block(buf_page_hash_get(space, offset)));
1032
944
}
1033
945
 
1034
946
/********************************************************************//**
1046
958
        ulint   offset) /*!< in: page number */
1047
959
{
1048
960
        const buf_page_t*       bpage;
1049
 
        buf_pool_t*             buf_pool = buf_pool_get(space, offset);
1050
 
 
1051
 
        buf_pool_mutex_enter(buf_pool);
1052
 
 
1053
 
        bpage = buf_page_hash_get(buf_pool, space, offset);
1054
 
 
1055
 
        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();
1056
967
 
1057
968
        return(bpage != NULL);
1058
969
}
1066
977
        buf_page_t*     bpage)          /*!< in: buffer block */
1067
978
{
1068
979
        buf_block_t*    block;
1069
 
        buf_pool_t*     buf_pool = buf_pool_from_bpage(bpage);
1070
980
 
1071
981
        ut_ad(bpage);
1072
982
        ut_a(bpage->buf_fix_count > 0);
1074
984
        switch (buf_page_get_state(bpage)) {
1075
985
        case BUF_BLOCK_ZIP_PAGE:
1076
986
        case BUF_BLOCK_ZIP_DIRTY:
1077
 
                mutex_enter(&buf_pool->zip_mutex);
 
987
                mutex_enter(&buf_pool_zip_mutex);
1078
988
                bpage->buf_fix_count--;
1079
 
                mutex_exit(&buf_pool->zip_mutex);
 
989
                mutex_exit(&buf_pool_zip_mutex);
1080
990
                return;
1081
991
        case BUF_BLOCK_FILE_PAGE:
1082
992
                block = (buf_block_t*) bpage;
1095
1005
                break;
1096
1006
        }
1097
1007
 
1098
 
        
1099
1008
        ut_error;
1100
1009
}
1101
1010
 
1107
1016
buf_page_release(
1108
1017
/*=============*/
1109
1018
        buf_block_t*    block,          /*!< in: buffer block */
1110
 
        ulint           rw_latch)       /*!< in: RW_S_LATCH, RW_X_LATCH,
 
1019
        ulint           rw_latch,       /*!< in: RW_S_LATCH, RW_X_LATCH,
1111
1020
                                        RW_NO_LATCH */
 
1021
        mtr_t*          mtr)            /*!< in: mtr */
1112
1022
{
1113
1023
        ut_ad(block);
1114
1024
 
1115
1025
        ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
1116
1026
        ut_a(block->page.buf_fix_count > 0);
1117
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
 
1118
1034
        mutex_enter(&block->mutex);
1119
1035
 
1120
1036
#ifdef UNIV_SYNC_DEBUG
1147
1063
        sync_thread_add_level(&block->lock, level);
1148
1064
}
1149
1065
#endif /* UNIV_SYNC_DEBUG */
1150
 
/********************************************************************//**
1151
 
Acquire mutex on all buffer pool instances. */
1152
 
UNIV_INLINE
1153
 
void
1154
 
buf_pool_mutex_enter_all(void)
1155
 
/*==========================*/
1156
 
{
1157
 
        ulint   i;
1158
 
 
1159
 
        for (i = 0; i < srv_buf_pool_instances; i++) {
1160
 
                buf_pool_t*     buf_pool;
1161
 
 
1162
 
                buf_pool = buf_pool_from_array(i);
1163
 
                buf_pool_mutex_enter(buf_pool);
1164
 
        }
1165
 
}
1166
 
 
1167
 
/********************************************************************//**
1168
 
Release mutex on all buffer pool instances. */
1169
 
UNIV_INLINE
1170
 
void
1171
 
buf_pool_mutex_exit_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_exit(buf_pool);
1181
 
        }
1182
 
}
1183
1066
#endif /* !UNIV_HOTBACKUP */