All of lore.kernel.org
 help / color / mirror / Atom feed
From: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
To: Jens Axboe <axboe@kernel.dk>, LKML <linux-kernel@vger.kernel.org>
Cc: <raghavendra.kt@linux.vnet.ibm.com>
Subject: [PATCH] block:Remove extra condition in end of disk check
Date: Sun, 23 Jun 2013 22:47:11 +0530	[thread overview]
Message-ID: <20130623171711.7127.16248.sendpatchset@codeblue.in.ibm.com> (raw)

From: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>

Since #sector is always positive the reduced condition check
encompasses maxsector < nr_sectors check.

Signed-off-by: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
---
An userspace program looping with:
maxsector - 0-9999
nr_sector - 0-999
sector - 0-999 gave 6.4% improvement with new condition though I agree that
it is not the best way to test it perhaps :)

diff --git a/block/blk-core.c b/block/blk-core.c
index 33c33bc..4a78583 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1656,7 +1656,7 @@ static inline int bio_check_eod(struct bio *bio, unsigned int nr_sectors)
 	if (maxsector) {
 		sector_t sector = bio->bi_sector;
 
-		if (maxsector < nr_sectors || maxsector - nr_sectors < sector) {
+		if (maxsector - nr_sectors < sector) {
 			/*
 			 * This may well happen - the kernel calls bread()
 			 * without checking the size of the device, e.g., when


             reply	other threads:[~2013-06-23 17:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-23 17:17 Raghavendra K T [this message]
2013-06-24 13:50 ` [PATCH] block:Remove extra condition in end of disk check Raghavendra K T
2013-06-24 22:51   ` Tejun Heo
2013-06-25  5:10     ` Raghavendra K T

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=20130623171711.7127.16248.sendpatchset@codeblue.in.ibm.com \
    --to=raghavendra.kt@linux.vnet.ibm.com \
    --cc=axboe@kernel.dk \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.