Commit 5404bc7a authored by Jens Axboe's avatar Jens Axboe Committed by Jens Axboe

[PATCH] Allow file systems to differentiate between data and meta reads

We can use this information for making more intelligent priority
decisions, and it will also be useful for blktrace.
Signed-off-by: default avatarJens Axboe <axboe@suse.de>
parent da20a20f
...@@ -2884,6 +2884,8 @@ static void init_request_from_bio(struct request *req, struct bio *bio) ...@@ -2884,6 +2884,8 @@ static void init_request_from_bio(struct request *req, struct bio *bio)
if (bio_sync(bio)) if (bio_sync(bio))
req->cmd_flags |= REQ_RW_SYNC; req->cmd_flags |= REQ_RW_SYNC;
if (bio_rw_meta(bio))
req->cmd_flags |= REQ_RW_META;
req->errors = 0; req->errors = 0;
req->hard_sector = req->sector = bio->bi_sector; req->hard_sector = req->sector = bio->bi_sector;
......
...@@ -148,6 +148,7 @@ struct bio { ...@@ -148,6 +148,7 @@ struct bio {
#define BIO_RW_BARRIER 2 #define BIO_RW_BARRIER 2
#define BIO_RW_FAILFAST 3 #define BIO_RW_FAILFAST 3
#define BIO_RW_SYNC 4 #define BIO_RW_SYNC 4
#define BIO_RW_META 5
/* /*
* upper 16 bits of bi_rw define the io priority of this bio * upper 16 bits of bi_rw define the io priority of this bio
...@@ -178,6 +179,7 @@ struct bio { ...@@ -178,6 +179,7 @@ struct bio {
#define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNC)) #define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNC))
#define bio_failfast(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST)) #define bio_failfast(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST))
#define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD)) #define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD))
#define bio_rw_meta(bio) ((bio)->bi_rw & (1 << BIO_RW_META))
/* /*
* will die * will die
......
...@@ -180,6 +180,7 @@ enum rq_flag_bits { ...@@ -180,6 +180,7 @@ enum rq_flag_bits {
__REQ_ORDERED_COLOR, /* is before or after barrier */ __REQ_ORDERED_COLOR, /* is before or after barrier */
__REQ_RW_SYNC, /* request is sync (O_DIRECT) */ __REQ_RW_SYNC, /* request is sync (O_DIRECT) */
__REQ_ALLOCED, /* request came from our alloc pool */ __REQ_ALLOCED, /* request came from our alloc pool */
__REQ_RW_META, /* metadata io request */
__REQ_NR_BITS, /* stops here */ __REQ_NR_BITS, /* stops here */
}; };
...@@ -200,6 +201,7 @@ enum rq_flag_bits { ...@@ -200,6 +201,7 @@ enum rq_flag_bits {
#define REQ_ORDERED_COLOR (1 << __REQ_ORDERED_COLOR) #define REQ_ORDERED_COLOR (1 << __REQ_ORDERED_COLOR)
#define REQ_RW_SYNC (1 << __REQ_RW_SYNC) #define REQ_RW_SYNC (1 << __REQ_RW_SYNC)
#define REQ_ALLOCED (1 << __REQ_ALLOCED) #define REQ_ALLOCED (1 << __REQ_ALLOCED)
#define REQ_RW_META (1 << __REQ_RW_META)
#define BLK_MAX_CDB 16 #define BLK_MAX_CDB 16
...@@ -543,6 +545,7 @@ enum { ...@@ -543,6 +545,7 @@ enum {
* We regard a request as sync, if it's a READ or a SYNC write. * We regard a request as sync, if it's a READ or a SYNC write.
*/ */
#define rq_is_sync(rq) (rq_data_dir((rq)) == READ || (rq)->cmd_flags & REQ_RW_SYNC) #define rq_is_sync(rq) (rq_data_dir((rq)) == READ || (rq)->cmd_flags & REQ_RW_SYNC)
#define rq_is_meta(rq) ((rq)->cmd_flags & REQ_RW_META)
static inline int blk_queue_full(struct request_queue *q, int rw) static inline int blk_queue_full(struct request_queue *q, int rw)
{ {
......
...@@ -80,6 +80,7 @@ extern int dir_notify_enable; ...@@ -80,6 +80,7 @@ extern int dir_notify_enable;
#define READA 2 /* read-ahead - don't block if no resources */ #define READA 2 /* read-ahead - don't block if no resources */
#define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */ #define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */
#define READ_SYNC (READ | (1 << BIO_RW_SYNC)) #define READ_SYNC (READ | (1 << BIO_RW_SYNC))
#define READ_META (READ | (1 << BIO_RW_META))
#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC)) #define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC))
#define WRITE_BARRIER ((1 << BIO_RW) | (1 << BIO_RW_BARRIER)) #define WRITE_BARRIER ((1 << BIO_RW) | (1 << BIO_RW_BARRIER))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment