mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dongbo Cao <cdbdyx@163.com>
To: colyli@suse.de
Cc: kent.overstreet@gmail.com, linux-bcache@vger.kernel.org,
	linux-kernel@vger.kernel.org, Dongbo Cao <cdbdyx@163.com>
Subject: [PATCH] bug fix in function check_should_bypass
Date: Thu, 27 Sep 2018 16:27:49 +0800	[thread overview]
Message-ID: <20180927082749.2243-1-cdbdyx@163.com> (raw)

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



             reply	other threads:[~2018-09-27  8:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-27  8:27 Dongbo Cao [this message]
2018-09-27  8:33 ` Kent Overstreet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180927082749.2243-1-cdbdyx@163.com \
    --to=cdbdyx@163.com \
    --cc=colyli@suse.de \
    --cc=kent.overstreet@gmail.com \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®