1. call blk_flush_plug when cache hit as the address of the subsequent
 bio is no longer contiguous with the previous bio;
2. skip cond_resched when ioprio class is rt;

Signed-off-by: LongPing Wei <weilongp...@oppo.com>
---
 drivers/md/dm-bufio.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
index 9c8ed65cd87e..ec8392fbcf5d 100644
--- a/drivers/md/dm-bufio.c
+++ b/drivers/md/dm-bufio.c
@@ -1981,6 +1981,7 @@ static void __dm_bufio_prefetch(struct dm_bufio_client *c,
                        unsigned short ioprio)
 {
        struct blk_plug plug;
+       unsigned short ioprio_class = IOPRIO_PRIO_CLASS(ioprio);
 
        LIST_HEAD(write_list);
 
@@ -1997,6 +1998,7 @@ static void __dm_bufio_prefetch(struct dm_bufio_client *c,
                if (b) {
                        /* already in cache */
                        cache_put_and_wake(c, b);
+                       blk_flush_plug(&plug, false);
                        continue;
                }
 
@@ -2017,7 +2019,8 @@ static void __dm_bufio_prefetch(struct dm_bufio_client *c,
                                submit_io(b, REQ_OP_READ, ioprio, read_endio);
                        dm_bufio_release(b);
 
-                       cond_resched();
+                       if (ioprio_class != IOPRIO_CLASS_RT)
+                               cond_resched();
 
                        if (!n_blocks)
                                goto flush_plug;
-- 
2.34.1


Reply via email to