FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Device-mapper Development

 
 
LinkBack Thread Tools
 
Old 06-18-2012, 01:19 PM
Mikulas Patocka
 
Default dm: optimize modulo max_io_len

Hi

This patch should be applied after
dm-support-non-power-of-two-target-max_io_len.patch. It optimizes a case
when max_io_len is a power of two.

Mikulas

---

dm: optimize modulo max_io_len

Change slow modulo operation to fast bitwise and when max_io_len is a
power of two.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

---
drivers/md/dm.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

Index: linux-3.4.2-fast/drivers/md/dm.c
================================================== =================
--- linux-3.4.2-fast.orig/drivers/md/dm.c 2012-06-18 11:40:17.000000000 +0200
+++ linux-3.4.2-fast/drivers/md/dm.c 2012-06-18 11:41:05.000000000 +0200
@@ -1004,7 +1004,11 @@ static sector_t max_io_len(sector_t sect
*/
if (ti->max_io_len) {
offset = dm_target_offset(ti, sector);
- max_len = ti->max_io_len - sector_div(offset, ti->max_io_len);
+ if (unlikely(ti->max_io_len & (ti->max_io_len - 1)))
+ max_len = sector_div(offset, ti->max_io_len);
+ else
+ max_len = offset & (ti->max_io_len - 1);
+ max_len = ti->max_io_len - max_len;

if (len > max_len)
len = max_len;

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 

Thread Tools




All times are GMT. The time now is 07:40 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org