aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/blk_types.h2
-rw-r--r--include/linux/blkdev.h42
-rw-r--r--include/linux/elevator.h1
-rw-r--r--include/linux/sched.h6
4 files changed, 51 insertions, 0 deletions
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index dddedfc0af81..16b286473042 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -152,6 +152,7 @@ enum rq_flag_bits {
152 __REQ_IO_STAT, /* account I/O stat */ 152 __REQ_IO_STAT, /* account I/O stat */
153 __REQ_MIXED_MERGE, /* merge of different types, fail separately */ 153 __REQ_MIXED_MERGE, /* merge of different types, fail separately */
154 __REQ_SECURE, /* secure discard (used with __REQ_DISCARD) */ 154 __REQ_SECURE, /* secure discard (used with __REQ_DISCARD) */
155 __REQ_ON_PLUG, /* on plug list */
155 __REQ_NR_BITS, /* stops here */ 156 __REQ_NR_BITS, /* stops here */
156}; 157};
157 158
@@ -193,5 +194,6 @@ enum rq_flag_bits {
193#define REQ_IO_STAT (1 << __REQ_IO_STAT) 194#define REQ_IO_STAT (1 << __REQ_IO_STAT)
194#define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE) 195#define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE)
195#define REQ_SECURE (1 << __REQ_SECURE) 196#define REQ_SECURE (1 << __REQ_SECURE)
197#define REQ_ON_PLUG (1 << __REQ_ON_PLUG)
196 198
197#endif /* __LINUX_BLK_TYPES_H */ 199#endif /* __LINUX_BLK_TYPES_H */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index f55b2a8b6610..5873037eeb91 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -871,6 +871,31 @@ struct request_queue *blk_alloc_queue(gfp_t);
871struct request_queue *blk_alloc_queue_node(gfp_t, int); 871struct request_queue *blk_alloc_queue_node(gfp_t, int);
872extern void blk_put_queue(struct request_queue *); 872extern void blk_put_queue(struct request_queue *);
873 873
874struct blk_plug {
875 unsigned long magic;
876 struct list_head list;
877 unsigned int should_sort;
878};
879
880extern void blk_start_plug(struct blk_plug *);
881extern void blk_finish_plug(struct blk_plug *);
882extern void __blk_flush_plug(struct task_struct *, struct blk_plug *);
883
884static inline void blk_flush_plug(struct task_struct *tsk)
885{
886 struct blk_plug *plug = tsk->plug;
887
888 if (unlikely(plug))
889 __blk_flush_plug(tsk, plug);
890}
891
892static inline bool blk_needs_flush_plug(struct task_struct *tsk)
893{
894 struct blk_plug *plug = tsk->plug;
895
896 return plug && !list_empty(&plug->list);
897}
898
874/* 899/*
875 * tag stuff 900 * tag stuff
876 */ 901 */
@@ -1294,6 +1319,23 @@ static inline long nr_blockdev_pages(void)
1294 return 0; 1319 return 0;
1295} 1320}
1296 1321
1322static inline void blk_start_plug(struct list_head *list)
1323{
1324}
1325
1326static inline void blk_finish_plug(struct list_head *list)
1327{
1328}
1329
1330static inline void blk_flush_plug(struct task_struct *tsk)
1331{
1332}
1333
1334static inline bool blk_needs_flush_plug(struct task_struct *tsk)
1335{
1336 return false;
1337}
1338
1297#endif /* CONFIG_BLOCK */ 1339#endif /* CONFIG_BLOCK */
1298 1340
1299#endif 1341#endif
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 39b68edb388d..8857cf9adbb7 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -105,6 +105,7 @@ extern void elv_add_request(struct request_queue *, struct request *, int, int);
105extern void __elv_add_request(struct request_queue *, struct request *, int, int); 105extern void __elv_add_request(struct request_queue *, struct request *, int, int);
106extern void elv_insert(struct request_queue *, struct request *, int); 106extern void elv_insert(struct request_queue *, struct request *, int);
107extern int elv_merge(struct request_queue *, struct request **, struct bio *); 107extern int elv_merge(struct request_queue *, struct request **, struct bio *);
108extern int elv_try_merge(struct request *, struct bio *);
108extern void elv_merge_requests(struct request_queue *, struct request *, 109extern void elv_merge_requests(struct request_queue *, struct request *,
109 struct request *); 110 struct request *);
110extern void elv_merged_request(struct request_queue *, struct request *, int); 111extern void elv_merged_request(struct request_queue *, struct request *, int);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 777d8a5ed06b..96ac22643742 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -99,6 +99,7 @@ struct robust_list_head;
99struct bio_list; 99struct bio_list;
100struct fs_struct; 100struct fs_struct;
101struct perf_event_context; 101struct perf_event_context;
102struct blk_plug;
102 103
103/* 104/*
104 * List of flags we want to share for kernel threads, 105 * List of flags we want to share for kernel threads,
@@ -1429,6 +1430,11 @@ struct task_struct {
1429/* stacked block device info */ 1430/* stacked block device info */
1430 struct bio_list *bio_list; 1431 struct bio_list *bio_list;
1431 1432
1433#ifdef CONFIG_BLOCK
1434/* stack plugging */
1435 struct blk_plug *plug;
1436#endif
1437
1432/* VM state */ 1438/* VM state */
1433 struct reclaim_state *reclaim_state; 1439 struct reclaim_state *reclaim_state;
1434 1440