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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
5bb4e84a
Commit
5bb4e84a
authored
Aug 10, 2006
by
jonas@perch.ndb.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ndb - bug#21172
Handle also open && !OM_INIT wrt non function O_DIRECT
parent
96cfb191
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
14 deletions
+50
-14
storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
+50
-14
No files found.
storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
View file @
5bb4e84a
...
...
@@ -259,7 +259,7 @@ void AsyncFile::openReq(Request* request)
DWORD
dwDesiredAccess
=
0
;
DWORD
dwShareMode
=
FILE_SHARE_READ
|
FILE_SHARE_WRITE
;
DWORD
dwFlagsAndAttributes
=
FILE_ATTRIBUTE_NORMAL
|
FILE_FLAG_RANDOM_ACCESS
|
FILE_FLAG_NO_BUFFERING
;
const
Uint32
flags
=
request
->
par
.
open
.
flags
;
Uint32
flags
=
request
->
par
.
open
.
flags
;
// Convert file open flags from Solaris to Windows
if
((
flags
&
FsOpenReq
::
OM_CREATE
)
&&
(
flags
&
FsOpenReq
::
OM_TRUNCATE
)){
...
...
@@ -312,7 +312,7 @@ void AsyncFile::openReq(Request* request)
return
;
}
#else
const
Uint32
flags
=
request
->
par
.
open
.
flags
;
Uint32
flags
=
request
->
par
.
open
.
flags
;
Uint32
new_flags
=
0
;
// Convert file open flags from Solaris to Liux
...
...
@@ -339,22 +339,24 @@ void AsyncFile::openReq(Request* request)
new_flags
|=
O_APPEND
;
}
if
((
flags
&
FsOpenReq
::
OM_SYNC
)
&&
!
(
flags
&
FsOpenReq
::
OM_INIT
))
{
#ifdef O_SYNC
new_flags
|=
O_SYNC
;
#endif
}
//#ifndef NDB_NO_O_DIRECT /* to allow tmpfs */
#ifdef O_DIRECT
if
(
flags
&
FsOpenReq
::
OM_DIRECT
)
#ifdef O_DIRECT
{
new_flags
|=
O_DIRECT
;
}
#elif defined O_SYNC
{
flags
|=
OM_SYNC
;
}
#endif
//#endif
if
((
flags
&
FsOpenReq
::
OM_SYNC
)
&&
!
(
flags
&
FsOpenReq
::
OM_INIT
))
{
#ifdef O_SYNC
new_flags
|=
O_SYNC
;
#endif
}
switch
(
flags
&
0x3
){
case
FsOpenReq
:
:
OM_READONLY
:
new_flags
|=
O_RDONLY
;
...
...
@@ -403,6 +405,11 @@ no_odirect:
if
(
new_flags
&
O_DIRECT
)
{
new_flags
&=
~
O_DIRECT
;
flags
|=
FsOpenReq
::
OM_SYNC
;
#ifdef O_SYNC
if
(
!
(
flags
&
FsOpenReq
::
OM_INIT
))
new_flags
|=
O_SYNC
;
#endif
goto
no_odirect
;
}
#endif
...
...
@@ -415,6 +422,11 @@ no_odirect:
else
if
(
new_flags
&
O_DIRECT
)
{
new_flags
&=
~
O_DIRECT
;
flags
|=
FsOpenReq
::
OM_SYNC
;
#ifdef O_SYNC
if
(
!
(
flags
&
FsOpenReq
::
OM_INIT
))
new_flags
|=
O_SYNC
;
#endif
goto
no_odirect
;
}
#endif
...
...
@@ -489,6 +501,7 @@ no_odirect:
{
ndbout_c
(
"error on first write(%d), disable O_DIRECT"
,
err
);
new_flags
&=
~
O_DIRECT
;
flags
|=
FsOpenReq
::
OM_SYNC
;
close
(
theFd
);
theFd
=
::
open
(
theFileName
.
c_str
(),
new_flags
,
mode
);
if
(
theFd
!=
-
1
)
...
...
@@ -505,18 +518,41 @@ no_odirect:
if
(
lseek
(
theFd
,
0
,
SEEK_SET
)
!=
0
)
request
->
error
=
errno
;
}
else
if
(
flags
&
FsOpenReq
::
OM_DIRECT
)
{
#ifdef O_DIRECT
do
{
int
ret
;
char
buf
[
2
*
GLOBAL_PAGE_SIZE
-
1
];
char
*
bufptr
=
(
char
*
)((
UintPtr
(
buf
)
+
(
GLOBAL_PAGE_SIZE
-
1
))
&
~
(
GLOBAL_PAGE_SIZE
-
1
));
while
(((
ret
=
::
read
(
theFd
,
bufptr
,
GLOBAL_PAGE_SIZE
))
==
-
1
)
&&
(
errno
==
EINTR
));
if
(
ret
==
-
1
)
{
ndbout_c
(
"%s Failed to read using O_DIRECT, disabling"
,
theFileName
.
c_str
());
flags
|=
FsOpenReq
::
OM_SYNC
;
flags
|=
FsOpenReq
::
OM_INIT
;
break
;
}
if
(
lseek
(
theFd
,
0
,
SEEK_SET
)
!=
0
)
{
request
->
error
=
errno
;
return
;
}
}
while
(
0
);
#endif
}
if
((
flags
&
FsOpenReq
::
OM_SYNC
)
&&
(
flags
&
FsOpenReq
::
OM_INIT
))
{
#ifdef O_SYNC
/**
* reopen file with O_SYNC
*/
close
(
theFd
);
new_flags
&=
~
(
O_CREAT
|
O_TRUNC
);
#ifdef O_SYNC
new_flags
|=
O_SYNC
;
#endif
theFd
=
::
open
(
theFileName
.
c_str
(),
new_flags
,
mode
);
#endif
}
#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