Commit 5404bc7a87b9949cf61e0174b21f80e73239ab25

Authored by Jens Axboe
Committed by Jens Axboe
1 parent da20a20f3b

[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: Jens Axboe <axboe@suse.de>

Showing 4 changed files with 8 additions and 0 deletions Side-by-side Diff

... ... @@ -2884,6 +2884,8 @@
2884 2884  
2885 2885 if (bio_sync(bio))
2886 2886 req->cmd_flags |= REQ_RW_SYNC;
  2887 + if (bio_rw_meta(bio))
  2888 + req->cmd_flags |= REQ_RW_META;
2887 2889  
2888 2890 req->errors = 0;
2889 2891 req->hard_sector = req->sector = bio->bi_sector;
... ... @@ -148,6 +148,7 @@
148 148 #define BIO_RW_BARRIER 2
149 149 #define BIO_RW_FAILFAST 3
150 150 #define BIO_RW_SYNC 4
  151 +#define BIO_RW_META 5
151 152  
152 153 /*
153 154 * upper 16 bits of bi_rw define the io priority of this bio
... ... @@ -178,6 +179,7 @@
178 179 #define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNC))
179 180 #define bio_failfast(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST))
180 181 #define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD))
  182 +#define bio_rw_meta(bio) ((bio)->bi_rw & (1 << BIO_RW_META))
181 183  
182 184 /*
183 185 * will die
include/linux/blkdev.h
... ... @@ -180,6 +180,7 @@
180 180 __REQ_ORDERED_COLOR, /* is before or after barrier */
181 181 __REQ_RW_SYNC, /* request is sync (O_DIRECT) */
182 182 __REQ_ALLOCED, /* request came from our alloc pool */
  183 + __REQ_RW_META, /* metadata io request */
183 184 __REQ_NR_BITS, /* stops here */
184 185 };
185 186  
... ... @@ -200,6 +201,7 @@
200 201 #define REQ_ORDERED_COLOR (1 << __REQ_ORDERED_COLOR)
201 202 #define REQ_RW_SYNC (1 << __REQ_RW_SYNC)
202 203 #define REQ_ALLOCED (1 << __REQ_ALLOCED)
  204 +#define REQ_RW_META (1 << __REQ_RW_META)
203 205  
204 206 #define BLK_MAX_CDB 16
205 207  
... ... @@ -543,6 +545,7 @@
543 545 * We regard a request as sync, if it's a READ or a SYNC write.
544 546 */
545 547 #define rq_is_sync(rq) (rq_data_dir((rq)) == READ || (rq)->cmd_flags & REQ_RW_SYNC)
  548 +#define rq_is_meta(rq) ((rq)->cmd_flags & REQ_RW_META)
546 549  
547 550 static inline int blk_queue_full(struct request_queue *q, int rw)
548 551 {
... ... @@ -80,6 +80,7 @@
80 80 #define READA 2 /* read-ahead - don't block if no resources */
81 81 #define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */
82 82 #define READ_SYNC (READ | (1 << BIO_RW_SYNC))
  83 +#define READ_META (READ | (1 << BIO_RW_META))
83 84 #define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC))
84 85 #define WRITE_BARRIER ((1 << BIO_RW) | (1 << BIO_RW_BARRIER))
85 86