From: Joe Thornber <thornber@redhat.com>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: dm-devel@redhat.com
Subject: Re: [PATCH] dm-space-map-disk: improve bit testing
Date: Tue, 16 Aug 2011 11:08:55 +0100 [thread overview]
Message-ID: <20110816100855.GD4284@ubuntu> (raw)
In-Reply-To: <Pine.LNX.4.64.1108151450370.18170@hs20-bc2-1.build.redhat.com>
On Mon, Aug 15, 2011 at 02:52:14PM -0400, Mikulas Patocka wrote:
> dm-space-map-disk: improve bit testing
Very nice, thanks. btw, you can get rid of WORD_MASK_LOW too:
diff --git a/drivers/md/persistent-data/dm-space-map-disk.c b/drivers/md/persistent-data/dm-space-map-disk.c
index 8d2c4c2..fbfa6f3 100644
--- a/drivers/md/persistent-data/dm-space-map-disk.c
+++ b/drivers/md/persistent-data/dm-space-map-disk.c
@@ -69,7 +69,6 @@ void *dm_bitmap_data(struct dm_block *b)
return dm_block_data(b) + sizeof(struct disk_bitmap_header);
}
-#define WORD_MASK_LOW 0x5555555555555555ULL
#define WORD_MASK_HIGH 0xAAAAAAAAAAAAAAAAULL
static unsigned bitmap_word_used(void *addr, unsigned b)
@@ -78,7 +77,7 @@ static unsigned bitmap_word_used(void *addr, unsigned b)
__le64 *w_le = words_le + (b >> ENTRIES_SHIFT);
uint64_t bits = le64_to_cpu(*w_le);
- uint64_t mask = (bits - WORD_MASK_LOW) & WORD_MASK_HIGH;
+ uint64_t mask = (bits + WORD_MASK_HIGH + 1) & WORD_MASK_HIGH;
return !(~bits & mask);
}
prev parent reply other threads:[~2011-08-16 10:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-15 18:52 [PATCH] dm-space-map-disk: improve bit testing Mikulas Patocka
2011-08-16 10:08 ` Joe Thornber [this message]
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=20110816100855.GD4284@ubuntu \
--to=thornber@redhat.com \
--cc=dm-devel@redhat.com \
--cc=mpatocka@redhat.com \
/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.