~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/mf_keycache.c

  • Committer: Brian Aker
  • Date: 2008-10-06 06:47:29 UTC
  • Revision ID: brian@tangent.org-20081006064729-2i9mhjkzyvow9xsm
RemoveĀ uint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
161
161
  struct st_block_link *block;       /* reference to the block for the page: */
162
162
  File file;                         /* from such a file                     */
163
163
  my_off_t diskpos;                  /* with such an offset                  */
164
 
  uint requests;                     /* number of requests for the page      */
 
164
  uint32_t requests;                     /* number of requests for the page      */
165
165
};
166
166
 
167
167
/* simple states of a block */
193
193
    *next_changed, **prev_changed; /* for lists of file dirty/clean blocks   */
194
194
  struct st_hash_link *hash_link; /* backward ptr to referring hash_link     */
195
195
  KEYCACHE_WQUEUE wqueue[2]; /* queues on waiting requests for new/old pages */
196
 
  uint requests;          /* number of requests for the block                */
 
196
  uint32_t requests;          /* number of requests for the block                */
197
197
  unsigned char *buffer;           /* buffer for the block page                       */
198
 
  uint offset;            /* beginning of modified data in the buffer        */
199
 
  uint length;            /* end of data in the buffer                       */
200
 
  uint status;            /* state of the block                              */
 
198
  uint32_t offset;            /* beginning of modified data in the buffer        */
 
199
  uint32_t length;            /* end of data in the buffer                       */
 
200
  uint32_t status;            /* state of the block                              */
201
201
  enum BLOCK_TEMPERATURE temperature; /* block temperature: cold, warm, hot */
202
 
  uint hits_left;         /* number of hits left until promotion             */
 
202
  uint32_t hits_left;         /* number of hits left until promotion             */
203
203
  uint64_t last_hit_time; /* timestamp of the last hit                      */
204
204
  KEYCACHE_CONDVAR *condvar; /* condition variable for 'no readers' event    */
205
205
};
236
236
#define keycache_pthread_mutex_unlock pthread_mutex_unlock
237
237
#define keycache_pthread_cond_signal pthread_cond_signal
238
238
 
239
 
static inline uint next_power(uint value)
 
239
static inline uint32_t next_power(uint32_t value)
240
240
{
241
241
  return (uint) my_round_up_to_next_power((uint32_t) value) << 1;
242
242
}
267
267
 
268
268
*/
269
269
 
270
 
int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
271
 
                   size_t use_mem, uint division_limit,
272
 
                   uint age_threshold)
 
270
int init_key_cache(KEY_CACHE *keycache, uint32_t key_cache_block_size,
 
271
                   size_t use_mem, uint32_t division_limit,
 
272
                   uint32_t age_threshold)
273
273
{
274
274
  uint32_t blocks, hash_links;
275
275
  size_t length;
446
446
    (when cnt_for_resize=0).
447
447
*/
448
448
 
449
 
int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
450
 
                     size_t use_mem, uint division_limit,
451
 
                     uint age_threshold)
 
449
int resize_key_cache(KEY_CACHE *keycache, uint32_t key_cache_block_size,
 
450
                     size_t use_mem, uint32_t division_limit,
 
451
                     uint32_t age_threshold)
452
452
{
453
453
  int blocks;
454
454
 
580
580
    age_threshold.
581
581
*/
582
582
 
583
 
void change_key_cache_param(KEY_CACHE *keycache, uint division_limit,
584
 
                            uint age_threshold)
 
583
void change_key_cache_param(KEY_CACHE *keycache, uint32_t division_limit,
 
584
                            uint32_t age_threshold)
585
585
{
586
586
  keycache_pthread_mutex_lock(&keycache->cache_lock);
587
587
  if (division_limit)
2098
2098
*/
2099
2099
 
2100
2100
static void read_block(KEY_CACHE *keycache,
2101
 
                       BLOCK_LINK *block, uint read_length,
2102
 
                       uint min_length, bool primary)
 
2101
                       BLOCK_LINK *block, uint32_t read_length,
 
2102
                       uint32_t min_length, bool primary)
2103
2103
{
2104
 
  uint got_length;
 
2104
  uint32_t got_length;
2105
2105
 
2106
2106
  /* On entry cache_lock is locked */
2107
2107
 
2199
2199
 
2200
2200
unsigned char *key_cache_read(KEY_CACHE *keycache,
2201
2201
                      File file, my_off_t filepos, int level,
2202
 
                      unsigned char *buff, uint length,
2203
 
                      uint block_length __attribute__((unused)),
 
2202
                      unsigned char *buff, uint32_t length,
 
2203
                      uint32_t block_length __attribute__((unused)),
2204
2204
                      int return_buffer __attribute__((unused)))
2205
2205
{
2206
2206
  bool locked_and_incremented= false;
2211
2211
  {
2212
2212
    /* Key cache is used */
2213
2213
    register BLOCK_LINK *block;
2214
 
    uint read_length;
2215
 
    uint offset;
2216
 
    uint status;
 
2214
    uint32_t read_length;
 
2215
    uint32_t offset;
 
2216
    uint32_t status;
2217
2217
    int page_st;
2218
2218
 
2219
2219
    /*
2391
2391
 
2392
2392
int key_cache_insert(KEY_CACHE *keycache,
2393
2393
                     File file, my_off_t filepos, int level,
2394
 
                     unsigned char *buff, uint length)
 
2394
                     unsigned char *buff, uint32_t length)
2395
2395
{
2396
2396
  int error= 0;
2397
2397
 
2399
2399
  {
2400
2400
    /* Key cache is used */
2401
2401
    register BLOCK_LINK *block;
2402
 
    uint read_length;
2403
 
    uint offset;
 
2402
    uint32_t read_length;
 
2403
    uint32_t offset;
2404
2404
    int page_st;
2405
2405
    bool locked_and_incremented= false;
2406
2406
 
2625
2625
 
2626
2626
int key_cache_write(KEY_CACHE *keycache,
2627
2627
                    File file, my_off_t filepos, int level,
2628
 
                    unsigned char *buff, uint length,
2629
 
                    uint block_length  __attribute__((unused)),
 
2628
                    unsigned char *buff, uint32_t length,
 
2629
                    uint32_t block_length  __attribute__((unused)),
2630
2630
                    int dont_write)
2631
2631
{
2632
2632
  bool locked_and_incremented= false;
2648
2648
  {
2649
2649
    /* Key cache is used */
2650
2650
    register BLOCK_LINK *block;
2651
 
    uint read_length;
2652
 
    uint offset;
 
2651
    uint32_t read_length;
 
2652
    uint32_t offset;
2653
2653
    int page_st;
2654
2654
 
2655
2655
    /*
3052
3052
{
3053
3053
  int error;
3054
3054
  int last_errno= 0;
3055
 
  uint count= (uint) (end-cache);
 
3055
  uint32_t count= (uint) (end-cache);
3056
3056
 
3057
3057
  /* Don't lock the cache during the flush */
3058
3058
  keycache_pthread_mutex_unlock(&keycache->cache_lock);
3184
3184
  {
3185
3185
    /* Key cache exists and flush is not disabled */
3186
3186
    int error= 0;
3187
 
    uint count= FLUSH_CACHE;
 
3187
    uint32_t count= FLUSH_CACHE;
3188
3188
    BLOCK_LINK **pos,**end;
3189
3189
    BLOCK_LINK *first_in_switch= NULL;
3190
3190
    BLOCK_LINK *last_in_flush;
3433
3433
    {
3434
3434
      BLOCK_LINK *last_for_update= NULL;
3435
3435
      BLOCK_LINK *last_in_switch= NULL;
3436
 
      uint total_found= 0;
3437
 
      uint found;
 
3436
      uint32_t total_found= 0;
 
3437
      uint32_t found;
3438
3438
 
3439
3439
      /*
3440
3440
        Finally free all clean blocks for this file.
3472
3472
              struct st_hash_link *next_hash_link= NULL;
3473
3473
              my_off_t            next_diskpos= 0;
3474
3474
              File                next_file= 0;
3475
 
              uint                next_status= 0;
3476
 
              uint                hash_requests= 0;
 
3475
              uint32_t                next_status= 0;
 
3476
              uint32_t                hash_requests= 0;
3477
3477
 
3478
3478
              total_found++;
3479
3479
              found++;
3651
3651
static int flush_all_key_blocks(KEY_CACHE *keycache)
3652
3652
{
3653
3653
  BLOCK_LINK    *block;
3654
 
  uint          total_found;
3655
 
  uint          found;
3656
 
  uint          idx;
 
3654
  uint32_t          total_found;
 
3655
  uint32_t          found;
 
3656
  uint32_t          idx;
3657
3657
 
3658
3658
  do
3659
3659
  {
3784
3784
  BLOCK_LINK *block;
3785
3785
  HASH_LINK *hash_link;
3786
3786
  KEYCACHE_PAGE *page;
3787
 
  uint i;
 
3787
  uint32_t i;
3788
3788
 
3789
3789
  fprintf(keycache_dump_file, "thread:%u\n", thread->id);
3790
3790