Chapter 9. Managing GFS
103
9.7. Direct I/O
Direct I/O is a feature of the file system whereby file reads and writes go directly from the applications
to the storage device, bypassing the operating system read and write caches. Direct I/O is used by only
a few applications that manage their own caches, such as databases.
Direct I/O is invoked by an application opening a file with the
O_DIRECT
flag. Alternatively, GFS
can attach a direct I/O attribute to a file, in which case direct I/O is used regardless of how the file is
opened.
When a file is opened with
O_DIRECT
, or when a GFS direct I/O attribute is attached to a file, all I/O
operations must be done in block-size multiples of 512 bytes. The memory being read from or written
to must also be 512-byte aligned.
One of the following methods can be used to enable direct I/O on a file:
•
O_DIRECT
•
GFS file attribute
•
GFS directory attribute
9.7.1.
O_DIRECT
If an application uses the
O_DIRECT
flag on an
open()
system call, direct I/O is used for the opened
file.
To cause the
O_DIRECT
flag to be defined with recent glibc libraries, define
_GNU_SOURCE
at the
beginning of a source file before any includes, or define it on the
cc
line when compiling.
Note
Linux kernels from some distributions do not support use of the
O_DIRECT
flag.
9.7.2. GFS File Attribute
The
gfs_tool
command can be used to assign a direct I/O attribute flag,
directio
, to a regular
GFS file. The
directio
flag can also be cleared.
9.7.2.1. Usage
Set Direct I/O Attribute Flag
gfs_tool setflag
directio
File
Clear Direct I/O Attribute Flag
gfs_tool clearflag
directio
File
File
Specifies the file where the
directio
flag is assigned.
Summary of Contents for GFS 6.0 -
Page 1: ...Red Hat GFS 6 0 Administrator s Guide...
Page 8: ......
Page 88: ...74 Chapter 6 Creating the Cluster Configuration System Files...
Page 98: ...84 Chapter 7 Using the Cluster Configuration System...
Page 102: ...88 Chapter 8 Using Clustering and Locking Systems...
Page 128: ...114 Chapter 9 Managing GFS...
Page 134: ...120 Chapter 10 Using the Fencing System...
Page 144: ...130 Chapter 12 Using GFS init d Scripts...
Page 148: ...134 Appendix A Using Red Hat GFS with Red Hat Cluster Suite...
Page 184: ...170 Appendix C Basic GFS Examples...
Page 190: ......