]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | #ifndef _LINUX_BLKDEV_H |
2 | #define _LINUX_BLKDEV_H | |
3 | ||
f5ff8422 JA |
4 | #ifdef CONFIG_BLOCK |
5 | ||
bcfd8d36 | 6 | #include <linux/sched.h> |
1da177e4 LT |
7 | #include <linux/major.h> |
8 | #include <linux/genhd.h> | |
9 | #include <linux/list.h> | |
10 | #include <linux/timer.h> | |
11 | #include <linux/workqueue.h> | |
12 | #include <linux/pagemap.h> | |
13 | #include <linux/backing-dev.h> | |
14 | #include <linux/wait.h> | |
15 | #include <linux/mempool.h> | |
16 | #include <linux/bio.h> | |
1da177e4 | 17 | #include <linux/stringify.h> |
3e6053d7 | 18 | #include <linux/gfp.h> |
d351af01 | 19 | #include <linux/bsg.h> |
c7c22e4d | 20 | #include <linux/smp.h> |
1da177e4 LT |
21 | |
22 | #include <asm/scatterlist.h> | |
23 | ||
de477254 | 24 | struct module; |
21b2f0c8 CH |
25 | struct scsi_ioctl_command; |
26 | ||
1da177e4 | 27 | struct request_queue; |
1da177e4 | 28 | struct elevator_queue; |
1da177e4 | 29 | struct request_pm_state; |
2056a782 | 30 | struct blk_trace; |
3d6392cf JA |
31 | struct request; |
32 | struct sg_io_hdr; | |
aa387cc8 | 33 | struct bsg_job; |
1da177e4 LT |
34 | |
35 | #define BLKDEV_MIN_RQ 4 | |
36 | #define BLKDEV_MAX_RQ 128 /* Default maximum */ | |
37 | ||
1da177e4 | 38 | struct request; |
8ffdc655 | 39 | typedef void (rq_end_io_fn)(struct request *, int); |
1da177e4 LT |
40 | |
41 | struct request_list { | |
1faa16d2 JA |
42 | /* |
43 | * count[], starved[], and wait[] are indexed by | |
44 | * BLK_RW_SYNC/BLK_RW_ASYNC | |
45 | */ | |
1da177e4 LT |
46 | int count[2]; |
47 | int starved[2]; | |
cb98fc8b | 48 | int elvpriv; |
1da177e4 LT |
49 | mempool_t *rq_pool; |
50 | wait_queue_head_t wait[2]; | |
1da177e4 LT |
51 | }; |
52 | ||
4aff5e23 JA |
53 | /* |
54 | * request command types | |
55 | */ | |
56 | enum rq_cmd_type_bits { | |
57 | REQ_TYPE_FS = 1, /* fs request */ | |
58 | REQ_TYPE_BLOCK_PC, /* scsi command */ | |
59 | REQ_TYPE_SENSE, /* sense request */ | |
60 | REQ_TYPE_PM_SUSPEND, /* suspend request */ | |
61 | REQ_TYPE_PM_RESUME, /* resume request */ | |
62 | REQ_TYPE_PM_SHUTDOWN, /* shutdown request */ | |
4aff5e23 | 63 | REQ_TYPE_SPECIAL, /* driver defined type */ |
4aff5e23 JA |
64 | /* |
65 | * for ATA/ATAPI devices. this really doesn't belong here, ide should | |
66 | * use REQ_TYPE_SPECIAL and use rq->cmd[0] with the range of driver | |
67 | * private REQ_LB opcodes to differentiate what type of request this is | |
68 | */ | |
4aff5e23 | 69 | REQ_TYPE_ATA_TASKFILE, |
cea2885a | 70 | REQ_TYPE_ATA_PC, |
4aff5e23 JA |
71 | }; |
72 | ||
1da177e4 LT |
73 | #define BLK_MAX_CDB 16 |
74 | ||
75 | /* | |
63a71386 | 76 | * try to put the fields that are referenced together in the same cacheline. |
4d0d98b6 | 77 | * if you modify this structure, be sure to check block/blk-core.c:blk_rq_init() |
63a71386 | 78 | * as well! |
1da177e4 LT |
79 | */ |
80 | struct request { | |
ff856bad | 81 | struct list_head queuelist; |
c7c22e4d | 82 | struct call_single_data csd; |
ff856bad | 83 | |
165125e1 | 84 | struct request_queue *q; |
e6a1c874 | 85 | |
4aff5e23 JA |
86 | unsigned int cmd_flags; |
87 | enum rq_cmd_type_bits cmd_type; | |
242f9dcb | 88 | unsigned long atomic_flags; |
1da177e4 | 89 | |
181fdde3 RK |
90 | int cpu; |
91 | ||
a2dec7b3 | 92 | /* the following two fields are internal, NEVER access directly */ |
a2dec7b3 | 93 | unsigned int __data_len; /* total data len */ |
181fdde3 | 94 | sector_t __sector; /* sector cursor */ |
1da177e4 LT |
95 | |
96 | struct bio *bio; | |
97 | struct bio *biotail; | |
98 | ||
9817064b | 99 | struct hlist_node hash; /* merge hash */ |
e6a1c874 JA |
100 | /* |
101 | * The rb_node is only used inside the io scheduler, requests | |
102 | * are pruned when moved to the dispatch queue. So let the | |
c186794d | 103 | * completion_data share space with the rb_node. |
e6a1c874 JA |
104 | */ |
105 | union { | |
106 | struct rb_node rb_node; /* sort/lookup */ | |
c186794d | 107 | void *completion_data; |
e6a1c874 | 108 | }; |
9817064b | 109 | |
ff7d145f | 110 | /* |
7f1dc8a2 | 111 | * Three pointers are available for the IO schedulers, if they need |
c186794d MS |
112 | * more they have to dynamically allocate it. Flush requests are |
113 | * never put on the IO scheduler. So let the flush fields share | |
a612fddf | 114 | * space with the elevator data. |
ff7d145f | 115 | */ |
c186794d | 116 | union { |
a612fddf TH |
117 | struct { |
118 | struct io_cq *icq; | |
119 | void *priv[2]; | |
120 | } elv; | |
121 | ||
c186794d MS |
122 | struct { |
123 | unsigned int seq; | |
124 | struct list_head list; | |
4853abaa | 125 | rq_end_io_fn *saved_end_io; |
c186794d MS |
126 | } flush; |
127 | }; | |
ff7d145f | 128 | |
8f34ee75 | 129 | struct gendisk *rq_disk; |
09e099d4 | 130 | struct hd_struct *part; |
1da177e4 | 131 | unsigned long start_time; |
9195291e DS |
132 | #ifdef CONFIG_BLK_CGROUP |
133 | unsigned long long start_time_ns; | |
134 | unsigned long long io_start_time_ns; /* when passed to hardware */ | |
135 | #endif | |
1da177e4 LT |
136 | /* Number of scatter-gather DMA addr+len pairs after |
137 | * physical address coalescing is performed. | |
138 | */ | |
139 | unsigned short nr_phys_segments; | |
13f05c8d MP |
140 | #if defined(CONFIG_BLK_DEV_INTEGRITY) |
141 | unsigned short nr_integrity_segments; | |
142 | #endif | |
1da177e4 | 143 | |
8f34ee75 JA |
144 | unsigned short ioprio; |
145 | ||
181fdde3 RK |
146 | int ref_count; |
147 | ||
731ec497 TH |
148 | void *special; /* opaque pointer available for LLD use */ |
149 | char *buffer; /* kaddr of the current segment if available */ | |
1da177e4 | 150 | |
cdd60262 JA |
151 | int tag; |
152 | int errors; | |
153 | ||
1da177e4 LT |
154 | /* |
155 | * when request is used as a packet command carrier | |
156 | */ | |
d7e3c324 FT |
157 | unsigned char __cmd[BLK_MAX_CDB]; |
158 | unsigned char *cmd; | |
181fdde3 | 159 | unsigned short cmd_len; |
1da177e4 | 160 | |
7a85f889 | 161 | unsigned int extra_len; /* length of alignment and padding */ |
1da177e4 | 162 | unsigned int sense_len; |
c3a4d78c | 163 | unsigned int resid_len; /* residual count */ |
1da177e4 LT |
164 | void *sense; |
165 | ||
242f9dcb JA |
166 | unsigned long deadline; |
167 | struct list_head timeout_list; | |
1da177e4 | 168 | unsigned int timeout; |
17e01f21 | 169 | int retries; |
1da177e4 | 170 | |
1da177e4 | 171 | /* |
c00895ab | 172 | * completion callback. |
1da177e4 LT |
173 | */ |
174 | rq_end_io_fn *end_io; | |
175 | void *end_io_data; | |
abae1fde FT |
176 | |
177 | /* for bidi */ | |
178 | struct request *next_rq; | |
1da177e4 LT |
179 | }; |
180 | ||
766ca442 FLVC |
181 | static inline unsigned short req_get_ioprio(struct request *req) |
182 | { | |
183 | return req->ioprio; | |
184 | } | |
185 | ||
1da177e4 | 186 | /* |
4aff5e23 | 187 | * State information carried for REQ_TYPE_PM_SUSPEND and REQ_TYPE_PM_RESUME |
1da177e4 LT |
188 | * requests. Some step values could eventually be made generic. |
189 | */ | |
190 | struct request_pm_state | |
191 | { | |
192 | /* PM state machine step value, currently driver specific */ | |
193 | int pm_step; | |
194 | /* requested PM state value (S1, S2, S3, S4, ...) */ | |
195 | u32 pm_state; | |
196 | void* data; /* for driver use */ | |
197 | }; | |
198 | ||
199 | #include <linux/elevator.h> | |
200 | ||
165125e1 | 201 | typedef void (request_fn_proc) (struct request_queue *q); |
5a7bbad2 | 202 | typedef void (make_request_fn) (struct request_queue *q, struct bio *bio); |
165125e1 | 203 | typedef int (prep_rq_fn) (struct request_queue *, struct request *); |
28018c24 | 204 | typedef void (unprep_rq_fn) (struct request_queue *, struct request *); |
1da177e4 LT |
205 | |
206 | struct bio_vec; | |
cc371e66 AK |
207 | struct bvec_merge_data { |
208 | struct block_device *bi_bdev; | |
209 | sector_t bi_sector; | |
210 | unsigned bi_size; | |
211 | unsigned long bi_rw; | |
212 | }; | |
213 | typedef int (merge_bvec_fn) (struct request_queue *, struct bvec_merge_data *, | |
214 | struct bio_vec *); | |
ff856bad | 215 | typedef void (softirq_done_fn)(struct request *); |
2fb98e84 | 216 | typedef int (dma_drain_needed_fn)(struct request *); |
ef9e3fac | 217 | typedef int (lld_busy_fn) (struct request_queue *q); |
aa387cc8 | 218 | typedef int (bsg_job_fn) (struct bsg_job *); |
1da177e4 | 219 | |
242f9dcb JA |
220 | enum blk_eh_timer_return { |
221 | BLK_EH_NOT_HANDLED, | |
222 | BLK_EH_HANDLED, | |
223 | BLK_EH_RESET_TIMER, | |
224 | }; | |
225 | ||
226 | typedef enum blk_eh_timer_return (rq_timed_out_fn)(struct request *); | |
227 | ||
1da177e4 LT |
228 | enum blk_queue_state { |
229 | Queue_down, | |
230 | Queue_up, | |
231 | }; | |
232 | ||
1da177e4 LT |
233 | struct blk_queue_tag { |
234 | struct request **tag_index; /* map of busy tags */ | |
235 | unsigned long *tag_map; /* bit map of free/busy tags */ | |
1da177e4 LT |
236 | int busy; /* current depth */ |
237 | int max_depth; /* what we will send to device */ | |
ba025082 | 238 | int real_max_depth; /* what the array can hold */ |
1da177e4 LT |
239 | atomic_t refcnt; /* map can be shared */ |
240 | }; | |
241 | ||
abf54393 FT |
242 | #define BLK_SCSI_MAX_CMDS (256) |
243 | #define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8)) | |
244 | ||
025146e1 MP |
245 | struct queue_limits { |
246 | unsigned long bounce_pfn; | |
247 | unsigned long seg_boundary_mask; | |
248 | ||
249 | unsigned int max_hw_sectors; | |
250 | unsigned int max_sectors; | |
251 | unsigned int max_segment_size; | |
c72758f3 MP |
252 | unsigned int physical_block_size; |
253 | unsigned int alignment_offset; | |
254 | unsigned int io_min; | |
255 | unsigned int io_opt; | |
67efc925 | 256 | unsigned int max_discard_sectors; |
86b37281 MP |
257 | unsigned int discard_granularity; |
258 | unsigned int discard_alignment; | |
025146e1 MP |
259 | |
260 | unsigned short logical_block_size; | |
8a78362c | 261 | unsigned short max_segments; |
13f05c8d | 262 | unsigned short max_integrity_segments; |
025146e1 | 263 | |
c72758f3 | 264 | unsigned char misaligned; |
86b37281 | 265 | unsigned char discard_misaligned; |
e692cb66 | 266 | unsigned char cluster; |
a934a00a | 267 | unsigned char discard_zeroes_data; |
025146e1 MP |
268 | }; |
269 | ||
d7b76301 | 270 | struct request_queue { |
1da177e4 LT |
271 | /* |
272 | * Together with queue_head for cacheline sharing | |
273 | */ | |
274 | struct list_head queue_head; | |
275 | struct request *last_merge; | |
b374d18a | 276 | struct elevator_queue *elevator; |
1da177e4 LT |
277 | |
278 | /* | |
279 | * the queue request freelist, one for reads and one for writes | |
280 | */ | |
281 | struct request_list rq; | |
282 | ||
283 | request_fn_proc *request_fn; | |
1da177e4 LT |
284 | make_request_fn *make_request_fn; |
285 | prep_rq_fn *prep_rq_fn; | |
28018c24 | 286 | unprep_rq_fn *unprep_rq_fn; |
1da177e4 | 287 | merge_bvec_fn *merge_bvec_fn; |
ff856bad | 288 | softirq_done_fn *softirq_done_fn; |
242f9dcb | 289 | rq_timed_out_fn *rq_timed_out_fn; |
2fb98e84 | 290 | dma_drain_needed_fn *dma_drain_needed; |
ef9e3fac | 291 | lld_busy_fn *lld_busy_fn; |
1da177e4 | 292 | |
8922e16c TH |
293 | /* |
294 | * Dispatch queue sorting | |
295 | */ | |
1b47f531 | 296 | sector_t end_sector; |
8922e16c | 297 | struct request *boundary_rq; |
8922e16c | 298 | |
1da177e4 | 299 | /* |
3cca6dc1 | 300 | * Delayed queue handling |
1da177e4 | 301 | */ |
3cca6dc1 | 302 | struct delayed_work delay_work; |
1da177e4 LT |
303 | |
304 | struct backing_dev_info backing_dev_info; | |
305 | ||
306 | /* | |
307 | * The queue owner gets to use this for whatever they like. | |
308 | * ll_rw_blk doesn't touch it. | |
309 | */ | |
310 | void *queuedata; | |
311 | ||
1da177e4 | 312 | /* |
d7b76301 | 313 | * various queue flags, see QUEUE_* below |
1da177e4 | 314 | */ |
d7b76301 | 315 | unsigned long queue_flags; |
1da177e4 | 316 | |
a73f730d TH |
317 | /* |
318 | * ida allocated id for this queue. Used to index queues from | |
319 | * ioctx. | |
320 | */ | |
321 | int id; | |
322 | ||
1da177e4 | 323 | /* |
d7b76301 | 324 | * queue needs bounce pages for pages above this limit |
1da177e4 | 325 | */ |
d7b76301 | 326 | gfp_t bounce_gfp; |
1da177e4 LT |
327 | |
328 | /* | |
152587de JA |
329 | * protects queue structures from reentrancy. ->__queue_lock should |
330 | * _never_ be used directly, it is queue private. always use | |
331 | * ->queue_lock. | |
1da177e4 | 332 | */ |
152587de | 333 | spinlock_t __queue_lock; |
1da177e4 LT |
334 | spinlock_t *queue_lock; |
335 | ||
336 | /* | |
337 | * queue kobject | |
338 | */ | |
339 | struct kobject kobj; | |
340 | ||
341 | /* | |
342 | * queue settings | |
343 | */ | |
344 | unsigned long nr_requests; /* Max # of requests */ | |
345 | unsigned int nr_congestion_on; | |
346 | unsigned int nr_congestion_off; | |
347 | unsigned int nr_batching; | |
348 | ||
fa0ccd83 | 349 | unsigned int dma_drain_size; |
d7b76301 | 350 | void *dma_drain_buffer; |
e3790c7d | 351 | unsigned int dma_pad_mask; |
1da177e4 LT |
352 | unsigned int dma_alignment; |
353 | ||
354 | struct blk_queue_tag *queue_tags; | |
6eca9004 | 355 | struct list_head tag_busy_list; |
1da177e4 | 356 | |
15853af9 | 357 | unsigned int nr_sorted; |
0a7ae2ff | 358 | unsigned int in_flight[2]; |
1da177e4 | 359 | |
242f9dcb JA |
360 | unsigned int rq_timeout; |
361 | struct timer_list timeout; | |
362 | struct list_head timeout_list; | |
363 | ||
a612fddf TH |
364 | struct list_head icq_list; |
365 | ||
025146e1 MP |
366 | struct queue_limits limits; |
367 | ||
1da177e4 LT |
368 | /* |
369 | * sg stuff | |
370 | */ | |
371 | unsigned int sg_timeout; | |
372 | unsigned int sg_reserved_size; | |
1946089a | 373 | int node; |
6c5c9341 | 374 | #ifdef CONFIG_BLK_DEV_IO_TRACE |
2056a782 | 375 | struct blk_trace *blk_trace; |
6c5c9341 | 376 | #endif |
1da177e4 | 377 | /* |
4913efe4 | 378 | * for flush operations |
1da177e4 | 379 | */ |
4913efe4 | 380 | unsigned int flush_flags; |
f3876930 | 381 | unsigned int flush_not_queueable:1; |
3ac0cc45 | 382 | unsigned int flush_queue_delayed:1; |
ae1b1539 TH |
383 | unsigned int flush_pending_idx:1; |
384 | unsigned int flush_running_idx:1; | |
385 | unsigned long flush_pending_since; | |
386 | struct list_head flush_queue[2]; | |
387 | struct list_head flush_data_in_flight; | |
dd4c133f | 388 | struct request flush_rq; |
483f4afc AV |
389 | |
390 | struct mutex sysfs_lock; | |
d351af01 FT |
391 | |
392 | #if defined(CONFIG_BLK_DEV_BSG) | |
aa387cc8 MC |
393 | bsg_job_fn *bsg_job_fn; |
394 | int bsg_job_size; | |
d351af01 FT |
395 | struct bsg_class_device bsg_dev; |
396 | #endif | |
e43473b7 VG |
397 | |
398 | #ifdef CONFIG_BLK_DEV_THROTTLING | |
399 | /* Throttle data */ | |
400 | struct throtl_data *td; | |
401 | #endif | |
b2efa052 TH |
402 | #ifdef CONFIG_LOCKDEP |
403 | int ioc_release_depth; | |
404 | #endif | |
1da177e4 LT |
405 | }; |
406 | ||
1da177e4 LT |
407 | #define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */ |
408 | #define QUEUE_FLAG_STOPPED 2 /* queue is stopped */ | |
1faa16d2 JA |
409 | #define QUEUE_FLAG_SYNCFULL 3 /* read queue has been filled */ |
410 | #define QUEUE_FLAG_ASYNCFULL 4 /* write queue has been filled */ | |
1da177e4 | 411 | #define QUEUE_FLAG_DEAD 5 /* queue being torn down */ |
c21e6beb JA |
412 | #define QUEUE_FLAG_ELVSWITCH 6 /* don't use elevator, just do FIFO */ |
413 | #define QUEUE_FLAG_BIDI 7 /* queue supports bidi requests */ | |
414 | #define QUEUE_FLAG_NOMERGES 8 /* disable merge attempts */ | |
5757a6d7 | 415 | #define QUEUE_FLAG_SAME_COMP 9 /* complete on same CPU-group */ |
c21e6beb JA |
416 | #define QUEUE_FLAG_FAIL_IO 10 /* fake timeout */ |
417 | #define QUEUE_FLAG_STACKABLE 11 /* supports request stacking */ | |
418 | #define QUEUE_FLAG_NONROT 12 /* non-rotational device (SSD) */ | |
88e740f1 | 419 | #define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */ |
c21e6beb JA |
420 | #define QUEUE_FLAG_IO_STAT 13 /* do IO stats */ |
421 | #define QUEUE_FLAG_DISCARD 14 /* supports DISCARD */ | |
422 | #define QUEUE_FLAG_NOXMERGES 15 /* No extended merges */ | |
423 | #define QUEUE_FLAG_ADD_RANDOM 16 /* Contributes to random pool */ | |
424 | #define QUEUE_FLAG_SECDISCARD 17 /* supports SECDISCARD */ | |
5757a6d7 | 425 | #define QUEUE_FLAG_SAME_FORCE 18 /* force complete on same CPU */ |
bc58ba94 JA |
426 | |
427 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ | |
01e97f6b | 428 | (1 << QUEUE_FLAG_STACKABLE) | \ |
e2e1a148 JA |
429 | (1 << QUEUE_FLAG_SAME_COMP) | \ |
430 | (1 << QUEUE_FLAG_ADD_RANDOM)) | |
797e7dbb | 431 | |
8f45c1a5 LT |
432 | static inline int queue_is_locked(struct request_queue *q) |
433 | { | |
7663c1e2 | 434 | #ifdef CONFIG_SMP |
8f45c1a5 LT |
435 | spinlock_t *lock = q->queue_lock; |
436 | return lock && spin_is_locked(lock); | |
7663c1e2 JA |
437 | #else |
438 | return 1; | |
439 | #endif | |
8f45c1a5 LT |
440 | } |
441 | ||
75ad23bc NP |
442 | static inline void queue_flag_set_unlocked(unsigned int flag, |
443 | struct request_queue *q) | |
444 | { | |
445 | __set_bit(flag, &q->queue_flags); | |
446 | } | |
447 | ||
e48ec690 JA |
448 | static inline int queue_flag_test_and_clear(unsigned int flag, |
449 | struct request_queue *q) | |
450 | { | |
451 | WARN_ON_ONCE(!queue_is_locked(q)); | |
452 | ||
453 | if (test_bit(flag, &q->queue_flags)) { | |
454 | __clear_bit(flag, &q->queue_flags); | |
455 | return 1; | |
456 | } | |
457 | ||
458 | return 0; | |
459 | } | |
460 | ||
461 | static inline int queue_flag_test_and_set(unsigned int flag, | |
462 | struct request_queue *q) | |
463 | { | |
464 | WARN_ON_ONCE(!queue_is_locked(q)); | |
465 | ||
466 | if (!test_bit(flag, &q->queue_flags)) { | |
467 | __set_bit(flag, &q->queue_flags); | |
468 | return 0; | |
469 | } | |
470 | ||
471 | return 1; | |
472 | } | |
473 | ||
75ad23bc NP |
474 | static inline void queue_flag_set(unsigned int flag, struct request_queue *q) |
475 | { | |
8f45c1a5 | 476 | WARN_ON_ONCE(!queue_is_locked(q)); |
75ad23bc NP |
477 | __set_bit(flag, &q->queue_flags); |
478 | } | |
479 | ||
480 | static inline void queue_flag_clear_unlocked(unsigned int flag, | |
481 | struct request_queue *q) | |
482 | { | |
483 | __clear_bit(flag, &q->queue_flags); | |
484 | } | |
485 | ||
0a7ae2ff JA |
486 | static inline int queue_in_flight(struct request_queue *q) |
487 | { | |
488 | return q->in_flight[0] + q->in_flight[1]; | |
489 | } | |
490 | ||
75ad23bc NP |
491 | static inline void queue_flag_clear(unsigned int flag, struct request_queue *q) |
492 | { | |
8f45c1a5 | 493 | WARN_ON_ONCE(!queue_is_locked(q)); |
75ad23bc NP |
494 | __clear_bit(flag, &q->queue_flags); |
495 | } | |
496 | ||
1da177e4 LT |
497 | #define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) |
498 | #define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) | |
34f6055c | 499 | #define blk_queue_dead(q) test_bit(QUEUE_FLAG_DEAD, &(q)->queue_flags) |
ac9fafa1 | 500 | #define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) |
488991e2 AB |
501 | #define blk_queue_noxmerges(q) \ |
502 | test_bit(QUEUE_FLAG_NOXMERGES, &(q)->queue_flags) | |
a68bbddb | 503 | #define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags) |
bc58ba94 | 504 | #define blk_queue_io_stat(q) test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags) |
e2e1a148 | 505 | #define blk_queue_add_random(q) test_bit(QUEUE_FLAG_ADD_RANDOM, &(q)->queue_flags) |
4ee5eaf4 KU |
506 | #define blk_queue_stackable(q) \ |
507 | test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags) | |
c15227de | 508 | #define blk_queue_discard(q) test_bit(QUEUE_FLAG_DISCARD, &(q)->queue_flags) |
8d57a98c AH |
509 | #define blk_queue_secdiscard(q) (blk_queue_discard(q) && \ |
510 | test_bit(QUEUE_FLAG_SECDISCARD, &(q)->queue_flags)) | |
1da177e4 | 511 | |
33659ebb CH |
512 | #define blk_noretry_request(rq) \ |
513 | ((rq)->cmd_flags & (REQ_FAILFAST_DEV|REQ_FAILFAST_TRANSPORT| \ | |
514 | REQ_FAILFAST_DRIVER)) | |
515 | ||
516 | #define blk_account_rq(rq) \ | |
517 | (((rq)->cmd_flags & REQ_STARTED) && \ | |
518 | ((rq)->cmd_type == REQ_TYPE_FS || \ | |
519 | ((rq)->cmd_flags & REQ_DISCARD))) | |
520 | ||
1da177e4 | 521 | #define blk_pm_request(rq) \ |
33659ebb CH |
522 | ((rq)->cmd_type == REQ_TYPE_PM_SUSPEND || \ |
523 | (rq)->cmd_type == REQ_TYPE_PM_RESUME) | |
1da177e4 | 524 | |
ab780f1e | 525 | #define blk_rq_cpu_valid(rq) ((rq)->cpu != -1) |
abae1fde | 526 | #define blk_bidi_rq(rq) ((rq)->next_rq != NULL) |
336cdb40 KU |
527 | /* rq->queuelist of dequeued request must be list_empty() */ |
528 | #define blk_queued_rq(rq) (!list_empty(&(rq)->queuelist)) | |
1da177e4 LT |
529 | |
530 | #define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist) | |
531 | ||
4aff5e23 | 532 | #define rq_data_dir(rq) ((rq)->cmd_flags & 1) |
1da177e4 | 533 | |
e692cb66 MP |
534 | static inline unsigned int blk_queue_cluster(struct request_queue *q) |
535 | { | |
536 | return q->limits.cluster; | |
537 | } | |
538 | ||
9e2585a8 | 539 | /* |
1faa16d2 | 540 | * We regard a request as sync, if either a read or a sync write |
9e2585a8 | 541 | */ |
1faa16d2 JA |
542 | static inline bool rw_is_sync(unsigned int rw_flags) |
543 | { | |
7b6d91da | 544 | return !(rw_flags & REQ_WRITE) || (rw_flags & REQ_SYNC); |
1faa16d2 JA |
545 | } |
546 | ||
547 | static inline bool rq_is_sync(struct request *rq) | |
548 | { | |
549 | return rw_is_sync(rq->cmd_flags); | |
550 | } | |
551 | ||
1faa16d2 | 552 | static inline int blk_queue_full(struct request_queue *q, int sync) |
1da177e4 | 553 | { |
1faa16d2 JA |
554 | if (sync) |
555 | return test_bit(QUEUE_FLAG_SYNCFULL, &q->queue_flags); | |
556 | return test_bit(QUEUE_FLAG_ASYNCFULL, &q->queue_flags); | |
1da177e4 LT |
557 | } |
558 | ||
1faa16d2 | 559 | static inline void blk_set_queue_full(struct request_queue *q, int sync) |
1da177e4 | 560 | { |
1faa16d2 JA |
561 | if (sync) |
562 | queue_flag_set(QUEUE_FLAG_SYNCFULL, q); | |
1da177e4 | 563 | else |
1faa16d2 | 564 | queue_flag_set(QUEUE_FLAG_ASYNCFULL, q); |
1da177e4 LT |
565 | } |
566 | ||
1faa16d2 | 567 | static inline void blk_clear_queue_full(struct request_queue *q, int sync) |
1da177e4 | 568 | { |
1faa16d2 JA |
569 | if (sync) |
570 | queue_flag_clear(QUEUE_FLAG_SYNCFULL, q); | |
1da177e4 | 571 | else |
1faa16d2 | 572 | queue_flag_clear(QUEUE_FLAG_ASYNCFULL, q); |
1da177e4 LT |
573 | } |
574 | ||
575 | ||
576 | /* | |
577 | * mergeable request must not have _NOMERGE or _BARRIER bit set, nor may | |
578 | * it already be started by driver. | |
579 | */ | |
580 | #define RQ_NOMERGE_FLAGS \ | |
02e031cb | 581 | (REQ_NOMERGE | REQ_STARTED | REQ_SOFTBARRIER | REQ_FLUSH | REQ_FUA) |
1da177e4 | 582 | #define rq_mergeable(rq) \ |
e17fc0a1 | 583 | (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && \ |
33659ebb CH |
584 | (((rq)->cmd_flags & REQ_DISCARD) || \ |
585 | (rq)->cmd_type == REQ_TYPE_FS)) | |
1da177e4 | 586 | |
1da177e4 LT |
587 | /* |
588 | * q->prep_rq_fn return values | |
589 | */ | |
590 | #define BLKPREP_OK 0 /* serve it */ | |
591 | #define BLKPREP_KILL 1 /* fatal error, kill */ | |
592 | #define BLKPREP_DEFER 2 /* leave on queue */ | |
593 | ||
594 | extern unsigned long blk_max_low_pfn, blk_max_pfn; | |
595 | ||
596 | /* | |
597 | * standard bounce addresses: | |
598 | * | |
599 | * BLK_BOUNCE_HIGH : bounce all highmem pages | |
600 | * BLK_BOUNCE_ANY : don't bounce anything | |
601 | * BLK_BOUNCE_ISA : bounce pages above ISA DMA boundary | |
602 | */ | |
2472892a AK |
603 | |
604 | #if BITS_PER_LONG == 32 | |
1da177e4 | 605 | #define BLK_BOUNCE_HIGH ((u64)blk_max_low_pfn << PAGE_SHIFT) |
2472892a AK |
606 | #else |
607 | #define BLK_BOUNCE_HIGH -1ULL | |
608 | #endif | |
609 | #define BLK_BOUNCE_ANY (-1ULL) | |
bfe17231 | 610 | #define BLK_BOUNCE_ISA (DMA_BIT_MASK(24)) |
1da177e4 | 611 | |
3d6392cf JA |
612 | /* |
613 | * default timeout for SG_IO if none specified | |
614 | */ | |
615 | #define BLK_DEFAULT_SG_TIMEOUT (60 * HZ) | |
f2f1fa78 | 616 | #define BLK_MIN_SG_TIMEOUT (7 * HZ) |
3d6392cf | 617 | |
2a7326b5 | 618 | #ifdef CONFIG_BOUNCE |
1da177e4 | 619 | extern int init_emergency_isa_pool(void); |
165125e1 | 620 | extern void blk_queue_bounce(struct request_queue *q, struct bio **bio); |
1da177e4 LT |
621 | #else |
622 | static inline int init_emergency_isa_pool(void) | |
623 | { | |
624 | return 0; | |
625 | } | |
165125e1 | 626 | static inline void blk_queue_bounce(struct request_queue *q, struct bio **bio) |
1da177e4 LT |
627 | { |
628 | } | |
629 | #endif /* CONFIG_MMU */ | |
630 | ||
152e283f FT |
631 | struct rq_map_data { |
632 | struct page **pages; | |
633 | int page_order; | |
634 | int nr_entries; | |
56c451f4 | 635 | unsigned long offset; |
97ae77a1 | 636 | int null_mapped; |
ecb554a8 | 637 | int from_user; |
152e283f FT |
638 | }; |
639 | ||
5705f702 N |
640 | struct req_iterator { |
641 | int i; | |
642 | struct bio *bio; | |
643 | }; | |
644 | ||
645 | /* This should not be used directly - use rq_for_each_segment */ | |
1e428079 JA |
646 | #define for_each_bio(_bio) \ |
647 | for (; _bio; _bio = _bio->bi_next) | |
5705f702 | 648 | #define __rq_for_each_bio(_bio, rq) \ |
1da177e4 LT |
649 | if ((rq->bio)) \ |
650 | for (_bio = (rq)->bio; _bio; _bio = _bio->bi_next) | |
651 | ||
5705f702 N |
652 | #define rq_for_each_segment(bvl, _rq, _iter) \ |
653 | __rq_for_each_bio(_iter.bio, _rq) \ | |
654 | bio_for_each_segment(bvl, _iter.bio, _iter.i) | |
655 | ||
656 | #define rq_iter_last(rq, _iter) \ | |
657 | (_iter.bio->bi_next == NULL && _iter.i == _iter.bio->bi_vcnt-1) | |
658 | ||
2d4dc890 IL |
659 | #ifndef ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE |
660 | # error "You should define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE for your platform" | |
661 | #endif | |
662 | #if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE | |
663 | extern void rq_flush_dcache_pages(struct request *rq); | |
664 | #else | |
665 | static inline void rq_flush_dcache_pages(struct request *rq) | |
666 | { | |
667 | } | |
668 | #endif | |
669 | ||
1da177e4 LT |
670 | extern int blk_register_queue(struct gendisk *disk); |
671 | extern void blk_unregister_queue(struct gendisk *disk); | |
1da177e4 | 672 | extern void generic_make_request(struct bio *bio); |
2a4aa30c | 673 | extern void blk_rq_init(struct request_queue *q, struct request *rq); |
1da177e4 | 674 | extern void blk_put_request(struct request *); |
165125e1 | 675 | extern void __blk_put_request(struct request_queue *, struct request *); |
165125e1 | 676 | extern struct request *blk_get_request(struct request_queue *, int, gfp_t); |
79eb63e9 BH |
677 | extern struct request *blk_make_request(struct request_queue *, struct bio *, |
678 | gfp_t); | |
165125e1 | 679 | extern void blk_requeue_request(struct request_queue *, struct request *); |
66ac0280 CH |
680 | extern void blk_add_request_payload(struct request *rq, struct page *page, |
681 | unsigned int len); | |
82124d60 | 682 | extern int blk_rq_check_limits(struct request_queue *q, struct request *rq); |
ef9e3fac | 683 | extern int blk_lld_busy(struct request_queue *q); |
b0fd271d KU |
684 | extern int blk_rq_prep_clone(struct request *rq, struct request *rq_src, |
685 | struct bio_set *bs, gfp_t gfp_mask, | |
686 | int (*bio_ctr)(struct bio *, struct bio *, void *), | |
687 | void *data); | |
688 | extern void blk_rq_unprep_clone(struct request *rq); | |
82124d60 KU |
689 | extern int blk_insert_cloned_request(struct request_queue *q, |
690 | struct request *rq); | |
3cca6dc1 | 691 | extern void blk_delay_queue(struct request_queue *, unsigned long); |
165125e1 | 692 | extern void blk_recount_segments(struct request_queue *, struct bio *); |
74f3c8af AV |
693 | extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t, |
694 | unsigned int, void __user *); | |
e915e872 AV |
695 | extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t, |
696 | struct scsi_ioctl_command __user *); | |
3fcfab16 | 697 | |
5a7bbad2 | 698 | extern void blk_queue_bio(struct request_queue *q, struct bio *bio); |
166e1f90 | 699 | |
3fcfab16 AM |
700 | /* |
701 | * A queue has just exitted congestion. Note this in the global counter of | |
702 | * congested queues, and wake up anyone who was waiting for requests to be | |
703 | * put back. | |
704 | */ | |
8aa7e847 | 705 | static inline void blk_clear_queue_congested(struct request_queue *q, int sync) |
3fcfab16 | 706 | { |
8aa7e847 | 707 | clear_bdi_congested(&q->backing_dev_info, sync); |
3fcfab16 AM |
708 | } |
709 | ||
710 | /* | |
711 | * A queue has just entered congestion. Flag that in the queue's VM-visible | |
712 | * state flags and increment the global gounter of congested queues. | |
713 | */ | |
8aa7e847 | 714 | static inline void blk_set_queue_congested(struct request_queue *q, int sync) |
3fcfab16 | 715 | { |
8aa7e847 | 716 | set_bdi_congested(&q->backing_dev_info, sync); |
3fcfab16 AM |
717 | } |
718 | ||
165125e1 JA |
719 | extern void blk_start_queue(struct request_queue *q); |
720 | extern void blk_stop_queue(struct request_queue *q); | |
1da177e4 | 721 | extern void blk_sync_queue(struct request_queue *q); |
165125e1 | 722 | extern void __blk_stop_queue(struct request_queue *q); |
24ecfbe2 | 723 | extern void __blk_run_queue(struct request_queue *q); |
165125e1 | 724 | extern void blk_run_queue(struct request_queue *); |
c21e6beb | 725 | extern void blk_run_queue_async(struct request_queue *q); |
a3bce90e | 726 | extern int blk_rq_map_user(struct request_queue *, struct request *, |
152e283f FT |
727 | struct rq_map_data *, void __user *, unsigned long, |
728 | gfp_t); | |
8e5cfc45 | 729 | extern int blk_rq_unmap_user(struct bio *); |
165125e1 JA |
730 | extern int blk_rq_map_kern(struct request_queue *, struct request *, void *, unsigned int, gfp_t); |
731 | extern int blk_rq_map_user_iov(struct request_queue *, struct request *, | |
152e283f FT |
732 | struct rq_map_data *, struct sg_iovec *, int, |
733 | unsigned int, gfp_t); | |
165125e1 | 734 | extern int blk_execute_rq(struct request_queue *, struct gendisk *, |
994ca9a1 | 735 | struct request *, int); |
165125e1 | 736 | extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, |
15fc858a | 737 | struct request *, int, rq_end_io_fn *); |
6e39b69e | 738 | |
165125e1 | 739 | static inline struct request_queue *bdev_get_queue(struct block_device *bdev) |
1da177e4 LT |
740 | { |
741 | return bdev->bd_disk->queue; | |
742 | } | |
743 | ||
5efccd17 | 744 | /* |
80a761fd TH |
745 | * blk_rq_pos() : the current sector |
746 | * blk_rq_bytes() : bytes left in the entire request | |
747 | * blk_rq_cur_bytes() : bytes left in the current segment | |
748 | * blk_rq_err_bytes() : bytes left till the next error boundary | |
749 | * blk_rq_sectors() : sectors left in the entire request | |
750 | * blk_rq_cur_sectors() : sectors left in the current segment | |
5efccd17 | 751 | */ |
5b93629b TH |
752 | static inline sector_t blk_rq_pos(const struct request *rq) |
753 | { | |
a2dec7b3 | 754 | return rq->__sector; |
2e46e8b2 TH |
755 | } |
756 | ||
757 | static inline unsigned int blk_rq_bytes(const struct request *rq) | |
758 | { | |
a2dec7b3 | 759 | return rq->__data_len; |
5b93629b TH |
760 | } |
761 | ||
2e46e8b2 TH |
762 | static inline int blk_rq_cur_bytes(const struct request *rq) |
763 | { | |
764 | return rq->bio ? bio_cur_bytes(rq->bio) : 0; | |
765 | } | |
5efccd17 | 766 | |
80a761fd TH |
767 | extern unsigned int blk_rq_err_bytes(const struct request *rq); |
768 | ||
5b93629b TH |
769 | static inline unsigned int blk_rq_sectors(const struct request *rq) |
770 | { | |
2e46e8b2 | 771 | return blk_rq_bytes(rq) >> 9; |
5b93629b TH |
772 | } |
773 | ||
774 | static inline unsigned int blk_rq_cur_sectors(const struct request *rq) | |
775 | { | |
2e46e8b2 | 776 | return blk_rq_cur_bytes(rq) >> 9; |
5b93629b TH |
777 | } |
778 | ||
9934c8c0 TH |
779 | /* |
780 | * Request issue related functions. | |
781 | */ | |
782 | extern struct request *blk_peek_request(struct request_queue *q); | |
783 | extern void blk_start_request(struct request *rq); | |
784 | extern struct request *blk_fetch_request(struct request_queue *q); | |
785 | ||
1da177e4 | 786 | /* |
2e60e022 TH |
787 | * Request completion related functions. |
788 | * | |
789 | * blk_update_request() completes given number of bytes and updates | |
790 | * the request without completing it. | |
791 | * | |
f06d9a2b TH |
792 | * blk_end_request() and friends. __blk_end_request() must be called |
793 | * with the request queue spinlock acquired. | |
1da177e4 LT |
794 | * |
795 | * Several drivers define their own end_request and call | |
3bcddeac KU |
796 | * blk_end_request() for parts of the original function. |
797 | * This prevents code duplication in drivers. | |
1da177e4 | 798 | */ |
2e60e022 TH |
799 | extern bool blk_update_request(struct request *rq, int error, |
800 | unsigned int nr_bytes); | |
b1f74493 FT |
801 | extern bool blk_end_request(struct request *rq, int error, |
802 | unsigned int nr_bytes); | |
803 | extern void blk_end_request_all(struct request *rq, int error); | |
804 | extern bool blk_end_request_cur(struct request *rq, int error); | |
80a761fd | 805 | extern bool blk_end_request_err(struct request *rq, int error); |
b1f74493 FT |
806 | extern bool __blk_end_request(struct request *rq, int error, |
807 | unsigned int nr_bytes); | |
808 | extern void __blk_end_request_all(struct request *rq, int error); | |
809 | extern bool __blk_end_request_cur(struct request *rq, int error); | |
80a761fd | 810 | extern bool __blk_end_request_err(struct request *rq, int error); |
2e60e022 | 811 | |
ff856bad | 812 | extern void blk_complete_request(struct request *); |
242f9dcb JA |
813 | extern void __blk_complete_request(struct request *); |
814 | extern void blk_abort_request(struct request *); | |
11914a53 | 815 | extern void blk_abort_queue(struct request_queue *); |
28018c24 | 816 | extern void blk_unprep_request(struct request *); |
ff856bad | 817 | |
1da177e4 LT |
818 | /* |
819 | * Access functions for manipulating queue properties | |
820 | */ | |
165125e1 | 821 | extern struct request_queue *blk_init_queue_node(request_fn_proc *rfn, |
1946089a | 822 | spinlock_t *lock, int node_id); |
01effb0d MS |
823 | extern struct request_queue *blk_init_allocated_queue_node(struct request_queue *, |
824 | request_fn_proc *, | |
825 | spinlock_t *, int node_id); | |
165125e1 | 826 | extern struct request_queue *blk_init_queue(request_fn_proc *, spinlock_t *); |
01effb0d MS |
827 | extern struct request_queue *blk_init_allocated_queue(struct request_queue *, |
828 | request_fn_proc *, spinlock_t *); | |
165125e1 JA |
829 | extern void blk_cleanup_queue(struct request_queue *); |
830 | extern void blk_queue_make_request(struct request_queue *, make_request_fn *); | |
831 | extern void blk_queue_bounce_limit(struct request_queue *, u64); | |
72d4cd9f | 832 | extern void blk_limits_max_hw_sectors(struct queue_limits *, unsigned int); |
086fa5ff | 833 | extern void blk_queue_max_hw_sectors(struct request_queue *, unsigned int); |
8a78362c | 834 | extern void blk_queue_max_segments(struct request_queue *, unsigned short); |
165125e1 | 835 | extern void blk_queue_max_segment_size(struct request_queue *, unsigned int); |
67efc925 CH |
836 | extern void blk_queue_max_discard_sectors(struct request_queue *q, |
837 | unsigned int max_discard_sectors); | |
e1defc4f | 838 | extern void blk_queue_logical_block_size(struct request_queue *, unsigned short); |
892b6f90 | 839 | extern void blk_queue_physical_block_size(struct request_queue *, unsigned int); |
c72758f3 MP |
840 | extern void blk_queue_alignment_offset(struct request_queue *q, |
841 | unsigned int alignment); | |
7c958e32 | 842 | extern void blk_limits_io_min(struct queue_limits *limits, unsigned int min); |
c72758f3 | 843 | extern void blk_queue_io_min(struct request_queue *q, unsigned int min); |
3c5820c7 | 844 | extern void blk_limits_io_opt(struct queue_limits *limits, unsigned int opt); |
c72758f3 | 845 | extern void blk_queue_io_opt(struct request_queue *q, unsigned int opt); |
e475bba2 | 846 | extern void blk_set_default_limits(struct queue_limits *lim); |
c72758f3 MP |
847 | extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, |
848 | sector_t offset); | |
17be8c24 MP |
849 | extern int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev, |
850 | sector_t offset); | |
c72758f3 MP |
851 | extern void disk_stack_limits(struct gendisk *disk, struct block_device *bdev, |
852 | sector_t offset); | |
165125e1 | 853 | extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b); |
e3790c7d | 854 | extern void blk_queue_dma_pad(struct request_queue *, unsigned int); |
27f8221a | 855 | extern void blk_queue_update_dma_pad(struct request_queue *, unsigned int); |
2fb98e84 TH |
856 | extern int blk_queue_dma_drain(struct request_queue *q, |
857 | dma_drain_needed_fn *dma_drain_needed, | |
858 | void *buf, unsigned int size); | |
ef9e3fac | 859 | extern void blk_queue_lld_busy(struct request_queue *q, lld_busy_fn *fn); |
165125e1 JA |
860 | extern void blk_queue_segment_boundary(struct request_queue *, unsigned long); |
861 | extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn); | |
28018c24 | 862 | extern void blk_queue_unprep_rq(struct request_queue *, unprep_rq_fn *ufn); |
165125e1 JA |
863 | extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *); |
864 | extern void blk_queue_dma_alignment(struct request_queue *, int); | |
11c3e689 | 865 | extern void blk_queue_update_dma_alignment(struct request_queue *, int); |
165125e1 | 866 | extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *); |
242f9dcb JA |
867 | extern void blk_queue_rq_timed_out(struct request_queue *, rq_timed_out_fn *); |
868 | extern void blk_queue_rq_timeout(struct request_queue *, unsigned int); | |
4913efe4 | 869 | extern void blk_queue_flush(struct request_queue *q, unsigned int flush); |
f3876930 | 870 | extern void blk_queue_flush_queueable(struct request_queue *q, bool queueable); |
1da177e4 | 871 | extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); |
1da177e4 | 872 | |
165125e1 | 873 | extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *); |
1da177e4 | 874 | extern void blk_dump_rq_flags(struct request *, char *); |
1da177e4 | 875 | extern long nr_blockdev_pages(void); |
1da177e4 | 876 | |
09ac46c4 | 877 | bool __must_check blk_get_queue(struct request_queue *); |
165125e1 JA |
878 | struct request_queue *blk_alloc_queue(gfp_t); |
879 | struct request_queue *blk_alloc_queue_node(gfp_t, int); | |
880 | extern void blk_put_queue(struct request_queue *); | |
1da177e4 | 881 | |
316cc67d | 882 | /* |
75df7136 SJ |
883 | * blk_plug permits building a queue of related requests by holding the I/O |
884 | * fragments for a short period. This allows merging of sequential requests | |
885 | * into single larger request. As the requests are moved from a per-task list to | |
886 | * the device's request_queue in a batch, this results in improved scalability | |
887 | * as the lock contention for request_queue lock is reduced. | |
888 | * | |
889 | * It is ok not to disable preemption when adding the request to the plug list | |
890 | * or when attempting a merge, because blk_schedule_flush_list() will only flush | |
891 | * the plug list when the task sleeps by itself. For details, please see | |
892 | * schedule() where blk_schedule_flush_plug() is called. | |
316cc67d | 893 | */ |
73c10101 | 894 | struct blk_plug { |
75df7136 SJ |
895 | unsigned long magic; /* detect uninitialized use-cases */ |
896 | struct list_head list; /* requests */ | |
897 | struct list_head cb_list; /* md requires an unplug callback */ | |
898 | unsigned int should_sort; /* list to be sorted before flushing? */ | |
73c10101 | 899 | }; |
55c022bb SL |
900 | #define BLK_MAX_REQUEST_COUNT 16 |
901 | ||
048c9374 N |
902 | struct blk_plug_cb { |
903 | struct list_head list; | |
904 | void (*callback)(struct blk_plug_cb *); | |
905 | }; | |
73c10101 JA |
906 | |
907 | extern void blk_start_plug(struct blk_plug *); | |
908 | extern void blk_finish_plug(struct blk_plug *); | |
f6603783 | 909 | extern void blk_flush_plug_list(struct blk_plug *, bool); |
73c10101 JA |
910 | |
911 | static inline void blk_flush_plug(struct task_struct *tsk) | |
912 | { | |
913 | struct blk_plug *plug = tsk->plug; | |
914 | ||
a237c1c5 JA |
915 | if (plug) |
916 | blk_flush_plug_list(plug, false); | |
917 | } | |
918 | ||
919 | static inline void blk_schedule_flush_plug(struct task_struct *tsk) | |
920 | { | |
921 | struct blk_plug *plug = tsk->plug; | |
922 | ||
88b996cd | 923 | if (plug) |
f6603783 | 924 | blk_flush_plug_list(plug, true); |
73c10101 JA |
925 | } |
926 | ||
927 | static inline bool blk_needs_flush_plug(struct task_struct *tsk) | |
928 | { | |
929 | struct blk_plug *plug = tsk->plug; | |
930 | ||
048c9374 | 931 | return plug && (!list_empty(&plug->list) || !list_empty(&plug->cb_list)); |
73c10101 JA |
932 | } |
933 | ||
1da177e4 LT |
934 | /* |
935 | * tag stuff | |
936 | */ | |
4aff5e23 | 937 | #define blk_rq_tagged(rq) ((rq)->cmd_flags & REQ_QUEUED) |
165125e1 JA |
938 | extern int blk_queue_start_tag(struct request_queue *, struct request *); |
939 | extern struct request *blk_queue_find_tag(struct request_queue *, int); | |
940 | extern void blk_queue_end_tag(struct request_queue *, struct request *); | |
941 | extern int blk_queue_init_tags(struct request_queue *, int, struct blk_queue_tag *); | |
942 | extern void blk_queue_free_tags(struct request_queue *); | |
943 | extern int blk_queue_resize_tags(struct request_queue *, int); | |
944 | extern void blk_queue_invalidate_tags(struct request_queue *); | |
492dfb48 JB |
945 | extern struct blk_queue_tag *blk_init_tags(int); |
946 | extern void blk_free_tags(struct blk_queue_tag *); | |
1da177e4 | 947 | |
f583f492 DS |
948 | static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt, |
949 | int tag) | |
950 | { | |
951 | if (unlikely(bqt == NULL || tag >= bqt->real_max_depth)) | |
952 | return NULL; | |
953 | return bqt->tag_index[tag]; | |
954 | } | |
dd3932ed CH |
955 | |
956 | #define BLKDEV_DISCARD_SECURE 0x01 /* secure discard */ | |
957 | ||
958 | extern int blkdev_issue_flush(struct block_device *, gfp_t, sector_t *); | |
fbd9b09a DM |
959 | extern int blkdev_issue_discard(struct block_device *bdev, sector_t sector, |
960 | sector_t nr_sects, gfp_t gfp_mask, unsigned long flags); | |
3f14d792 | 961 | extern int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector, |
dd3932ed | 962 | sector_t nr_sects, gfp_t gfp_mask); |
2cf6d26a CH |
963 | static inline int sb_issue_discard(struct super_block *sb, sector_t block, |
964 | sector_t nr_blocks, gfp_t gfp_mask, unsigned long flags) | |
fb2dce86 | 965 | { |
2cf6d26a CH |
966 | return blkdev_issue_discard(sb->s_bdev, block << (sb->s_blocksize_bits - 9), |
967 | nr_blocks << (sb->s_blocksize_bits - 9), | |
968 | gfp_mask, flags); | |
fb2dce86 | 969 | } |
e6fa0be6 | 970 | static inline int sb_issue_zeroout(struct super_block *sb, sector_t block, |
a107e5a3 | 971 | sector_t nr_blocks, gfp_t gfp_mask) |
e6fa0be6 LC |
972 | { |
973 | return blkdev_issue_zeroout(sb->s_bdev, | |
974 | block << (sb->s_blocksize_bits - 9), | |
975 | nr_blocks << (sb->s_blocksize_bits - 9), | |
a107e5a3 | 976 | gfp_mask); |
e6fa0be6 | 977 | } |
1da177e4 | 978 | |
018e0446 | 979 | extern int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm); |
0b07de85 | 980 | |
eb28d31b MP |
981 | enum blk_default_limits { |
982 | BLK_MAX_SEGMENTS = 128, | |
983 | BLK_SAFE_MAX_SECTORS = 255, | |
984 | BLK_DEF_MAX_SECTORS = 1024, | |
985 | BLK_MAX_SEGMENT_SIZE = 65536, | |
986 | BLK_SEG_BOUNDARY_MASK = 0xFFFFFFFFUL, | |
987 | }; | |
0e435ac2 | 988 | |
1da177e4 LT |
989 | #define blkdev_entry_to_request(entry) list_entry((entry), struct request, queuelist) |
990 | ||
ae03bf63 MP |
991 | static inline unsigned long queue_bounce_pfn(struct request_queue *q) |
992 | { | |
025146e1 | 993 | return q->limits.bounce_pfn; |
ae03bf63 MP |
994 | } |
995 | ||
996 | static inline unsigned long queue_segment_boundary(struct request_queue *q) | |
997 | { | |
025146e1 | 998 | return q->limits.seg_boundary_mask; |
ae03bf63 MP |
999 | } |
1000 | ||
1001 | static inline unsigned int queue_max_sectors(struct request_queue *q) | |
1002 | { | |
025146e1 | 1003 | return q->limits.max_sectors; |
ae03bf63 MP |
1004 | } |
1005 | ||
1006 | static inline unsigned int queue_max_hw_sectors(struct request_queue *q) | |
1007 | { | |
025146e1 | 1008 | return q->limits.max_hw_sectors; |
ae03bf63 MP |
1009 | } |
1010 | ||
8a78362c | 1011 | static inline unsigned short queue_max_segments(struct request_queue *q) |
ae03bf63 | 1012 | { |
8a78362c | 1013 | return q->limits.max_segments; |
ae03bf63 MP |
1014 | } |
1015 | ||
1016 | static inline unsigned int queue_max_segment_size(struct request_queue *q) | |
1017 | { | |
025146e1 | 1018 | return q->limits.max_segment_size; |
ae03bf63 MP |
1019 | } |
1020 | ||
e1defc4f | 1021 | static inline unsigned short queue_logical_block_size(struct request_queue *q) |
1da177e4 LT |
1022 | { |
1023 | int retval = 512; | |
1024 | ||
025146e1 MP |
1025 | if (q && q->limits.logical_block_size) |
1026 | retval = q->limits.logical_block_size; | |
1da177e4 LT |
1027 | |
1028 | return retval; | |
1029 | } | |
1030 | ||
e1defc4f | 1031 | static inline unsigned short bdev_logical_block_size(struct block_device *bdev) |
1da177e4 | 1032 | { |
e1defc4f | 1033 | return queue_logical_block_size(bdev_get_queue(bdev)); |
1da177e4 LT |
1034 | } |
1035 | ||
c72758f3 MP |
1036 | static inline unsigned int queue_physical_block_size(struct request_queue *q) |
1037 | { | |
1038 | return q->limits.physical_block_size; | |
1039 | } | |
1040 | ||
892b6f90 | 1041 | static inline unsigned int bdev_physical_block_size(struct block_device *bdev) |
ac481c20 MP |
1042 | { |
1043 | return queue_physical_block_size(bdev_get_queue(bdev)); | |
1044 | } | |
1045 | ||
c72758f3 MP |
1046 | static inline unsigned int queue_io_min(struct request_queue *q) |
1047 | { | |
1048 | return q->limits.io_min; | |
1049 | } | |
1050 | ||
ac481c20 MP |
1051 | static inline int bdev_io_min(struct block_device *bdev) |
1052 | { | |
1053 | return queue_io_min(bdev_get_queue(bdev)); | |
1054 | } | |
1055 | ||
c72758f3 MP |
1056 | static inline unsigned int queue_io_opt(struct request_queue *q) |
1057 | { | |
1058 | return q->limits.io_opt; | |
1059 | } | |
1060 | ||
ac481c20 MP |
1061 | static inline int bdev_io_opt(struct block_device *bdev) |
1062 | { | |
1063 | return queue_io_opt(bdev_get_queue(bdev)); | |
1064 | } | |
1065 | ||
c72758f3 MP |
1066 | static inline int queue_alignment_offset(struct request_queue *q) |
1067 | { | |
ac481c20 | 1068 | if (q->limits.misaligned) |
c72758f3 MP |
1069 | return -1; |
1070 | ||
ac481c20 | 1071 | return q->limits.alignment_offset; |
c72758f3 MP |
1072 | } |
1073 | ||
e03a72e1 | 1074 | static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t sector) |
81744ee4 MP |
1075 | { |
1076 | unsigned int granularity = max(lim->physical_block_size, lim->io_min); | |
e03a72e1 | 1077 | unsigned int alignment = (sector << 9) & (granularity - 1); |
81744ee4 | 1078 | |
e03a72e1 MP |
1079 | return (granularity + lim->alignment_offset - alignment) |
1080 | & (granularity - 1); | |
c72758f3 MP |
1081 | } |
1082 | ||
ac481c20 MP |
1083 | static inline int bdev_alignment_offset(struct block_device *bdev) |
1084 | { | |
1085 | struct request_queue *q = bdev_get_queue(bdev); | |
1086 | ||
1087 | if (q->limits.misaligned) | |
1088 | return -1; | |
1089 | ||
1090 | if (bdev != bdev->bd_contains) | |
1091 | return bdev->bd_part->alignment_offset; | |
1092 | ||
1093 | return q->limits.alignment_offset; | |
1094 | } | |
1095 | ||
86b37281 MP |
1096 | static inline int queue_discard_alignment(struct request_queue *q) |
1097 | { | |
1098 | if (q->limits.discard_misaligned) | |
1099 | return -1; | |
1100 | ||
1101 | return q->limits.discard_alignment; | |
1102 | } | |
1103 | ||
e03a72e1 | 1104 | static inline int queue_limit_discard_alignment(struct queue_limits *lim, sector_t sector) |
86b37281 | 1105 | { |
dd3d145d MP |
1106 | unsigned int alignment = (sector << 9) & (lim->discard_granularity - 1); |
1107 | ||
a934a00a MP |
1108 | if (!lim->max_discard_sectors) |
1109 | return 0; | |
1110 | ||
dd3d145d MP |
1111 | return (lim->discard_granularity + lim->discard_alignment - alignment) |
1112 | & (lim->discard_granularity - 1); | |
86b37281 MP |
1113 | } |
1114 | ||
98262f27 MP |
1115 | static inline unsigned int queue_discard_zeroes_data(struct request_queue *q) |
1116 | { | |
a934a00a | 1117 | if (q->limits.max_discard_sectors && q->limits.discard_zeroes_data == 1) |
98262f27 MP |
1118 | return 1; |
1119 | ||
1120 | return 0; | |
1121 | } | |
1122 | ||
1123 | static inline unsigned int bdev_discard_zeroes_data(struct block_device *bdev) | |
1124 | { | |
1125 | return queue_discard_zeroes_data(bdev_get_queue(bdev)); | |
1126 | } | |
1127 | ||
165125e1 | 1128 | static inline int queue_dma_alignment(struct request_queue *q) |
1da177e4 | 1129 | { |
482eb689 | 1130 | return q ? q->dma_alignment : 511; |
1da177e4 LT |
1131 | } |
1132 | ||
14417799 | 1133 | static inline int blk_rq_aligned(struct request_queue *q, unsigned long addr, |
87904074 FT |
1134 | unsigned int len) |
1135 | { | |
1136 | unsigned int alignment = queue_dma_alignment(q) | q->dma_pad_mask; | |
14417799 | 1137 | return !(addr & alignment) && !(len & alignment); |
87904074 FT |
1138 | } |
1139 | ||
1da177e4 LT |
1140 | /* assumes size > 256 */ |
1141 | static inline unsigned int blksize_bits(unsigned int size) | |
1142 | { | |
1143 | unsigned int bits = 8; | |
1144 | do { | |
1145 | bits++; | |
1146 | size >>= 1; | |
1147 | } while (size > 256); | |
1148 | return bits; | |
1149 | } | |
1150 | ||
2befb9e3 | 1151 | static inline unsigned int block_size(struct block_device *bdev) |
1da177e4 LT |
1152 | { |
1153 | return bdev->bd_block_size; | |
1154 | } | |
1155 | ||
f3876930 | 1156 | static inline bool queue_flush_queueable(struct request_queue *q) |
1157 | { | |
1158 | return !q->flush_not_queueable; | |
1159 | } | |
1160 | ||
1da177e4 LT |
1161 | typedef struct {struct page *v;} Sector; |
1162 | ||
1163 | unsigned char *read_dev_sector(struct block_device *, sector_t, Sector *); | |
1164 | ||
1165 | static inline void put_dev_sector(Sector p) | |
1166 | { | |
1167 | page_cache_release(p.v); | |
1168 | } | |
1169 | ||
1170 | struct work_struct; | |
18887ad9 | 1171 | int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); |
1da177e4 | 1172 | |
9195291e | 1173 | #ifdef CONFIG_BLK_CGROUP |
28f4197e JA |
1174 | /* |
1175 | * This should not be using sched_clock(). A real patch is in progress | |
1176 | * to fix this up, until that is in place we need to disable preemption | |
1177 | * around sched_clock() in this function and set_io_start_time_ns(). | |
1178 | */ | |
9195291e DS |
1179 | static inline void set_start_time_ns(struct request *req) |
1180 | { | |
28f4197e | 1181 | preempt_disable(); |
9195291e | 1182 | req->start_time_ns = sched_clock(); |
28f4197e | 1183 | preempt_enable(); |
9195291e DS |
1184 | } |
1185 | ||
1186 | static inline void set_io_start_time_ns(struct request *req) | |
1187 | { | |
28f4197e | 1188 | preempt_disable(); |
9195291e | 1189 | req->io_start_time_ns = sched_clock(); |
28f4197e | 1190 | preempt_enable(); |
9195291e | 1191 | } |
84c124da DS |
1192 | |
1193 | static inline uint64_t rq_start_time_ns(struct request *req) | |
1194 | { | |
1195 | return req->start_time_ns; | |
1196 | } | |
1197 | ||
1198 | static inline uint64_t rq_io_start_time_ns(struct request *req) | |
1199 | { | |
1200 | return req->io_start_time_ns; | |
1201 | } | |
9195291e DS |
1202 | #else |
1203 | static inline void set_start_time_ns(struct request *req) {} | |
1204 | static inline void set_io_start_time_ns(struct request *req) {} | |
84c124da DS |
1205 | static inline uint64_t rq_start_time_ns(struct request *req) |
1206 | { | |
1207 | return 0; | |
1208 | } | |
1209 | static inline uint64_t rq_io_start_time_ns(struct request *req) | |
1210 | { | |
1211 | return 0; | |
1212 | } | |
9195291e DS |
1213 | #endif |
1214 | ||
1da177e4 LT |
1215 | #define MODULE_ALIAS_BLOCKDEV(major,minor) \ |
1216 | MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor)) | |
1217 | #define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \ | |
1218 | MODULE_ALIAS("block-major-" __stringify(major) "-*") | |
1219 | ||
7ba1ba12 MP |
1220 | #if defined(CONFIG_BLK_DEV_INTEGRITY) |
1221 | ||
b24498d4 JA |
1222 | #define INTEGRITY_FLAG_READ 2 /* verify data integrity on read */ |
1223 | #define INTEGRITY_FLAG_WRITE 4 /* generate data integrity on write */ | |
7ba1ba12 MP |
1224 | |
1225 | struct blk_integrity_exchg { | |
1226 | void *prot_buf; | |
1227 | void *data_buf; | |
1228 | sector_t sector; | |
1229 | unsigned int data_size; | |
1230 | unsigned short sector_size; | |
1231 | const char *disk_name; | |
1232 | }; | |
1233 | ||
1234 | typedef void (integrity_gen_fn) (struct blk_integrity_exchg *); | |
1235 | typedef int (integrity_vrfy_fn) (struct blk_integrity_exchg *); | |
1236 | typedef void (integrity_set_tag_fn) (void *, void *, unsigned int); | |
1237 | typedef void (integrity_get_tag_fn) (void *, void *, unsigned int); | |
1238 | ||
1239 | struct blk_integrity { | |
1240 | integrity_gen_fn *generate_fn; | |
1241 | integrity_vrfy_fn *verify_fn; | |
1242 | integrity_set_tag_fn *set_tag_fn; | |
1243 | integrity_get_tag_fn *get_tag_fn; | |
1244 | ||
1245 | unsigned short flags; | |
1246 | unsigned short tuple_size; | |
1247 | unsigned short sector_size; | |
1248 | unsigned short tag_size; | |
1249 | ||
1250 | const char *name; | |
1251 | ||
1252 | struct kobject kobj; | |
1253 | }; | |
1254 | ||
a63a5cf8 | 1255 | extern bool blk_integrity_is_initialized(struct gendisk *); |
7ba1ba12 MP |
1256 | extern int blk_integrity_register(struct gendisk *, struct blk_integrity *); |
1257 | extern void blk_integrity_unregister(struct gendisk *); | |
ad7fce93 | 1258 | extern int blk_integrity_compare(struct gendisk *, struct gendisk *); |
13f05c8d MP |
1259 | extern int blk_rq_map_integrity_sg(struct request_queue *, struct bio *, |
1260 | struct scatterlist *); | |
1261 | extern int blk_rq_count_integrity_sg(struct request_queue *, struct bio *); | |
1262 | extern int blk_integrity_merge_rq(struct request_queue *, struct request *, | |
1263 | struct request *); | |
1264 | extern int blk_integrity_merge_bio(struct request_queue *, struct request *, | |
1265 | struct bio *); | |
7ba1ba12 | 1266 | |
b04accc4 JA |
1267 | static inline |
1268 | struct blk_integrity *bdev_get_integrity(struct block_device *bdev) | |
1269 | { | |
1270 | return bdev->bd_disk->integrity; | |
1271 | } | |
1272 | ||
b02739b0 MP |
1273 | static inline struct blk_integrity *blk_get_integrity(struct gendisk *disk) |
1274 | { | |
1275 | return disk->integrity; | |
1276 | } | |
1277 | ||
7ba1ba12 MP |
1278 | static inline int blk_integrity_rq(struct request *rq) |
1279 | { | |
d442cc44 MP |
1280 | if (rq->bio == NULL) |
1281 | return 0; | |
1282 | ||
7ba1ba12 MP |
1283 | return bio_integrity(rq->bio); |
1284 | } | |
1285 | ||
13f05c8d MP |
1286 | static inline void blk_queue_max_integrity_segments(struct request_queue *q, |
1287 | unsigned int segs) | |
1288 | { | |
1289 | q->limits.max_integrity_segments = segs; | |
1290 | } | |
1291 | ||
1292 | static inline unsigned short | |
1293 | queue_max_integrity_segments(struct request_queue *q) | |
1294 | { | |
1295 | return q->limits.max_integrity_segments; | |
1296 | } | |
1297 | ||
7ba1ba12 MP |
1298 | #else /* CONFIG_BLK_DEV_INTEGRITY */ |
1299 | ||
1300 | #define blk_integrity_rq(rq) (0) | |
13f05c8d MP |
1301 | #define blk_rq_count_integrity_sg(a, b) (0) |
1302 | #define blk_rq_map_integrity_sg(a, b, c) (0) | |
b04accc4 | 1303 | #define bdev_get_integrity(a) (0) |
b02739b0 | 1304 | #define blk_get_integrity(a) (0) |
7ba1ba12 MP |
1305 | #define blk_integrity_compare(a, b) (0) |
1306 | #define blk_integrity_register(a, b) (0) | |
ea9d6553 NK |
1307 | #define blk_integrity_unregister(a) do { } while (0) |
1308 | #define blk_queue_max_integrity_segments(a, b) do { } while (0) | |
13f05c8d MP |
1309 | #define queue_max_integrity_segments(a) (0) |
1310 | #define blk_integrity_merge_rq(a, b, c) (0) | |
1311 | #define blk_integrity_merge_bio(a, b, c) (0) | |
a63a5cf8 | 1312 | #define blk_integrity_is_initialized(a) (0) |
7ba1ba12 MP |
1313 | |
1314 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ | |
1315 | ||
08f85851 | 1316 | struct block_device_operations { |
d4430d62 AV |
1317 | int (*open) (struct block_device *, fmode_t); |
1318 | int (*release) (struct gendisk *, fmode_t); | |
d4430d62 AV |
1319 | int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); |
1320 | int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); | |
08f85851 AV |
1321 | int (*direct_access) (struct block_device *, sector_t, |
1322 | void **, unsigned long *); | |
77ea887e TH |
1323 | unsigned int (*check_events) (struct gendisk *disk, |
1324 | unsigned int clearing); | |
1325 | /* ->media_changed() is DEPRECATED, use ->check_events() instead */ | |
08f85851 | 1326 | int (*media_changed) (struct gendisk *); |
c3e33e04 | 1327 | void (*unlock_native_capacity) (struct gendisk *); |
08f85851 AV |
1328 | int (*revalidate_disk) (struct gendisk *); |
1329 | int (*getgeo)(struct block_device *, struct hd_geometry *); | |
b3a27d05 NG |
1330 | /* this callback is with swap_lock and sometimes page table lock held */ |
1331 | void (*swap_slot_free_notify) (struct block_device *, unsigned long); | |
08f85851 AV |
1332 | struct module *owner; |
1333 | }; | |
1334 | ||
633a08b8 AV |
1335 | extern int __blkdev_driver_ioctl(struct block_device *, fmode_t, unsigned int, |
1336 | unsigned long); | |
9361401e DH |
1337 | #else /* CONFIG_BLOCK */ |
1338 | /* | |
1339 | * stubs for when the block layer is configured out | |
1340 | */ | |
1341 | #define buffer_heads_over_limit 0 | |
1342 | ||
9361401e DH |
1343 | static inline long nr_blockdev_pages(void) |
1344 | { | |
1345 | return 0; | |
1346 | } | |
1347 | ||
1f940bdf JA |
1348 | struct blk_plug { |
1349 | }; | |
1350 | ||
1351 | static inline void blk_start_plug(struct blk_plug *plug) | |
73c10101 JA |
1352 | { |
1353 | } | |
1354 | ||
1f940bdf | 1355 | static inline void blk_finish_plug(struct blk_plug *plug) |
73c10101 JA |
1356 | { |
1357 | } | |
1358 | ||
1f940bdf | 1359 | static inline void blk_flush_plug(struct task_struct *task) |
73c10101 JA |
1360 | { |
1361 | } | |
1362 | ||
a237c1c5 JA |
1363 | static inline void blk_schedule_flush_plug(struct task_struct *task) |
1364 | { | |
1365 | } | |
1366 | ||
1367 | ||
73c10101 JA |
1368 | static inline bool blk_needs_flush_plug(struct task_struct *tsk) |
1369 | { | |
1370 | return false; | |
1371 | } | |
1372 | ||
9361401e DH |
1373 | #endif /* CONFIG_BLOCK */ |
1374 | ||
1da177e4 | 1375 | #endif |