lkml.org 
[lkml]   [2018]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] bug fix in function check_should_bypass
Date
bio->bi_iter.bi_sector is the sector index of current request, no need to be aligned.
instead, bio->bi_iter.bi_size should be aligned to block_bytes-1, not block_size-1.
and bio_sectors is the number of sectors of current request, also no need to be aligned, just remove it.

Signed-off-by: Dongbo Cao <cdbdyx@163.com>
---
drivers/md/bcache/request.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
index 13d3355a..fb3502da 100644
--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -398,8 +398,7 @@ static bool check_should_bypass(struct cached_dev *dc, struct bio *bio)
!(bio->bi_opf & REQ_PRIO))
goto skip;

- if (bio->bi_iter.bi_sector & (c->sb.block_size - 1) ||
- bio_sectors(bio) & (c->sb.block_size - 1)) {
+ if (bio->bi_iter.bi_size & (block_bytes(c) - 1)) {
pr_debug("skipping unaligned io");
goto skip;
}
--
2.17.1

\
 
 \ /
  Last update: 2018-09-27 10:28    [W:0.028 / U:0.744 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site