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
Show 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)
...
@@ -259,7 +259,7 @@ void AsyncFile::openReq(Request* request)
DWORD
dwDesiredAccess
=
0
;
DWORD
dwDesiredAccess
=
0
;
DWORD
dwShareMode
=
FILE_SHARE_READ
|
FILE_SHARE_WRITE
;
DWORD
dwShareMode
=
FILE_SHARE_READ
|
FILE_SHARE_WRITE
;
DWORD
dwFlagsAndAttributes
=
FILE_ATTRIBUTE_NORMAL
|
FILE_FLAG_RANDOM_ACCESS
|
FILE_FLAG_NO_BUFFERING
;
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
// Convert file open flags from Solaris to Windows
if
((
flags
&
FsOpenReq
::
OM_CREATE
)
&&
(
flags
&
FsOpenReq
::
OM_TRUNCATE
)){
if
((
flags
&
FsOpenReq
::
OM_CREATE
)
&&
(
flags
&
FsOpenReq
::
OM_TRUNCATE
)){
...
@@ -312,7 +312,7 @@ void AsyncFile::openReq(Request* request)
...
@@ -312,7 +312,7 @@ void AsyncFile::openReq(Request* request)
return
;
return
;
}
}
#else
#else
const
Uint32
flags
=
request
->
par
.
open
.
flags
;
Uint32
flags
=
request
->
par
.
open
.
flags
;
Uint32
new_flags
=
0
;
Uint32
new_flags
=
0
;
// Convert file open flags from Solaris to Liux
// Convert file open flags from Solaris to Liux
...
@@ -339,6 +339,17 @@ void AsyncFile::openReq(Request* request)
...
@@ -339,6 +339,17 @@ void AsyncFile::openReq(Request* request)
new_flags
|=
O_APPEND
;
new_flags
|=
O_APPEND
;
}
}
if
(
flags
&
FsOpenReq
::
OM_DIRECT
)
#ifdef O_DIRECT
{
new_flags
|=
O_DIRECT
;
}
#elif defined O_SYNC
{
flags
|=
OM_SYNC
;
}
#endif
if
((
flags
&
FsOpenReq
::
OM_SYNC
)
&&
!
(
flags
&
FsOpenReq
::
OM_INIT
))
if
((
flags
&
FsOpenReq
::
OM_SYNC
)
&&
!
(
flags
&
FsOpenReq
::
OM_INIT
))
{
{
#ifdef O_SYNC
#ifdef O_SYNC
...
@@ -346,15 +357,6 @@ void AsyncFile::openReq(Request* request)
...
@@ -346,15 +357,6 @@ void AsyncFile::openReq(Request* request)
#endif
#endif
}
}
//#ifndef NDB_NO_O_DIRECT /* to allow tmpfs */
#ifdef O_DIRECT
if
(
flags
&
FsOpenReq
::
OM_DIRECT
)
{
new_flags
|=
O_DIRECT
;
}
#endif
//#endif
switch
(
flags
&
0x3
){
switch
(
flags
&
0x3
){
case
FsOpenReq
:
:
OM_READONLY
:
case
FsOpenReq
:
:
OM_READONLY
:
new_flags
|=
O_RDONLY
;
new_flags
|=
O_RDONLY
;
...
@@ -403,6 +405,11 @@ no_odirect:
...
@@ -403,6 +405,11 @@ no_odirect:
if
(
new_flags
&
O_DIRECT
)
if
(
new_flags
&
O_DIRECT
)
{
{
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
;
goto
no_odirect
;
}
}
#endif
#endif
...
@@ -415,6 +422,11 @@ no_odirect:
...
@@ -415,6 +422,11 @@ no_odirect:
else
if
(
new_flags
&
O_DIRECT
)
else
if
(
new_flags
&
O_DIRECT
)
{
{
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
;
goto
no_odirect
;
}
}
#endif
#endif
...
@@ -489,6 +501,7 @@ no_odirect:
...
@@ -489,6 +501,7 @@ no_odirect:
{
{
ndbout_c
(
"error on first write(%d), disable O_DIRECT"
,
err
);
ndbout_c
(
"error on first write(%d), disable O_DIRECT"
,
err
);
new_flags
&=
~
O_DIRECT
;
new_flags
&=
~
O_DIRECT
;
flags
|=
FsOpenReq
::
OM_SYNC
;
close
(
theFd
);
close
(
theFd
);
theFd
=
::
open
(
theFileName
.
c_str
(),
new_flags
,
mode
);
theFd
=
::
open
(
theFileName
.
c_str
(),
new_flags
,
mode
);
if
(
theFd
!=
-
1
)
if
(
theFd
!=
-
1
)
...
@@ -505,18 +518,41 @@ no_odirect:
...
@@ -505,18 +518,41 @@ no_odirect:
if
(
lseek
(
theFd
,
0
,
SEEK_SET
)
!=
0
)
if
(
lseek
(
theFd
,
0
,
SEEK_SET
)
!=
0
)
request
->
error
=
errno
;
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
))
if
((
flags
&
FsOpenReq
::
OM_SYNC
)
&&
(
flags
&
FsOpenReq
::
OM_INIT
))
{
{
#ifdef O_SYNC
/**
/**
* reopen file with O_SYNC
* reopen file with O_SYNC
*/
*/
close
(
theFd
);
close
(
theFd
);
new_flags
&=
~
(
O_CREAT
|
O_TRUNC
);
new_flags
&=
~
(
O_CREAT
|
O_TRUNC
);
#ifdef O_SYNC
new_flags
|=
O_SYNC
;
new_flags
|=
O_SYNC
;
#endif
theFd
=
::
open
(
theFileName
.
c_str
(),
new_flags
,
mode
);
theFd
=
::
open
(
theFileName
.
c_str
(),
new_flags
,
mode
);
#endif
}
}
#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