Skip to content

Commit

Permalink
block: seperate bio/request unplug and sync bits
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Jens Axboe committed Jan 30, 2009
1 parent 1308835 commit 213d941
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
5 changes: 4 additions & 1 deletion block/blk-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,8 @@ void init_request_from_bio(struct request *req, struct bio *bio)

if (bio_sync(bio))
req->cmd_flags |= REQ_RW_SYNC;
if (bio_unplug(bio))
req->cmd_flags |= REQ_UNPLUG;
if (bio_rw_meta(bio))
req->cmd_flags |= REQ_RW_META;

Expand All @@ -1141,6 +1143,7 @@ static int __make_request(struct request_queue *q, struct bio *bio)
int el_ret, nr_sectors;
const unsigned short prio = bio_prio(bio);
const int sync = bio_sync(bio);
const int unplug = bio_unplug(bio);
int rw_flags;

nr_sectors = bio_sectors(bio);
Expand Down Expand Up @@ -1244,7 +1247,7 @@ static int __make_request(struct request_queue *q, struct bio *bio)
blk_plug_device(q);
add_request(q, req);
out:
if (sync || blk_queue_nonrot(q))
if (unplug || blk_queue_nonrot(q))
__generic_unplug_device(q);
spin_unlock_irq(q->queue_lock);
return 0;
Expand Down
18 changes: 11 additions & 7 deletions include/linux/bio.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,15 @@ struct bio {
#define BIO_RW 0 /* Must match RW in req flags (blkdev.h) */
#define BIO_RW_AHEAD 1 /* Must match FAILFAST in req flags */
#define BIO_RW_BARRIER 2
#define BIO_RW_SYNC 3
#define BIO_RW_META 4
#define BIO_RW_DISCARD 5
#define BIO_RW_FAILFAST_DEV 6
#define BIO_RW_FAILFAST_TRANSPORT 7
#define BIO_RW_FAILFAST_DRIVER 8
#define BIO_RW_SYNCIO 3
#define BIO_RW_UNPLUG 4
#define BIO_RW_META 5
#define BIO_RW_DISCARD 6
#define BIO_RW_FAILFAST_DEV 7
#define BIO_RW_FAILFAST_TRANSPORT 8
#define BIO_RW_FAILFAST_DRIVER 9

#define BIO_RW_SYNC (BIO_RW_SYNCIO | BIO_RW_UNPLUG)

/*
* upper 16 bits of bi_rw define the io priority of this bio
Expand All @@ -194,7 +197,8 @@ struct bio {
#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx)
#define bio_sectors(bio) ((bio)->bi_size >> 9)
#define bio_barrier(bio) ((bio)->bi_rw & (1 << BIO_RW_BARRIER))
#define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNC))
#define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNCIO))
#define bio_unplug(bio) ((bio)->bi_rw & (1 << BIO_RW_UNPLUG))
#define bio_failfast_dev(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_DEV))
#define bio_failfast_transport(bio) \
((bio)->bi_rw & (1 << BIO_RW_FAILFAST_TRANSPORT))
Expand Down
2 changes: 2 additions & 0 deletions include/linux/blkdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ enum rq_flag_bits {
__REQ_RW_META, /* metadata io request */
__REQ_COPY_USER, /* contains copies of user pages */
__REQ_INTEGRITY, /* integrity metadata has been remapped */
__REQ_UNPLUG, /* unplug queue on submission */
__REQ_NR_BITS, /* stops here */
};

Expand All @@ -134,6 +135,7 @@ enum rq_flag_bits {
#define REQ_RW_META (1 << __REQ_RW_META)
#define REQ_COPY_USER (1 << __REQ_COPY_USER)
#define REQ_INTEGRITY (1 << __REQ_INTEGRITY)
#define REQ_UNPLUG (1 << __REQ_UNPLUG)

#define BLK_MAX_CDB 16

Expand Down

0 comments on commit 213d941

Please sign in to comment.