summaryrefslogtreecommitdiff
path: root/storage/innobase/row
diff options
context:
space:
mode:
authorVasil Dimov <vasil.dimov@oracle.com>2010-05-21 21:09:51 +0300
committerVasil Dimov <vasil.dimov@oracle.com>2010-05-21 21:09:51 +0300
commit6788201e76bd13a5c8e2546acdf75ff55ebcf897 (patch)
treedda514d2c6c2ef2d18563446cc73129c4729d4d7 /storage/innobase/row
parent5862a54b86c6e0a12b3f1f07e8d8c5a4f61db0cf (diff)
downloadmariadb-git-6788201e76bd13a5c8e2546acdf75ff55ebcf897.tar.gz
Use the correct len instead of sizeof(void) in posix_fadvise()
Also explain in the comment the units of the "offset" parameter
Diffstat (limited to 'storage/innobase/row')
-rw-r--r--storage/innobase/row/row0merge.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/storage/innobase/row/row0merge.c b/storage/innobase/row/row0merge.c
index 0e03ea3e178..d9084bb4ffd 100644
--- a/storage/innobase/row/row0merge.c
+++ b/storage/innobase/row/row0merge.c
@@ -696,7 +696,9 @@ ibool
row_merge_read(
/*===========*/
int fd, /*!< in: file descriptor */
- ulint offset, /*!< in: offset where to read */
+ ulint offset, /*!< in: offset where to read
+ in number of row_merge_block_t
+ elements */
row_merge_block_t* buf) /*!< out: data */
{
ib_uint64_t ofs = ((ib_uint64_t) offset) * sizeof *buf;
@@ -735,17 +737,18 @@ ibool
row_merge_write(
/*============*/
int fd, /*!< in: file descriptor */
- ulint offset, /*!< in: offset where to write */
+ ulint offset, /*!< in: offset where to write,
+ in number of row_merge_block_t elements */
const void* buf) /*!< in: data */
{
- ib_uint64_t ofs = ((ib_uint64_t) offset)
- * sizeof(row_merge_block_t);
+ size_t buf_len = sizeof(row_merge_block_t);
+ ib_uint64_t ofs = buf_len * (ib_uint64_t) offset;
ibool ret;
ret = os_file_write("(merge)", OS_FILE_FROM_FD(fd), buf,
(ulint) (ofs & 0xFFFFFFFF),
(ulint) (ofs >> 32),
- sizeof(row_merge_block_t));
+ buf_len);
#ifdef UNIV_DEBUG
if (row_merge_print_block_write) {
@@ -757,7 +760,7 @@ row_merge_write(
#ifdef POSIX_FADV_DONTNEED
/* The block will be needed on the next merge pass,
but it can be evicted from the file cache meanwhile. */
- posix_fadvise(fd, ofs, sizeof *buf, POSIX_FADV_DONTNEED);
+ posix_fadvise(fd, ofs, buf_len, POSIX_FADV_DONTNEED);
#endif /* POSIX_FADV_DONTNEED */
return(UNIV_LIKELY(ret));