linux-bcache.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bug fix in function check_should_bypass
@ 2018-09-27  8:27 Dongbo Cao
  2018-09-27  8:33 ` Kent Overstreet
  0 siblings, 1 reply; 2+ messages in thread
From: Dongbo Cao @ 2018-09-27  8:27 UTC (permalink / raw)
  To: colyli; +Cc: kent.overstreet, linux-bcache, linux-kernel, Dongbo Cao

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-09-27  8:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-27  8:27 [PATCH] bug fix in function check_should_bypass Dongbo Cao
2018-09-27  8:33 ` Kent Overstreet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).