Re: [PATCH] ida: fix up bitmap size calculation

From: Tejun Heo
Date: Fri Sep 03 2010 - 05:14:16 EST


On 09/02/2010 08:07 PM, Namhyung Kim wrote:
> Namhyung Kim <namhyung@xxxxxxxxx> 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@xxxxxxxxxx?

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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/