Commit 6629c764 authored by Michael Widenius's avatar Michael Widenius

Fixed some wrong usage of my_bool

Fixed compiler warning
Ensure that pagecache returns correct error number


storage/maria/ma_pagecache.c:
  Ensure that block->error contain error code from my_errno (not return value from pread/pwrite)
  Went through usage of my_pread/my_pwrite and ensured that result was threated correctly
  Fixed some wrong usage of my_bool
parent 43528b9d
......@@ -593,10 +593,10 @@ extern my_bool translog_flush(TRANSLOG_ADDRESS lsn);
RETURN
0 - OK
!=0 - Error
1 - Error
*/
static uint pagecache_fwrite(PAGECACHE *pagecache,
static my_bool pagecache_fwrite(PAGECACHE *pagecache,
PAGECACHE_FILE *filedesc,
uchar *buffer,
pgcache_page_no_t pageno,
......@@ -2069,7 +2069,7 @@ restart:
(my_bool)(block->hash_link ? 1 : 0));
PCBLOCK_INFO(block);
block->status= error ? PCBLOCK_ERROR : 0;
block->error= error;
block->error= (int16) my_errno;
#ifndef DBUG_OFF
block->type= PAGECACHE_EMPTY_PAGE;
if (error)
......@@ -2608,7 +2608,7 @@ static void read_block(PAGECACHE *pagecache,
if (error)
{
block->status|= PCBLOCK_ERROR;
block->error= error;
block->error= (int16) my_errno;
my_debug_put_break_here();
}
else
......@@ -2621,7 +2621,7 @@ static void read_block(PAGECACHE *pagecache,
{
DBUG_PRINT("error", ("read callback problem"));
block->status|= PCBLOCK_ERROR;
block->error= my_errno;
block->error= (int16) my_errno;
my_debug_put_break_here();
}
}
......@@ -3111,7 +3111,7 @@ uchar *pagecache_read(PAGECACHE *pagecache,
enum pagecache_page_lock lock,
PAGECACHE_BLOCK_LINK **page_link)
{
int error= 0;
my_bool error= 0;
enum pagecache_page_pin pin= lock_to_pin[test(buff==0)][lock];
PAGECACHE_BLOCK_LINK *fake_link;
my_bool reg_request;
......@@ -3292,7 +3292,7 @@ static my_bool pagecache_delete_internal(PAGECACHE *pagecache,
PAGECACHE_HASH_LINK *page_link,
my_bool flush)
{
int error= 0;
my_bool error= 0;
if (block->status & PCBLOCK_CHANGED)
{
if (flush)
......@@ -3319,7 +3319,7 @@ static my_bool pagecache_delete_internal(PAGECACHE *pagecache,
if (error)
{
block->status|= PCBLOCK_ERROR;
block->error= error;
block->error= (int16) my_errno;
my_debug_put_break_here();
goto err;
}
......@@ -3368,7 +3368,7 @@ my_bool pagecache_delete_by_link(PAGECACHE *pagecache,
enum pagecache_page_lock lock,
my_bool flush)
{
int error= 0;
my_bool error= 0;
enum pagecache_page_pin pin= PAGECACHE_PIN_LEFT_PINNED;
DBUG_ENTER("pagecache_delete_by_link");
DBUG_PRINT("enter", ("fd: %d block 0x%lx %s %s",
......@@ -3467,7 +3467,7 @@ my_bool pagecache_delete(PAGECACHE *pagecache,
enum pagecache_page_lock lock,
my_bool flush)
{
int error= 0;
my_bool error= 0;
enum pagecache_page_pin pin= lock_to_pin[0][lock];
DBUG_ENTER("pagecache_delete");
DBUG_PRINT("enter", ("fd: %u page: %lu %s %s",
......@@ -3655,7 +3655,7 @@ my_bool pagecache_write_part(PAGECACHE *pagecache,
{
PAGECACHE_BLOCK_LINK *block= NULL;
PAGECACHE_BLOCK_LINK *fake_link;
int error= 0;
my_bool error= 0;
int need_lock_change= write_lock_change_table[lock].need_lock_change;
my_bool reg_request;
#ifndef DBUG_OFF
......@@ -3778,7 +3778,7 @@ restart:
{
DBUG_PRINT("error", ("read callback problem"));
block->status|= PCBLOCK_ERROR;
block->error= my_errno;
block->error= (int16) my_errno;
my_debug_put_break_here();
}
KEYCACHE_DBUG_PRINT("key_cache_insert",
......@@ -3868,10 +3868,10 @@ no_key_cache:
uchar *page_buffer= (uchar *) alloca(pagecache->block_size);
pagecache->global_cache_read++;
if ((error= pagecache_fread(pagecache, file,
if ((error= (pagecache_fread(pagecache, file,
page_buffer,
pageno,
pagecache->readwrite_flags)))
pagecache->readwrite_flags) != 0)))
goto end;
if ((file->read_callback)(page_buffer, pageno, file->callback_data))
{
......@@ -3995,7 +3995,7 @@ static int flush_cached_blocks(PAGECACHE *pagecache,
int *first_errno)
{
int rc= PCFLUSH_OK;
int error;
my_bool error;
uint count= (uint) (end-cache);
DBUG_ENTER("flush_cached_blocks");
*first_errno= 0;
......@@ -4075,7 +4075,7 @@ static int flush_cached_blocks(PAGECACHE *pagecache,
if (error)
{
block->status|= PCBLOCK_ERROR;
block->error= error;
block->error= (int16) my_errno;
my_debug_put_break_here();
if (!*first_errno)
*first_errno= my_errno ? my_errno : -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment