lkml.org 
[lkml]   [2013]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH] block:Remove extra condition in end of disk check
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


\
 
 \ /
  Last update: 2013-06-23 19:41    [W:0.070 / U:0.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site