Commit 1f6a1528 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] bitmap_snprintf() optimization

From: Joe Korty <joe.korty@ccur.com>

Now that bitmap_parse is part of bitmap.[ch], it is allowed to manipulate
bits directly as the other bitmap routines do.
parent 79cd789d
...@@ -220,7 +220,7 @@ EXPORT_SYMBOL(bitmap_snprintf); ...@@ -220,7 +220,7 @@ EXPORT_SYMBOL(bitmap_snprintf);
int bitmap_parse(const char __user *ubuf, unsigned int ubuflen, int bitmap_parse(const char __user *ubuf, unsigned int ubuflen,
unsigned long *maskp, int nmaskbits) unsigned long *maskp, int nmaskbits)
{ {
int i, c, old_c, totaldigits, ndigits, nchunks, nbits; int c, old_c, totaldigits, ndigits, nchunks, nbits;
u32 chunk; u32 chunk;
bitmap_clear(maskp, nmaskbits); bitmap_clear(maskp, nmaskbits);
...@@ -270,9 +270,7 @@ int bitmap_parse(const char __user *ubuf, unsigned int ubuflen, ...@@ -270,9 +270,7 @@ int bitmap_parse(const char __user *ubuf, unsigned int ubuflen,
continue; continue;
bitmap_shift_right(maskp, maskp, CHUNKSZ, nmaskbits); bitmap_shift_right(maskp, maskp, CHUNKSZ, nmaskbits);
for (i = 0; i < CHUNKSZ; i++) *maskp |= chunk;
if (chunk & (1 << i))
set_bit(i, maskp);
nchunks++; nchunks++;
nbits += (nchunks == 1) ? nbits_to_hold_value(chunk) : CHUNKSZ; nbits += (nchunks == 1) ? nbits_to_hold_value(chunk) : CHUNKSZ;
if (nbits > nmaskbits) if (nbits > nmaskbits)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment