aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColy Li <colyli@suse.de>2017-07-21 08:48:22 -0400
committerBob Peterson <rpeterso@redhat.com>2017-07-21 08:48:22 -0400
commite477b24b507998bc6568316a2e034025960d2404 (patch)
tree376f7b94c634610b998d2befbb20868aef6d8d3c
parente7cb550d79fba5876616ed33ccafafc4e2bd7e2e (diff)
gfs2: add flag REQ_PRIO for metadata I/O
When gfs2 does metadata I/O, only REQ_META is used as a metadata hint of the bio. But flag REQ_META is just a hint for block trace, not for block layer code to handle a bio as metadata request. For some of metadata I/Os of gfs2, A REQ_PRIO flag on the metadata bio would be very informative to block layer code. For example, if bcache is used as a I/O cache for gfs2, it will be possible for bcache code to get the hint and cache the pre-fetched metadata blocks on cache device. This behavior may be helpful to improve metadata I/O performance if the following requests hit the cache. Here are the locations in gfs2 code where a REQ_PRIO flag should be added, - All places where REQ_READAHEAD is used, gfs2 code uses this flag for metadata read ahead. - In gfs2_meta_rq() where the first metadata block is read in. - In gfs2_write_buf_to_page(), read in quota metadata blocks to have them up to date. These metadata blocks are probably to be accessed again in future, adding a REQ_PRIO flag may have bcache to keep such metadata in fast cache device. For system without a cache layer, REQ_PRIO can still provide hint to block layer to handle metadata requests more properly. Signed-off-by: Coly Li <colyli@suse.de> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
-rw-r--r--fs/gfs2/bmap.c5
-rw-r--r--fs/gfs2/dir.c4
-rw-r--r--fs/gfs2/meta_io.c6
-rw-r--r--fs/gfs2/quota.c2
4 files changed, 11 insertions, 6 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 9fa3aef9a5b3..fa3ea29f39cf 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -291,8 +291,9 @@ static void gfs2_metapath_ra(struct gfs2_glock *gl,
291 if (trylock_buffer(rabh)) { 291 if (trylock_buffer(rabh)) {
292 if (!buffer_uptodate(rabh)) { 292 if (!buffer_uptodate(rabh)) {
293 rabh->b_end_io = end_buffer_read_sync; 293 rabh->b_end_io = end_buffer_read_sync;
294 submit_bh(REQ_OP_READ, REQ_RAHEAD | REQ_META, 294 submit_bh(REQ_OP_READ,
295 rabh); 295 REQ_RAHEAD | REQ_META | REQ_PRIO,
296 rabh);
296 continue; 297 continue;
297 } 298 }
298 unlock_buffer(rabh); 299 unlock_buffer(rabh);
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index db427658ccd9..0741e4018f8c 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -1514,7 +1514,9 @@ static void gfs2_dir_readahead(struct inode *inode, unsigned hsize, u32 index,
1514 continue; 1514 continue;
1515 } 1515 }
1516 bh->b_end_io = end_buffer_read_sync; 1516 bh->b_end_io = end_buffer_read_sync;
1517 submit_bh(REQ_OP_READ, REQ_RAHEAD | REQ_META, bh); 1517 submit_bh(REQ_OP_READ,
1518 REQ_RAHEAD | REQ_META | REQ_PRIO,
1519 bh);
1518 continue; 1520 continue;
1519 } 1521 }
1520 brelse(bh); 1522 brelse(bh);
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index 4da7745c890a..61ef6c9be816 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -453,7 +453,7 @@ struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen)
453 if (buffer_uptodate(first_bh)) 453 if (buffer_uptodate(first_bh))
454 goto out; 454 goto out;
455 if (!buffer_locked(first_bh)) 455 if (!buffer_locked(first_bh))
456 ll_rw_block(REQ_OP_READ, REQ_META, 1, &first_bh); 456 ll_rw_block(REQ_OP_READ, REQ_META | REQ_PRIO, 1, &first_bh);
457 457
458 dblock++; 458 dblock++;
459 extlen--; 459 extlen--;
@@ -462,7 +462,9 @@ struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen)
462 bh = gfs2_getbuf(gl, dblock, CREATE); 462 bh = gfs2_getbuf(gl, dblock, CREATE);
463 463
464 if (!buffer_uptodate(bh) && !buffer_locked(bh)) 464 if (!buffer_uptodate(bh) && !buffer_locked(bh))
465 ll_rw_block(REQ_OP_READ, REQ_RAHEAD | REQ_META, 1, &bh); 465 ll_rw_block(REQ_OP_READ,
466 REQ_RAHEAD | REQ_META | REQ_PRIO,
467 1, &bh);
466 brelse(bh); 468 brelse(bh);
467 dblock++; 469 dblock++;
468 extlen--; 470 extlen--;
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index c2ca9566b764..739adf105d7f 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -730,7 +730,7 @@ static int gfs2_write_buf_to_page(struct gfs2_inode *ip, unsigned long index,
730 if (PageUptodate(page)) 730 if (PageUptodate(page))
731 set_buffer_uptodate(bh); 731 set_buffer_uptodate(bh);
732 if (!buffer_uptodate(bh)) { 732 if (!buffer_uptodate(bh)) {
733 ll_rw_block(REQ_OP_READ, REQ_META, 1, &bh); 733 ll_rw_block(REQ_OP_READ, REQ_META | REQ_PRIO, 1, &bh);
734 wait_on_buffer(bh); 734 wait_on_buffer(bh);
735 if (!buffer_uptodate(bh)) 735 if (!buffer_uptodate(bh))
736 goto unlock_out; 736 goto unlock_out;