Commit 491c2cbc authored by unknown's avatar unknown

os0file.c Removed extraneous undef and inclde of aio.h, fixed typecasts to off_t

os0file.c	Removed unnecessary code from os_file_read


innobase/os/os0file.c:
  Removed extraneous undef and inclde of aio.h, fixed typecasts to off_t
parent 43ea79bd
...@@ -15,9 +15,6 @@ Created 10/21/1995 Heikki Tuuri ...@@ -15,9 +15,6 @@ Created 10/21/1995 Heikki Tuuri
/* We assume in this case that the OS has standard Posix aio (at least SunOS /* We assume in this case that the OS has standard Posix aio (at least SunOS
2.6, HP-UX 11i and AIX 4.3 have) */ 2.6, HP-UX 11i and AIX 4.3 have) */
#undef __USE_FILE_OFFSET64
#include <aio.h>
#endif #endif
/* We use these mutexes to protect lseek + file i/o operation, if the /* We use these mutexes to protect lseek + file i/o operation, if the
...@@ -520,8 +517,10 @@ os_file_pread( ...@@ -520,8 +517,10 @@ os_file_pread(
ulint n, /* in: number of bytes to read */ ulint n, /* in: number of bytes to read */
ulint offset) /* in: offset from where to read */ ulint offset) /* in: offset from where to read */
{ {
off_t offs = (off_t)offset;
#ifdef HAVE_PREAD #ifdef HAVE_PREAD
return(pread(file, buf, n, (off_t) offset)); return(pread(file, buf, n, offs));
#else #else
ssize_t ret; ssize_t ret;
ulint i; ulint i;
...@@ -531,7 +530,7 @@ os_file_pread( ...@@ -531,7 +530,7 @@ os_file_pread(
os_mutex_enter(os_file_seek_mutexes[i]); os_mutex_enter(os_file_seek_mutexes[i]);
ret = lseek(file, (off_t) offset, 0); ret = lseek(file, offs, 0);
if (ret < 0) { if (ret < 0) {
os_mutex_exit(os_file_seek_mutexes[i]); os_mutex_exit(os_file_seek_mutexes[i]);
...@@ -560,9 +559,10 @@ os_file_pwrite( ...@@ -560,9 +559,10 @@ os_file_pwrite(
ulint offset) /* in: offset where to write */ ulint offset) /* in: offset where to write */
{ {
ssize_t ret; ssize_t ret;
off_t offs = (off_t)offset;
#ifdef HAVE_PWRITE #ifdef HAVE_PWRITE
ret = pwrite(file, buf, n, (off_t) offset); ret = pwrite(file, buf, n, offs);
/* Always do fsync to reduce the probability that when the OS crashes, /* Always do fsync to reduce the probability that when the OS crashes,
a database page is only partially physically written to disk. */ a database page is only partially physically written to disk. */
...@@ -578,7 +578,7 @@ os_file_pwrite( ...@@ -578,7 +578,7 @@ os_file_pwrite(
os_mutex_enter(os_file_seek_mutexes[i]); os_mutex_enter(os_file_seek_mutexes[i]);
ret = lseek(file, (off_t) offset, 0); ret = lseek(file, offs, 0);
if (ret < 0) { if (ret < 0) {
os_mutex_exit(os_file_seek_mutexes[i]); os_mutex_exit(os_file_seek_mutexes[i]);
...@@ -661,7 +661,6 @@ try_again: ...@@ -661,7 +661,6 @@ try_again:
#else #else
ibool retry; ibool retry;
ssize_t ret; ssize_t ret;
ulint i;
#if (UNIV_WORD_SIZE == 8) #if (UNIV_WORD_SIZE == 8)
offset = offset + (offset_high << 32); offset = offset + (offset_high << 32);
...@@ -669,15 +668,9 @@ try_again: ...@@ -669,15 +668,9 @@ try_again:
UT_NOT_USED(offset_high); UT_NOT_USED(offset_high);
#endif #endif
try_again: try_again:
/* Protect the seek / read operation with a mutex */ ret = os_file_pread(file, buf, n, offset);
i = ((ulint) file) % OS_FILE_N_SEEK_MUTEXES;
os_mutex_enter(os_file_seek_mutexes[i]);
ret = os_file_pread(file, buf, n, (off_t) offset);
if ((ulint)ret == n) { if ((ulint)ret == n) {
os_mutex_exit(os_file_seek_mutexes[i]);
return(TRUE); return(TRUE);
} }
...@@ -767,7 +760,7 @@ try_again: ...@@ -767,7 +760,7 @@ try_again:
UT_NOT_USED(offset_high); UT_NOT_USED(offset_high);
#endif #endif
try_again: try_again:
ret = os_file_pwrite(file, buf, n, (off_t) offset); ret = os_file_pwrite(file, buf, n, offset);
if ((ulint)ret == n) { if ((ulint)ret == n) {
return(TRUE); return(TRUE);
......
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