aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/fs.h119
2 files changed, 59 insertions, 61 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index d114db9477f4..e2a1346514a6 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -69,7 +69,6 @@ header-y += b1lli.h
69header-y += baycom.h 69header-y += baycom.h
70header-y += bfs_fs.h 70header-y += bfs_fs.h
71header-y += binfmts.h 71header-y += binfmts.h
72header-y += blk_types.h
73header-y += blkpg.h 72header-y += blkpg.h
74header-y += blktrace_api.h 73header-y += blktrace_api.h
75header-y += bpqether.h 74header-y += bpqether.h
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 65fbf571023f..8cb86cfc9719 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -8,7 +8,6 @@
8 8
9#include <linux/limits.h> 9#include <linux/limits.h>
10#include <linux/ioctl.h> 10#include <linux/ioctl.h>
11#include <linux/blk_types.h>
12#include <linux/types.h> 11#include <linux/types.h>
13 12
14/* 13/*
@@ -118,65 +117,6 @@ struct inodes_stat_t {
118#define FMODE_NONOTIFY ((__force fmode_t)0x1000000) 117#define FMODE_NONOTIFY ((__force fmode_t)0x1000000)
119 118
120/* 119/*
121 * The below are the various read and write types that we support. Some of
122 * them include behavioral modifiers that send information down to the
123 * block layer and IO scheduler. Terminology:
124 *
125 * The block layer uses device plugging to defer IO a little bit, in
126 * the hope that we will see more IO very shortly. This increases
127 * coalescing of adjacent IO and thus reduces the number of IOs we
128 * have to send to the device. It also allows for better queuing,
129 * if the IO isn't mergeable. If the caller is going to be waiting
130 * for the IO, then he must ensure that the device is unplugged so
131 * that the IO is dispatched to the driver.
132 *
133 * All IO is handled async in Linux. This is fine for background
134 * writes, but for reads or writes that someone waits for completion
135 * on, we want to notify the block layer and IO scheduler so that they
136 * know about it. That allows them to make better scheduling
137 * decisions. So when the below references 'sync' and 'async', it
138 * is referencing this priority hint.
139 *
140 * With that in mind, the available types are:
141 *
142 * READ A normal read operation. Device will be plugged.
143 * READ_SYNC A synchronous read. Device is not plugged, caller can
144 * immediately wait on this read without caring about
145 * unplugging.
146 * READA Used for read-ahead operations. Lower priority, and the
147 * block layer could (in theory) choose to ignore this
148 * request if it runs into resource problems.
149 * WRITE A normal async write. Device will be plugged.
150 * WRITE_SYNC Synchronous write. Identical to WRITE, but passes down
151 * the hint that someone will be waiting on this IO
152 * shortly. The write equivalent of READ_SYNC.
153 * WRITE_ODIRECT Special case write for O_DIRECT only.
154 * WRITE_FLUSH Like WRITE_SYNC but with preceding cache flush.
155 * WRITE_FUA Like WRITE_SYNC but data is guaranteed to be on
156 * non-volatile media on completion.
157 * WRITE_FLUSH_FUA Combination of WRITE_FLUSH and FUA. The IO is preceded
158 * by a cache flush and data is guaranteed to be on
159 * non-volatile media on completion.
160 *
161 */
162#define RW_MASK REQ_WRITE
163#define RWA_MASK REQ_RAHEAD
164
165#define READ 0
166#define WRITE RW_MASK
167#define READA RWA_MASK
168#define KERNEL_READ (READ|REQ_KERNEL)
169#define KERNEL_WRITE (WRITE|REQ_KERNEL)
170
171#define READ_SYNC (READ | REQ_SYNC)
172#define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE)
173#define WRITE_ODIRECT (WRITE | REQ_SYNC)
174#define WRITE_FLUSH (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH)
175#define WRITE_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FUA)
176#define WRITE_FLUSH_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH | REQ_FUA)
177
178
179/*
180 * Flag for rw_copy_check_uvector and compat_rw_copy_check_uvector 120 * Flag for rw_copy_check_uvector and compat_rw_copy_check_uvector
181 * that indicates that they should check the contents of the iovec are 121 * that indicates that they should check the contents of the iovec are
182 * valid, but not check the memory that the iovec elements 122 * valid, but not check the memory that the iovec elements
@@ -417,6 +357,7 @@ struct inodes_stat_t {
417#include <linux/uidgid.h> 357#include <linux/uidgid.h>
418#include <linux/lockdep.h> 358#include <linux/lockdep.h>
419#include <linux/percpu-rwsem.h> 359#include <linux/percpu-rwsem.h>
360#include <linux/blk_types.h>
420 361
421#include <asm/byteorder.h> 362#include <asm/byteorder.h>
422 363
@@ -454,6 +395,64 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
454 bool is_async); 395 bool is_async);
455 396
456/* 397/*
398 * The below are the various read and write types that we support. Some of
399 * them include behavioral modifiers that send information down to the
400 * block layer and IO scheduler. Terminology:
401 *
402 * The block layer uses device plugging to defer IO a little bit, in
403 * the hope that we will see more IO very shortly. This increases
404 * coalescing of adjacent IO and thus reduces the number of IOs we
405 * have to send to the device. It also allows for better queuing,
406 * if the IO isn't mergeable. If the caller is going to be waiting
407 * for the IO, then he must ensure that the device is unplugged so
408 * that the IO is dispatched to the driver.
409 *
410 * All IO is handled async in Linux. This is fine for background
411 * writes, but for reads or writes that someone waits for completion
412 * on, we want to notify the block layer and IO scheduler so that they
413 * know about it. That allows them to make better scheduling
414 * decisions. So when the below references 'sync' and 'async', it
415 * is referencing this priority hint.
416 *
417 * With that in mind, the available types are:
418 *
419 * READ A normal read operation. Device will be plugged.
420 * READ_SYNC A synchronous read. Device is not plugged, caller can
421 * immediately wait on this read without caring about
422 * unplugging.
423 * READA Used for read-ahead operations. Lower priority, and the
424 * block layer could (in theory) choose to ignore this
425 * request if it runs into resource problems.
426 * WRITE A normal async write. Device will be plugged.
427 * WRITE_SYNC Synchronous write. Identical to WRITE, but passes down
428 * the hint that someone will be waiting on this IO
429 * shortly. The write equivalent of READ_SYNC.
430 * WRITE_ODIRECT Special case write for O_DIRECT only.
431 * WRITE_FLUSH Like WRITE_SYNC but with preceding cache flush.
432 * WRITE_FUA Like WRITE_SYNC but data is guaranteed to be on
433 * non-volatile media on completion.
434 * WRITE_FLUSH_FUA Combination of WRITE_FLUSH and FUA. The IO is preceded
435 * by a cache flush and data is guaranteed to be on
436 * non-volatile media on completion.
437 *
438 */
439#define RW_MASK REQ_WRITE
440#define RWA_MASK REQ_RAHEAD
441
442#define READ 0
443#define WRITE RW_MASK
444#define READA RWA_MASK
445#define KERNEL_READ (READ|REQ_KERNEL)
446#define KERNEL_WRITE (WRITE|REQ_KERNEL)
447
448#define READ_SYNC (READ | REQ_SYNC)
449#define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE)
450#define WRITE_ODIRECT (WRITE | REQ_SYNC)
451#define WRITE_FLUSH (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH)
452#define WRITE_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FUA)
453#define WRITE_FLUSH_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH | REQ_FUA)
454
455/*
457 * Attribute flags. These should be or-ed together to figure out what 456 * Attribute flags. These should be or-ed together to figure out what
458 * has been changed! 457 * has been changed!
459 */ 458 */