aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2009-01-06 03:16:05 -0500
committerJens Axboe <jens.axboe@oracle.com>2009-01-30 06:34:37 -0500
commit213d9417fec62ef4c3675621b9364a667954d4dd (patch)
treed115a92085288d2d9c2ba0e8cbc573cccdcd8e46
parent1308835ffffe6d61ad1f48c5c381c9cc47f683ec (diff)
block: seperate bio/request unplug and sync bits
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r--block/blk-core.c5
-rw-r--r--include/linux/bio.h18
-rw-r--r--include/linux/blkdev.h2
3 files changed, 17 insertions, 8 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index a824e49c0d0a..9e2e86fb78b8 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1125,6 +1125,8 @@ void init_request_from_bio(struct request *req, struct bio *bio)
1125 1125
1126 if (bio_sync(bio)) 1126 if (bio_sync(bio))
1127 req->cmd_flags |= REQ_RW_SYNC; 1127 req->cmd_flags |= REQ_RW_SYNC;
1128 if (bio_unplug(bio))
1129 req->cmd_flags |= REQ_UNPLUG;
1128 if (bio_rw_meta(bio)) 1130 if (bio_rw_meta(bio))
1129 req->cmd_flags |= REQ_RW_META; 1131 req->cmd_flags |= REQ_RW_META;
1130 1132
@@ -1141,6 +1143,7 @@ static int __make_request(struct request_queue *q, struct bio *bio)
1141 int el_ret, nr_sectors; 1143 int el_ret, nr_sectors;
1142 const unsigned short prio = bio_prio(bio); 1144 const unsigned short prio = bio_prio(bio);
1143 const int sync = bio_sync(bio); 1145 const int sync = bio_sync(bio);
1146 const int unplug = bio_unplug(bio);
1144 int rw_flags; 1147 int rw_flags;
1145 1148
1146 nr_sectors = bio_sectors(bio); 1149 nr_sectors = bio_sectors(bio);
@@ -1244,7 +1247,7 @@ get_rq:
1244 blk_plug_device(q); 1247 blk_plug_device(q);
1245 add_request(q, req); 1248 add_request(q, req);
1246out: 1249out:
1247 if (sync || blk_queue_nonrot(q)) 1250 if (unplug || blk_queue_nonrot(q))
1248 __generic_unplug_device(q); 1251 __generic_unplug_device(q);
1249 spin_unlock_irq(q->queue_lock); 1252 spin_unlock_irq(q->queue_lock);
1250 return 0; 1253 return 0;
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 5175aa3103c6..f53568c5852e 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -163,12 +163,15 @@ struct bio {
163#define BIO_RW 0 /* Must match RW in req flags (blkdev.h) */ 163#define BIO_RW 0 /* Must match RW in req flags (blkdev.h) */
164#define BIO_RW_AHEAD 1 /* Must match FAILFAST in req flags */ 164#define BIO_RW_AHEAD 1 /* Must match FAILFAST in req flags */
165#define BIO_RW_BARRIER 2 165#define BIO_RW_BARRIER 2
166#define BIO_RW_SYNC 3 166#define BIO_RW_SYNCIO 3
167#define BIO_RW_META 4 167#define BIO_RW_UNPLUG 4
168#define BIO_RW_DISCARD 5 168#define BIO_RW_META 5
169#define BIO_RW_FAILFAST_DEV 6 169#define BIO_RW_DISCARD 6
170#define BIO_RW_FAILFAST_TRANSPORT 7 170#define BIO_RW_FAILFAST_DEV 7
171#define BIO_RW_FAILFAST_DRIVER 8 171#define BIO_RW_FAILFAST_TRANSPORT 8
172#define BIO_RW_FAILFAST_DRIVER 9
173
174#define BIO_RW_SYNC (BIO_RW_SYNCIO | BIO_RW_UNPLUG)
172 175
173/* 176/*
174 * upper 16 bits of bi_rw define the io priority of this bio 177 * upper 16 bits of bi_rw define the io priority of this bio
@@ -194,7 +197,8 @@ struct bio {
194#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx) 197#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx)
195#define bio_sectors(bio) ((bio)->bi_size >> 9) 198#define bio_sectors(bio) ((bio)->bi_size >> 9)
196#define bio_barrier(bio) ((bio)->bi_rw & (1 << BIO_RW_BARRIER)) 199#define bio_barrier(bio) ((bio)->bi_rw & (1 << BIO_RW_BARRIER))
197#define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNC)) 200#define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNCIO))
201#define bio_unplug(bio) ((bio)->bi_rw & (1 << BIO_RW_UNPLUG))
198#define bio_failfast_dev(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_DEV)) 202#define bio_failfast_dev(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_DEV))
199#define bio_failfast_transport(bio) \ 203#define bio_failfast_transport(bio) \
200 ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_TRANSPORT)) 204 ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_TRANSPORT))
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 044467ef7b11..75426e4b8cdf 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -108,6 +108,7 @@ enum rq_flag_bits {
108 __REQ_RW_META, /* metadata io request */ 108 __REQ_RW_META, /* metadata io request */
109 __REQ_COPY_USER, /* contains copies of user pages */ 109 __REQ_COPY_USER, /* contains copies of user pages */
110 __REQ_INTEGRITY, /* integrity metadata has been remapped */ 110 __REQ_INTEGRITY, /* integrity metadata has been remapped */
111 __REQ_UNPLUG, /* unplug queue on submission */
111 __REQ_NR_BITS, /* stops here */ 112 __REQ_NR_BITS, /* stops here */
112}; 113};
113 114
@@ -134,6 +135,7 @@ enum rq_flag_bits {
134#define REQ_RW_META (1 << __REQ_RW_META) 135#define REQ_RW_META (1 << __REQ_RW_META)
135#define REQ_COPY_USER (1 << __REQ_COPY_USER) 136#define REQ_COPY_USER (1 << __REQ_COPY_USER)
136#define REQ_INTEGRITY (1 << __REQ_INTEGRITY) 137#define REQ_INTEGRITY (1 << __REQ_INTEGRITY)
138#define REQ_UNPLUG (1 << __REQ_UNPLUG)
137 139
138#define BLK_MAX_CDB 16 140#define BLK_MAX_CDB 16
139 141