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:23 PM
Mikulas Patocka
 
Default dm-stripe: remove stripes_mask

dm-stripe: remove stripes_mask

The structure stripe_c contains a stripes_mask field. This field is
useless because it can be trivially calculated by subtracting one from
stripes. It is used only at one place. This patch removes it.

The patch also changes ffs(stripes) - 1 to __ffs(stripes).

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

---
drivers/md/dm-stripe.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

Index: linux-3.4.2-fast/drivers/md/dm-stripe.c
================================================== =================
--- linux-3.4.2-fast.orig/drivers/md/dm-stripe.c 2012-06-18 12:53:23.000000000 +0200
+++ linux-3.4.2-fast/drivers/md/dm-stripe.c 2012-06-18 12:54:10.000000000 +0200
@@ -26,7 +26,6 @@ struct stripe {
struct stripe_c {
uint32_t stripes;
int stripes_shift;
- sector_t stripes_mask;

/* The size of this target / num. stripes */
sector_t stripe_width;
@@ -158,10 +157,8 @@ static int stripe_ctr(struct dm_target *

if (stripes & (stripes - 1))
sc->stripes_shift = -1;
- else {
- sc->stripes_shift = ffs(stripes) - 1;
- sc->stripes_mask = ((sector_t) stripes) - 1;
- }
+ else
+ sc->stripes_shift = __ffs(stripes);

r = dm_set_target_max_io_len(ti, chunk_size);
if (r)
@@ -226,7 +223,7 @@ static void stripe_map_sector(struct str
if (sc->stripes_shift < 0)
*stripe = sector_div(chunk, sc->stripes);
else {
- *stripe = chunk & sc->stripes_mask;
+ *stripe = chunk & (sc->stripes - 1);
chunk >>= sc->stripes_shift;
}


--
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 01:27 PM.

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