summaryrefslogtreecommitdiff
path: root/innobase/os/os0file.c
diff options
context:
space:
mode:
authorunknown <monty@donna.mysql.fi>2001-10-30 17:38:44 +0200
committerunknown <monty@donna.mysql.fi>2001-10-30 17:38:44 +0200
commit7b24c57c56b150132f0c4b541ef23a20f8f74ace (patch)
tree097886eb981160413975cb915243d4ae60718154 /innobase/os/os0file.c
parentfed395c75224ee11c1cd53fc24285e8575c6bec8 (diff)
downloadmariadb-git-7b24c57c56b150132f0c4b541ef23a20f8f74ace.tar.gz
Merge
include/my_base.h: Try again merge InnoDB-3.23.44 include/mysqld_error.h: Try again merge InnoDB-3.23.44 sql/handler.cc: Try again merge InnoDB-3.23.44 sql/mysqld.cc: Try again merge InnoDB-3.23.44 sql/ha_innobase.cc: Try again merge InnoDB-3.23.44 sql/ha_innobase.h: Try again merge InnoDB-3.23.44 sql/share/czech/errmsg.txt: Try again merge InnoDB-3.23.44 sql/share/danish/errmsg.txt: Try again merge InnoDB-3.23.44 sql/share/dutch/errmsg.txt: Try again merge InnoDB-3.23.44 sql/share/english/errmsg.txt: Try again merge InnoDB-3.23.44 sql/share/estonian/errmsg.txt: Try again merge InnoDB-3.23.44 sql/share/french/errmsg.txt: Try again merge InnoDB-3.23.44 sql/share/german/errmsg.txt: Try again merge InnoDB-3.23.44 sql/share/greek/errmsg.txt: Try again merge InnoDB-3.23.44 sql/share/hungarian/errmsg.txt: Try again merge InnoDB-3.23.44 sql/share/italian/errmsg.txt: Try again merge InnoDB-3.23.44 sql/share/japanese/errmsg.txt: Try again merge InnoDB-3.23.44 sql/share/korean/errmsg.txt: Try again merge InnoDB-3.23.44 sql/share/norwegian-ny/errmsg.txt: Try again merge InnoDB-3.23.44 sql/share/norwegian/errmsg.txt: Try again merge InnoDB-3.23.44 sql/share/polish/errmsg.txt: Try again merge InnoDB-3.23.44 sql/share/portuguese/errmsg.txt: Try again merge InnoDB-3.23.44 sql/share/romanian/errmsg.txt: Try again merge InnoDB-3.23.44 sql/share/russian/errmsg.txt: Try again merge InnoDB-3.23.44 sql/share/slovak/errmsg.txt: Try again merge InnoDB-3.23.44 sql/share/spanish/errmsg.txt: Try again merge InnoDB-3.23.44 sql/share/swedish/errmsg.txt: Try again merge InnoDB-3.23.44 sql/share/ukrainian/errmsg.txt: Try again merge InnoDB-3.23.44 innobase/btr/btr0btr.c: Try again merge InnoDB-3.23.44 innobase/buf/buf0flu.c: Try again merge InnoDB-3.23.44 innobase/buf/buf0lru.c: Try again merge InnoDB-3.23.44 innobase/dict/dict0boot.c: Try again merge InnoDB-3.23.44 innobase/dict/dict0crea.c: Try again merge InnoDB-3.23.44 innobase/dict/dict0dict.c: Try again merge InnoDB-3.23.44 innobase/ibuf/ibuf0ibuf.c: Try again merge InnoDB-3.23.44 innobase/include/dict0boot.h: Try again merge InnoDB-3.23.44 innobase/include/dict0boot.ic: Try again merge InnoDB-3.23.44 innobase/include/dict0dict.h: Try again merge InnoDB-3.23.44 innobase/include/os0file.h: Try again merge InnoDB-3.23.44 innobase/include/os0sync.h: Try again merge InnoDB-3.23.44 innobase/include/page0page.ic: Try again merge InnoDB-3.23.44 innobase/include/read0read.h: Try again merge InnoDB-3.23.44 innobase/include/row0mysql.h: Try again merge InnoDB-3.23.44 innobase/include/srv0srv.h: Try again merge InnoDB-3.23.44 innobase/include/srv0start.h: Try again merge InnoDB-3.23.44 innobase/include/trx0purge.h: Try again merge InnoDB-3.23.44 innobase/include/trx0rec.h: Try again merge InnoDB-3.23.44 innobase/include/trx0trx.h: Try again merge InnoDB-3.23.44 innobase/lock/lock0lock.c: Try again merge InnoDB-3.23.44 innobase/log/log0log.c: Try again merge InnoDB-3.23.44 innobase/log/log0recv.c: Try again merge InnoDB-3.23.44 innobase/os/os0file.c: Try again merge InnoDB-3.23.44 innobase/page/page0page.c: Try again merge InnoDB-3.23.44 innobase/read/read0read.c: Try again merge InnoDB-3.23.44 innobase/rem/rem0cmp.c: Try again merge InnoDB-3.23.44 innobase/rem/rem0rec.c: Try again merge InnoDB-3.23.44 innobase/row/row0ins.c: Try again merge InnoDB-3.23.44 innobase/row/row0mysql.c: Try again merge InnoDB-3.23.44 innobase/row/row0purge.c: Try again merge InnoDB-3.23.44 innobase/row/row0row.c: Try again merge InnoDB-3.23.44 innobase/row/row0sel.c: Try again merge InnoDB-3.23.44 innobase/row/row0umod.c: Try again merge InnoDB-3.23.44 innobase/row/row0upd.c: Try again merge InnoDB-3.23.44 innobase/row/row0vers.c: Try again merge InnoDB-3.23.44 innobase/srv/srv0start.c: Try again merge InnoDB-3.23.44 innobase/sync/sync0arr.c: Try again merge InnoDB-3.23.44 innobase/trx/trx0purge.c: Try again merge InnoDB-3.23.44 innobase/trx/trx0rec.c: Try again merge InnoDB-3.23.44 innobase/trx/trx0roll.c: Try again merge InnoDB-3.23.44 innobase/trx/trx0sys.c: Try again merge InnoDB-3.23.44 innobase/trx/trx0trx.c: Try again merge InnoDB-3.23.44 innobase/trx/trx0undo.c: Try again merge InnoDB-3.23.44 innobase/srv/srv0srv.c: Commit change made by heikki BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
Diffstat (limited to 'innobase/os/os0file.c')
-rw-r--r--innobase/os/os0file.c126
1 files changed, 85 insertions, 41 deletions
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c
index ced601d4de1..adab2d56322 100644
--- a/innobase/os/os0file.c
+++ b/innobase/os/os0file.c
@@ -235,7 +235,7 @@ os_file_handle_error(
fprintf(stderr,
"InnoDB: Cannot continue operation.\n"
"InnoDB: Disk is full. Try to clean the disk to free space.\n"
- "InnoDB: Delete possible created file and restart.\n");
+ "InnoDB: Delete a possible created file and restart.\n");
exit(1);
@@ -453,8 +453,17 @@ os_file_get_size(
return(TRUE);
#else
- *size = (ulint) lseek(file, 0, SEEK_END);
- *size_high = 0;
+ off_t offs;
+
+ offs = lseek(file, 0, SEEK_END);
+
+ if (sizeof(off_t) > 4) {
+ *size = (ulint)(offs & 0xFFFFFFFF);
+ *size_high = (ulint)((offs / (256 * 256)) / (256 * 256));
+ } else {
+ *size = (ulint) offs;
+ *size_high = 0;
+ }
return(TRUE);
#endif
@@ -474,17 +483,19 @@ os_file_set_size(
size */
ulint size_high)/* in: most significant 32 bits of size */
{
- ulint offset;
- ulint n_bytes;
- ulint low;
- ibool ret;
- ibool retry;
- ulint i;
- byte* buf;
+ ib_longlong offset;
+ ib_longlong low;
+ ulint n_bytes;
+ ibool ret;
+ ibool retry;
+ byte* buf;
+ ulint i;
+
+ ut_a(((((size / 256) / 256) / 256) / 256) == 0);
try_again:
/* We use a very big 8 MB buffer in writing because Linux may be
- extremely slow in fdatasync on 1 MB writes */
+ extremely slow in fsync on 1 MB writes */
buf = ut_malloc(UNIV_PAGE_SIZE * 512);
@@ -494,21 +505,19 @@ try_again:
}
offset = 0;
- low = size;
-#if (UNIV_WORD_SIZE == 8)
- low = low + (size_high << 32);
-#else
- UT_NOT_USED(size_high);
-#endif
+ low = (ib_longlong)size + (((ib_longlong)size_high)
+ * 256) * 256 * 256 * 256;
while (offset < low) {
if (low - offset < UNIV_PAGE_SIZE * 512) {
- n_bytes = low - offset;
+ n_bytes = (ulint)(low - offset);
} else {
- n_bytes = UNIV_PAGE_SIZE * 512;
+ n_bytes = UNIV_PAGE_SIZE * 512;
}
- ret = os_file_write(name, file, buf, offset, 0, n_bytes);
-
+ ret = os_file_write(name, file, buf,
+ (ulint)(offset & 0xFFFFFFFF),
+ (ulint)((((offset / 256) / 256) / 256) / 256),
+ n_bytes);
if (!ret) {
ut_free(buf);
goto error_handling;
@@ -582,7 +591,6 @@ os_file_flush(
#endif
}
-
#ifndef __WIN__
/***********************************************************************
Does a synchronous read operation in Posix. */
@@ -594,9 +602,29 @@ os_file_pread(
os_file_t file, /* in: handle to a file */
void* buf, /* in: buffer where to read */
ulint n, /* in: number of bytes to read */
- ulint offset) /* in: offset from where to read */
+ ulint offset, /* in: least significant 32 bits of file
+ offset from where to read */
+ ulint offset_high) /* in: most significant 32 bits of
+ offset */
{
- off_t offs = (off_t)offset;
+ off_t offs;
+
+ ut_a(((((offset / 256) / 256) / 256) / 256) == 0);
+
+ /* If off_t is > 4 bytes in size, then we assume we can pass a
+ 64-bit address */
+
+ if (sizeof(off_t) > 4) {
+ offs = (off_t)offset + ((((off_t)offset_high)
+ * 256) * 256 * 256 * 256);
+ } else {
+ offs = (off_t)offset;
+
+ if (offset_high > 0) {
+ fprintf(stderr,
+ "InnoDB: Error: file read at offset > 4 GB\n");
+ }
+ }
os_n_file_reads++;
@@ -639,10 +667,30 @@ os_file_pwrite(
os_file_t file, /* in: handle to a file */
void* buf, /* in: buffer from where to write */
ulint n, /* in: number of bytes to write */
- ulint offset) /* in: offset where to write */
+ ulint offset, /* in: least significant 32 bits of file
+ offset where to write */
+ ulint offset_high) /* in: most significant 32 bits of
+ offset */
{
ssize_t ret;
- off_t offs = (off_t)offset;
+ off_t offs;
+
+ ut_a(((((offset / 256) / 256) / 256) / 256) == 0);
+
+ /* If off_t is > 4 bytes in size, then we assume we can pass a
+ 64-bit address */
+
+ if (sizeof(off_t) > 4) {
+ offs = (off_t)offset + ((((off_t)offset_high)
+ * 256) * 256 * 256 * 256);
+ } else {
+ offs = (off_t)offset;
+
+ if (offset_high > 0) {
+ fprintf(stderr,
+ "InnoDB: Error: file write at offset > 4 GB\n");
+ }
+ }
os_n_file_writes++;
@@ -724,6 +772,8 @@ os_file_read(
ibool retry;
ulint i;
+ ut_a(((((offset / 256) / 256) / 256) / 256) == 0);
+
os_n_file_reads++;
try_again:
@@ -758,14 +808,9 @@ try_again:
#else
ibool retry;
ssize_t ret;
-
-#if (UNIV_WORD_SIZE == 8)
- offset = offset + (offset_high << 32);
-#else
- UT_NOT_USED(offset_high);
-#endif
+
try_again:
- ret = os_file_pread(file, buf, n, offset);
+ ret = os_file_pread(file, buf, n, offset, offset_high);
if ((ulint)ret == n) {
@@ -811,6 +856,8 @@ os_file_write(
ibool retry;
ulint i;
+ ut_a(((((offset / 256) / 256) / 256) / 256) == 0);
+
os_n_file_writes++;
try_again:
ut_ad(file);
@@ -852,13 +899,8 @@ try_again:
ibool retry;
ssize_t ret;
-#if (UNIV_WORD_SIZE == 8)
- offset = offset + (offset_high << 32);
-#else
- UT_NOT_USED(offset_high);
-#endif
try_again:
- ret = os_file_pwrite(file, buf, n, offset);
+ ret = os_file_pwrite(file, buf, n, offset, offset_high);
if ((ulint)ret == n) {
return(TRUE);
@@ -1321,8 +1363,8 @@ os_aio_simulated_wake_handler_thread(
arrays */
{
os_aio_array_t* array;
- ulint segment;
os_aio_slot_t* slot;
+ ulint segment;
ulint n;
ulint i;
@@ -1424,6 +1466,7 @@ os_aio(
ibool retry;
ulint wake_later;
+ ut_a(((((offset / 256) / 256) / 256) / 256) == 0);
ut_ad(file);
ut_ad(buf);
ut_ad(n > 0);
@@ -1817,7 +1860,8 @@ restart:
n_consecutive = 0;
- /* Look for an i/o request at the lowest offset in the array */
+ /* Look for an i/o request at the lowest offset in the array
+ (we ignore the high 32 bits of the offset in these heuristics) */
lowest_offset = ULINT_MAX;