Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
d4aef382
Commit
d4aef382
authored
Dec 03, 2014
by
Jan Lindström
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix compiler failure on fallocate function and used flags.
parent
01590005
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
183 additions
and
114 deletions
+183
-114
config.h.cmake
config.h.cmake
+2
-0
configure.cmake
configure.cmake
+2
-0
storage/innobase/include/fil0pagecompress.h
storage/innobase/include/fil0pagecompress.h
+7
-0
storage/innobase/include/fsp0pagecompress.ic
storage/innobase/include/fsp0pagecompress.ic
+13
-0
storage/innobase/os/os0file.cc
storage/innobase/os/os0file.cc
+69
-56
storage/xtradb/include/fil0pagecompress.h
storage/xtradb/include/fil0pagecompress.h
+7
-0
storage/xtradb/include/fsp0pagecompress.ic
storage/xtradb/include/fsp0pagecompress.ic
+13
-0
storage/xtradb/os/os0file.cc
storage/xtradb/os/os0file.cc
+70
-58
No files found.
config.h.cmake
View file @
d4aef382
...
...
@@ -216,6 +216,8 @@
#cmakedefine HAVE_POLL 1
#cmakedefine HAVE_PORT_CREATE 1
#cmakedefine HAVE_POSIX_FALLOCATE 1
#cmakedefine HAVE_LINUX_FALLOC_H 1
#cmakedefine HAVE_FALLOCATE 1
#cmakedefine HAVE_PREAD 1
#cmakedefine HAVE_PAUSE_INSTRUCTION 1
#cmakedefine HAVE_FAKE_PAUSE_INSTRUCTION 1
...
...
configure.cmake
View file @
d4aef382
...
...
@@ -199,6 +199,7 @@ CHECK_INCLUDE_FILES (ieeefp.h HAVE_IEEEFP_H)
CHECK_INCLUDE_FILES
(
inttypes.h HAVE_INTTYPES_H
)
CHECK_INCLUDE_FILES
(
langinfo.h HAVE_LANGINFO_H
)
CHECK_INCLUDE_FILES
(
linux/unistd.h HAVE_LINUX_UNISTD_H
)
CHECK_INCLUDE_FILES
(
linux/falloc.h HAVE_LINUX_FALLOC_H
)
CHECK_INCLUDE_FILES
(
limits.h HAVE_LIMITS_H
)
CHECK_INCLUDE_FILES
(
locale.h HAVE_LOCALE_H
)
CHECK_INCLUDE_FILES
(
malloc.h HAVE_MALLOC_H
)
...
...
@@ -399,6 +400,7 @@ CHECK_FUNCTION_EXISTS (perror HAVE_PERROR)
CHECK_FUNCTION_EXISTS
(
poll HAVE_POLL
)
CHECK_FUNCTION_EXISTS
(
port_create HAVE_PORT_CREATE
)
CHECK_FUNCTION_EXISTS
(
posix_fallocate HAVE_POSIX_FALLOCATE
)
CHECK_FUNCTION_EXISTS
(
fallocate HAVE_FALLOCATE
)
CHECK_FUNCTION_EXISTS
(
pread HAVE_PREAD
)
CHECK_FUNCTION_EXISTS
(
pthread_attr_create HAVE_PTHREAD_ATTR_CREATE
)
CHECK_FUNCTION_EXISTS
(
pthread_attr_getstacksize HAVE_PTHREAD_ATTR_GETSTACKSIZE
)
...
...
storage/innobase/include/fil0pagecompress.h
View file @
d4aef382
...
...
@@ -135,4 +135,11 @@ fil_page_is_compressed(
/*===================*/
byte
*
buf
);
/*!< in: page */
/*******************************************************************//**
Find out wheather the page is page compressed with lzo method
@return true if page is page compressed with lzo method*/
ibool
fil_page_is_lzo_compressed
(
/*=======================*/
byte
*
buf
);
/*!< in: page */
#endif
storage/innobase/include/fsp0pagecompress.ic
View file @
d4aef382
...
...
@@ -182,3 +182,16 @@ fil_space_get_atomic_writes(
return((atomic_writes_t)0);
}
/*******************************************************************//**
Find out wheather the page is page compressed with lzo method
@return true if page is page compressed with lzo method, false if not */
UNIV_INLINE
ibool
fil_page_is_lzo_compressed(
/*=======================*/
byte *buf) /*!< in: page */
{
return(mach_read_from_2(buf+FIL_PAGE_TYPE) == FIL_PAGE_PAGE_COMPRESSED &&
mach_read_from_8(buf+FIL_PAGE_FILE_FLUSH_LSN) == PAGE_LZO_ALGORITHM);
}
storage/innobase/os/os0file.cc
View file @
d4aef382
...
...
@@ -48,6 +48,7 @@ Created 10/21/1995 Heikki Tuuri
#include "srv0mon.h"
#include "srv0srv.h"
#ifdef HAVE_POSIX_FALLOCATE
#include "unistd.h"
#include "fcntl.h"
#endif
#ifndef UNIV_HOTBACKUP
...
...
@@ -77,6 +78,19 @@ Created 10/21/1995 Heikki Tuuri
#include <sys/statvfs.h>
#endif
#if defined(UNIV_LINUX) && defined(HAVE_LINUX_FALLOC_H)
#include <linux/falloc.h>
#endif
#if defined(HAVE_FALLOCATE)
#ifndef FALLOC_FL_KEEP_SIZE
#define FALLOC_FL_KEEP_SIZE 0x01
#endif
#ifndef FALLOC_FL_PUNCH_HOLE
#define FALLOC_FL_PUNCH_HOLE 0x02
#endif
#endif
#ifdef HAVE_LZO
#include "lzo/lzo1x.h"
#endif
...
...
@@ -2916,7 +2930,7 @@ os_file_read_func(
as file spaces and they do not have FIL_PAGE_TYPE
field, thus we must use here information is the actual
file space compressed. */
if
(
compressed
&&
fil_page_is_compressed
((
byte
*
)
buf
))
{
if
(
fil_page_is_compressed
((
byte
*
)
buf
))
{
fil_decompress_page
(
NULL
,
(
byte
*
)
buf
,
len
,
NULL
);
}
...
...
@@ -2936,7 +2950,7 @@ os_file_read_func(
as file spaces and they do not have FIL_PAGE_TYPE
field, thus we must use here information is the actual
file space compressed. */
if
(
compressed
&&
fil_page_is_compressed
((
byte
*
)
buf
))
{
if
(
fil_page_is_compressed
((
byte
*
)
buf
))
{
fil_decompress_page
(
NULL
,
(
byte
*
)
buf
,
n
,
NULL
);
}
...
...
@@ -3061,7 +3075,7 @@ os_file_read_no_error_handling_func(
as file spaces and they do not have FIL_PAGE_TYPE
field, thus we must use here information is the actual
file space compressed. */
if
(
compressed
&&
fil_page_is_compressed
((
byte
*
)
buf
))
{
if
(
fil_page_is_compressed
((
byte
*
)
buf
))
{
fil_decompress_page
(
NULL
,
(
byte
*
)
buf
,
n
,
NULL
);
}
...
...
@@ -3081,7 +3095,7 @@ os_file_read_no_error_handling_func(
as file spaces and they do not have FIL_PAGE_TYPE
field, thus we must use here information is the actual
file space compressed. */
if
(
compressed
&&
fil_page_is_compressed
((
byte
*
)
buf
))
{
if
(
fil_page_is_compressed
((
byte
*
)
buf
))
{
fil_decompress_page
(
NULL
,
(
byte
*
)
buf
,
n
,
NULL
);
}
...
...
@@ -4634,12 +4648,10 @@ os_aio_array_reserve_slot(
// We allocate memory for page compressed buffer if and only
// if it is not yet allocated.
if
(
slot
->
page_buf
==
NULL
)
{
os_slot_alloc_page_buf
(
slot
);
}
os_slot_alloc_page_buf
(
slot
);
#ifdef HAVE_LZO
if
(
innodb_compression_algorithm
==
3
&&
slot
->
lzo_mem
==
NULL
)
{
if
(
innodb_compression_algorithm
==
3
)
{
os_slot_alloc_lzo_mem
(
slot
);
}
#endif
...
...
@@ -5305,6 +5317,7 @@ os_aio_windows_handle(
case
OS_FILE_WRITE
:
if
(
slot
->
message1
&&
slot
->
page_compression
&&
slot
->
page_compress_success
&&
slot
->
page_buf
)
{
ret
=
WriteFile
(
slot
->
file
,
slot
->
page_buf
,
(
DWORD
)
slot
->
len
,
&
len
,
...
...
@@ -5345,26 +5358,24 @@ os_aio_windows_handle(
ret_val
=
ret
&&
len
==
slot
->
len
;
}
if
(
slot
->
message1
&&
slot
->
page_compression
)
{
// We allocate memory for page compressed buffer if and only
// if it is not yet allocated.
if
(
slot
->
page_buf
==
NULL
)
{
if
(
slot
->
type
==
OS_FILE_READ
)
{
if
(
fil_page_is_compressed
(
slot
->
buf
))
{
os_slot_alloc_page_buf
(
slot
);
}
#ifdef HAVE_LZO
if
(
innodb_compression_algorithm
==
3
&&
slot
->
lzo_mem
==
NULL
)
{
os_slot_alloc_lzo_mem
(
slot
);
}
if
(
fil_page_is_lzo_compressed
(
slot
->
buf
)
)
{
os_slot_alloc_lzo_mem
(
slot
);
}
#endif
if
(
slot
->
type
==
OS_FILE_READ
)
{
fil_decompress_page
(
slot
->
page_buf
,
slot
->
buf
,
slot
->
len
,
slot
->
write_size
);
}
else
{
if
(
slot
->
page_compress_success
&&
fil_page_is_compressed
(
slot
->
page_buf
))
{
if
(
srv_use_trim
&&
os_fallocate_failed
==
FALSE
)
{
// Deallocate unused blocks from file system
os_file_trim
(
slot
);
}
}
}
else
{
/* OS_FILE_WRITE */
if
(
slot
->
page_compress_success
&&
fil_page_is_compressed
(
slot
->
page_buf
))
{
if
(
srv_use_trim
&&
os_fallocate_failed
==
FALSE
)
{
// Deallocate unused blocks from file system
os_file_trim
(
slot
);
}
}
}
...
...
@@ -5458,32 +5469,30 @@ os_aio_linux_collect(
/* We have not overstepped to next segment. */
ut_a
(
slot
->
pos
<
end_pos
);
/* If the table is page compressed and this is read,
we decompress before we annouce the read is
complete. For writes, we free the compressed page. */
if
(
slot
->
message1
&&
slot
->
page_compression
)
{
// We allocate memory for page compressed buffer if and only
// if it is not yet allocated.
if
(
slot
->
page_buf
==
NULL
)
{
if
(
slot
->
type
==
OS_FILE_READ
)
{
/* If the table is page compressed and this is read,
we decompress before we annouce the read is
complete. For writes, we free the compressed page. */
if
(
fil_page_is_compressed
(
slot
->
buf
))
{
// We allocate memory for page compressed buffer if and only
// if it is not yet allocated.
os_slot_alloc_page_buf
(
slot
);
}
#ifdef HAVE_LZO
if
(
innodb_compression_algorithm
==
3
&&
slot
->
lzo_mem
==
NULL
)
{
os_slot_alloc_lzo_mem
(
slot
);
}
if
(
fil_page_is_lzo_compressed
(
slot
->
buf
)
)
{
os_slot_alloc_lzo_mem
(
slot
);
}
#endif
if
(
slot
->
type
==
OS_FILE_READ
)
{
fil_decompress_page
(
slot
->
page_buf
,
slot
->
buf
,
slot
->
len
,
slot
->
write_size
);
}
else
{
if
(
slot
->
page_compress_success
&&
fil_page_is_compressed
(
slot
->
page_buf
))
{
ut_ad
(
slot
->
page_compression_page
);
if
(
srv_use_trim
&&
os_fallocate_failed
==
FALSE
)
{
// Deallocate unused blocks from file system
os_file_trim
(
slot
);
}
}
}
else
{
/* OS_FILE_WRITE */
if
(
slot
->
page_compress_success
&&
fil_page_is_compressed
(
slot
->
page_buf
))
{
ut_ad
(
slot
->
page_compression_page
);
if
(
srv_use_trim
&&
os_fallocate_failed
==
FALSE
)
{
// Deallocate unused blocks from file system
os_file_trim
(
slot
);
}
}
}
...
...
@@ -6397,7 +6406,7 @@ os_file_trim(
}
#ifdef __linux__
#if defined(HAVE_
POSIX_
FALLOCATE)
#if defined(HAVE_FALLOCATE)
int
ret
=
fallocate
(
slot
->
file
,
FALLOC_FL_PUNCH_HOLE
|
FALLOC_FL_KEEP_SIZE
,
off
,
trim_len
);
if
(
ret
)
{
...
...
@@ -6435,7 +6444,7 @@ os_file_trim(
*
slot
->
write_size
=
0
;
}
#endif
/* HAVE_
POSIX_
FALLOCATE ... */
#endif
/* HAVE_FALLOCATE ... */
#elif defined(_WIN32)
FILE_LEVEL_TRIM
flt
;
...
...
@@ -6518,13 +6527,15 @@ os_slot_alloc_page_buf(
byte
*
cbuf
;
ut_a
(
slot
!=
NULL
);
/* We allocate extra to avoid memory overwrite on compression */
cbuf2
=
static_cast
<
byte
*>
(
ut_malloc
(
UNIV_PAGE_SIZE
*
2
));
cbuf
=
static_cast
<
byte
*>
(
ut_align
(
cbuf2
,
UNIV_PAGE_SIZE
));
slot
->
page_compression_page
=
static_cast
<
byte
*>
(
cbuf2
);
slot
->
page_buf
=
static_cast
<
byte
*>
(
cbuf
);
memset
(
slot
->
page_buf
,
0
,
UNIV_PAGE_SIZE
);
ut_a
(
slot
->
page_buf
!=
NULL
);
if
(
slot
->
page_compression_page
==
NULL
)
{
/* We allocate extra to avoid memory overwrite on compression */
cbuf2
=
static_cast
<
byte
*>
(
ut_malloc
(
UNIV_PAGE_SIZE
*
2
));
cbuf
=
static_cast
<
byte
*>
(
ut_align
(
cbuf2
,
UNIV_PAGE_SIZE
));
slot
->
page_compression_page
=
static_cast
<
byte
*>
(
cbuf2
);
slot
->
page_buf
=
static_cast
<
byte
*>
(
cbuf
);
memset
(
slot
->
page_compression_page
,
0
,
UNIV_PAGE_SIZE
*
2
);
ut_a
(
slot
->
page_buf
!=
NULL
);
}
}
#ifdef HAVE_LZO
...
...
@@ -6538,9 +6549,11 @@ os_slot_alloc_lzo_mem(
os_aio_slot_t
*
slot
)
/*!< in: slot structure */
{
ut_a
(
slot
!=
NULL
);
slot
->
lzo_mem
=
static_cast
<
byte
*>
(
ut_malloc
(
LZO1X_1_15_MEM_COMPRESS
));
memset
(
slot
->
lzo_mem
,
0
,
LZO1X_1_15_MEM_COMPRESS
);
ut_a
(
slot
->
lzo_mem
!=
NULL
);
if
(
slot
->
lzo_mem
==
NULL
)
{
slot
->
lzo_mem
=
static_cast
<
byte
*>
(
ut_malloc
(
LZO1X_1_15_MEM_COMPRESS
));
memset
(
slot
->
lzo_mem
,
0
,
LZO1X_1_15_MEM_COMPRESS
);
ut_a
(
slot
->
lzo_mem
!=
NULL
);
}
}
#endif
...
...
storage/xtradb/include/fil0pagecompress.h
View file @
d4aef382
...
...
@@ -135,4 +135,11 @@ fil_page_is_compressed(
/*===================*/
byte
*
buf
);
/*!< in: page */
/*******************************************************************//**
Find out wheather the page is page compressed with lzo method
@return true if page is page compressed with lzo method*/
ibool
fil_page_is_lzo_compressed
(
/*=======================*/
byte
*
buf
);
/*!< in: page */
#endif
storage/xtradb/include/fsp0pagecompress.ic
View file @
d4aef382
...
...
@@ -182,3 +182,16 @@ fil_space_get_atomic_writes(
return((atomic_writes_t)0);
}
/*******************************************************************//**
Find out wheather the page is page compressed with lzo method
@return true if page is page compressed with lzo method, false if not */
UNIV_INLINE
ibool
fil_page_is_lzo_compressed(
/*=======================*/
byte *buf) /*!< in: page */
{
return(mach_read_from_2(buf+FIL_PAGE_TYPE) == FIL_PAGE_PAGE_COMPRESSED &&
mach_read_from_8(buf+FIL_PAGE_FILE_FLUSH_LSN) == PAGE_LZO_ALGORITHM);
}
storage/xtradb/os/os0file.cc
View file @
d4aef382
...
...
@@ -50,6 +50,7 @@ Created 10/21/1995 Heikki Tuuri
#include "srv0mon.h"
#include "srv0srv.h"
#ifdef HAVE_POSIX_FALLOCATE
#include "unistd.h"
#include "fcntl.h"
#endif
#ifndef UNIV_HOTBACKUP
...
...
@@ -83,6 +84,19 @@ Created 10/21/1995 Heikki Tuuri
#include <sys/statvfs.h>
#endif
#if defined(UNIV_LINUX) && defined(HAVE_LINUX_FALLOC_H)
#include <linux/falloc.h>
#endif
#if defined(HAVE_FALLOCATE)
#ifndef FALLOC_FL_KEEP_SIZE
#define FALLOC_FL_KEEP_SIZE 0x01
#endif
#ifndef FALLOC_FL_PUNCH_HOLE
#define FALLOC_FL_PUNCH_HOLE 0x02
#endif
#endif
#ifdef HAVE_LZO
#include "lzo/lzo1x.h"
#endif
...
...
@@ -3112,7 +3126,7 @@ os_file_read_func(
as file spaces and they do not have FIL_PAGE_TYPE
field, thus we must use here information is the actual
file space compressed. */
if
(
compressed
&&
fil_page_is_compressed
((
byte
*
)
buf
))
{
if
(
fil_page_is_compressed
((
byte
*
)
buf
))
{
fil_decompress_page
(
NULL
,
(
byte
*
)
buf
,
len
,
NULL
);
}
...
...
@@ -3133,7 +3147,7 @@ os_file_read_func(
as file spaces and they do not have FIL_PAGE_TYPE
field, thus we must use here information is the actual
file space compressed. */
if
(
compressed
&&
fil_page_is_compressed
((
byte
*
)
buf
))
{
if
(
fil_page_is_compressed
((
byte
*
)
buf
))
{
fil_decompress_page
(
NULL
,
(
byte
*
)
buf
,
n
,
NULL
);
}
...
...
@@ -3231,7 +3245,7 @@ os_file_read_no_error_handling_func(
as file spaces and they do not have FIL_PAGE_TYPE
field, thus we must use here information is the actual
file space compressed. */
if
(
compressed
&&
fil_page_is_compressed
((
byte
*
)
buf
))
{
if
(
fil_page_is_compressed
((
byte
*
)
buf
))
{
fil_decompress_page
(
NULL
,
(
byte
*
)
buf
,
n
,
NULL
);
}
...
...
@@ -3252,7 +3266,7 @@ os_file_read_no_error_handling_func(
as file spaces and they do not have FIL_PAGE_TYPE
field, thus we must use here information is the actual
file space compressed. */
if
(
compressed
&&
fil_page_is_compressed
((
byte
*
)
buf
))
{
if
(
fil_page_is_compressed
((
byte
*
)
buf
))
{
fil_decompress_page
(
NULL
,
(
byte
*
)
buf
,
n
,
NULL
);
}
...
...
@@ -4753,12 +4767,10 @@ os_aio_array_reserve_slot(
// We allocate memory for page compressed buffer if and only
// if it is not yet allocated.
if
(
slot
->
page_buf
==
NULL
)
{
os_slot_alloc_page_buf
(
slot
);
}
os_slot_alloc_page_buf
(
slot
);
#ifdef HAVE_LZO
if
(
innodb_compression_algorithm
==
3
&&
slot
->
lzo_mem
==
NULL
)
{
if
(
innodb_compression_algorithm
==
3
)
{
os_slot_alloc_lzo_mem
(
slot
);
}
#endif
...
...
@@ -4786,7 +4798,6 @@ os_aio_array_reserve_slot(
/* Take array mutex back */
os_mutex_enter
(
array
->
mutex
);
}
#ifdef WIN_ASYNC_IO
...
...
@@ -5176,9 +5187,11 @@ os_aio_func(
trx
->
io_reads
++
;
trx
->
io_read
+=
n
;
}
slot
=
os_aio_array_reserve_slot
(
type
,
array
,
message1
,
message2
,
file
,
name
,
buf
,
offset
,
n
,
space_id
,
page_compression
,
page_compression_level
,
write_size
);
if
(
type
==
OS_FILE_READ
)
{
if
(
srv_use_native_aio
)
{
os_n_file_reads
++
;
...
...
@@ -5364,7 +5377,7 @@ os_aio_windows_handle(
switch
(
slot
->
type
)
{
case
OS_FILE_WRITE
:
if
(
slot
->
message1
&&
slot
->
page_compression
&&
slot
->
page_buf
)
{
if
(
slot
->
message1
&&
slot
->
page_compression
slot
->
page_compress_success
&&
slot
->
page_buf
)
{
ret_val
=
os_file_write
(
slot
->
name
,
slot
->
file
,
slot
->
page_buf
,
slot
->
offset
,
slot
->
len
);
}
else
{
...
...
@@ -5400,26 +5413,23 @@ os_aio_windows_handle(
ret_val
=
ret
&&
len
==
slot
->
len
;
}
if
(
slot
->
message1
&&
slot
->
page_compression
)
{
// We allocate memory for page compressed buffer if and only
// if it is not yet allocated.
if
(
slot
->
page_buf
==
NULL
)
{
if
(
slot
->
type
==
OS_FILE_READ
)
{
if
(
fil_page_is_compressed
(
slot
->
buf
))
{
os_slot_alloc_page_buf
(
slot
);
}
#ifdef HAVE_LZO
if
(
innodb_compression_algorithm
==
3
&&
slot
->
lzo_mem
==
NULL
)
{
os_slot_alloc_lzo_mem
(
slot
);
}
if
(
fil_page_is_lzo_compressed
(
slot
->
buf
)
)
{
os_slot_alloc_lzo_mem
(
slot
);
}
#endif
if
(
slot
->
type
==
OS_FILE_READ
)
{
fil_decompress_page
(
slot
->
page_buf
,
slot
->
buf
,
slot
->
len
,
slot
->
write_size
);
}
else
{
if
(
slot
->
page_compress_success
&&
fil_page_is_compressed
(
slot
->
page_buf
))
{
if
(
srv_use_trim
&&
os_fallocate_failed
==
FALSE
)
{
// Deallocate unused blocks from file system
os_file_trim
(
slot
);
}
}
}
else
{
/* OS_FILE_WRITE */
if
(
slot
->
page_compress_success
&&
fil_page_is_compressed
(
slot
->
page_buf
))
{
if
(
srv_use_trim
&&
os_fallocate_failed
==
FALSE
)
{
// Deallocate unused blocks from file system
os_file_trim
(
slot
);
}
}
}
...
...
@@ -5513,31 +5523,29 @@ os_aio_linux_collect(
/* We have not overstepped to next segment. */
ut_a
(
slot
->
pos
<
end_pos
);
/* If the table is page compressed and this is read,
we decompress before we annouce the read is
complete. For writes, we free the compressed page. */
if
(
slot
->
message1
&&
slot
->
page_compression
)
{
// We allocate memory for page compressed buffer if and only
// if it is not yet allocated.
if
(
slot
->
page_buf
==
NULL
)
{
if
(
slot
->
type
==
OS_FILE_READ
)
{
/* If the table is page compressed and this is read,
we decompress before we annouce the read is
complete. For writes, we free the compressed page. */
if
(
fil_page_is_compressed
(
slot
->
buf
))
{
// We allocate memory for page compressed buffer if and only
// if it is not yet allocated.
os_slot_alloc_page_buf
(
slot
);
}
#ifdef HAVE_LZO
if
(
innodb_compression_algorithm
==
3
&&
slot
->
lzo_mem
==
NULL
)
{
os_slot_alloc_lzo_mem
(
slot
);
}
if
(
fil_page_is_lzo_compressed
(
slot
->
buf
)
)
{
os_slot_alloc_lzo_mem
(
slot
);
}
#endif
if
(
slot
->
type
==
OS_FILE_READ
)
{
fil_decompress_page
(
slot
->
page_buf
,
slot
->
buf
,
slot
->
len
,
slot
->
write_size
);
}
else
{
if
(
slot
->
page_compress_success
&&
fil_page_is_compressed
(
slot
->
page_buf
))
{
ut_ad
(
slot
->
page_compression_page
);
if
(
srv_use_trim
&&
os_fallocate_failed
==
FALSE
)
{
// Deallocate unused blocks from file system
os_file_trim
(
slot
);
}
}
}
else
{
/* OS_FILE_WRITE */
if
(
slot
->
page_compress_success
&&
fil_page_is_compressed
(
slot
->
page_buf
))
{
ut_ad
(
slot
->
page_compression_page
);
if
(
srv_use_trim
&&
os_fallocate_failed
==
FALSE
)
{
// Deallocate unused blocks from file system
os_file_trim
(
slot
);
}
}
}
...
...
@@ -6490,7 +6498,7 @@ os_file_trim(
}
#ifdef __linux__
#if defined(
POSIX
_FALLOCATE)
#if defined(
HAVE
_FALLOCATE)
int
ret
=
fallocate
(
slot
->
file
,
FALLOC_FL_PUNCH_HOLE
|
FALLOC_FL_KEEP_SIZE
,
off
,
trim_len
);
if
(
ret
)
{
...
...
@@ -6528,7 +6536,7 @@ os_file_trim(
*
slot
->
write_size
=
0
;
}
#endif
/* HAVE_
POSIX_
FALLOCATE ... */
#endif
/* HAVE_FALLOCATE ... */
#elif defined(_WIN32)
FILE_LEVEL_TRIM
flt
;
...
...
@@ -6610,13 +6618,15 @@ os_slot_alloc_page_buf(
byte
*
cbuf
;
ut_a
(
slot
!=
NULL
);
/* We allocate extra to avoid memory overwrite on compression */
cbuf2
=
static_cast
<
byte
*>
(
ut_malloc
(
UNIV_PAGE_SIZE
*
2
));
cbuf
=
static_cast
<
byte
*>
(
ut_align
(
cbuf2
,
UNIV_PAGE_SIZE
));
slot
->
page_compression_page
=
static_cast
<
byte
*>
(
cbuf2
);
slot
->
page_buf
=
static_cast
<
byte
*>
(
cbuf
);
memset
(
slot
->
page_buf
,
0
,
UNIV_PAGE_SIZE
);
ut_a
(
slot
->
page_buf
!=
NULL
);
if
(
slot
->
page_compression_page
==
NULL
)
{
/* We allocate extra to avoid memory overwrite on compression */
cbuf2
=
static_cast
<
byte
*>
(
ut_malloc
(
UNIV_PAGE_SIZE
*
2
));
cbuf
=
static_cast
<
byte
*>
(
ut_align
(
cbuf2
,
UNIV_PAGE_SIZE
));
slot
->
page_compression_page
=
static_cast
<
byte
*>
(
cbuf2
);
slot
->
page_buf
=
static_cast
<
byte
*>
(
cbuf
);
memset
(
slot
->
page_compression_page
,
0
,
UNIV_PAGE_SIZE
*
2
);
ut_a
(
slot
->
page_buf
!=
NULL
);
}
}
#ifdef HAVE_LZO
...
...
@@ -6630,9 +6640,11 @@ os_slot_alloc_lzo_mem(
os_aio_slot_t
*
slot
)
/*!< in: slot structure */
{
ut_a
(
slot
!=
NULL
);
slot
->
lzo_mem
=
static_cast
<
byte
*>
(
ut_malloc
(
LZO1X_1_15_MEM_COMPRESS
));
memset
(
slot
->
lzo_mem
,
0
,
LZO1X_1_15_MEM_COMPRESS
);
ut_a
(
slot
->
lzo_mem
!=
NULL
);
if
(
slot
->
lzo_mem
==
NULL
)
{
slot
->
lzo_mem
=
static_cast
<
byte
*>
(
ut_malloc
(
LZO1X_1_15_MEM_COMPRESS
));
memset
(
slot
->
lzo_mem
,
0
,
LZO1X_1_15_MEM_COMPRESS
);
ut_a
(
slot
->
lzo_mem
!=
NULL
);
}
}
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment