lkml.org 
[lkml]   [2010]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] ida: fix up bitmap size calculation
On 09/02/2010 08:07 PM, Namhyung Kim wrote:
> Namhyung Kim <namhyung@gmail.com> writes:
>> Got it. :-) I'll prepare new patch with that comment, then.
>> Thank you for the explanation.
>
> How about this?

I'd prefer something with a bit more brevity. If this looks good, can
you please send it to trivial@kernel.org?

Thanks.

diff --git a/include/linux/idr.h b/include/linux/idr.h
index e968db7..1208528 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -117,9 +117,12 @@ void idr_init(struct idr *idp);
/*
* IDA - IDR based id allocator, use when translation from id to
* pointer isn't necessary.
+ *
+ * IDA_BITMAP_LONGS is calculated to be one less to accomodate
+ * ida_bitmap->nr_busy so that the whole struct fits in 128 bytes.
*/
#define IDA_CHUNK_SIZE 128 /* 128 bytes per chunk */
-#define IDA_BITMAP_LONGS (128 / sizeof(long) - 1)
+#define IDA_BITMAP_LONGS (IDA_CHUNK_SIZE / sizeof(long) - 1)
#define IDA_BITMAP_BITS (IDA_BITMAP_LONGS * sizeof(long) * 8)

struct ida_bitmap {

--
tejun


\
 
 \ /
  Last update: 2010-09-03 11:17    [W:0.091 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site