Displaying 20 results from an estimated 58 matches for "bitmap_set".
2012 Jan 20
2
[PATCH] xen-blkfront: use bitmap_set() and bitmap_clear()
Use bitmap_set and bitmap_clear rather than modifying individual bits
in a memory region.
Signed-off-by: Akinobu Mita <akinobu.mita at gmail.com>
Cc: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk at oracle.com>
Cc: xen-devel at lists.xensource.co...
2012 Jan 20
2
[PATCH] xen-blkfront: use bitmap_set() and bitmap_clear()
Use bitmap_set and bitmap_clear rather than modifying individual bits
in a memory region.
Signed-off-by: Akinobu Mita <akinobu.mita at gmail.com>
Cc: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk at oracle.com>
Cc: xen-devel at lists.xensource.co...
2016 Jul 27
4
[PATCH v2 repost 6/7] mm: add the related functions to get free page info
...ne->free_area[order].free_list[t]) {
> + pfn = page_to_pfn(list_entry(curr, struct page, lru));
> + if (pfn >= start_pfn && pfn <= end_pfn) {
> + page_num = 1UL << order;
> + if (pfn + page_num > end_pfn)
> + page_num = end_pfn - pfn;
> + bitmap_set(bitmap, pfn - start_pfn, page_num);
> + }
> + }
> + }
Nit: The 'page_num' nomenclature really confused me here. It is the
number of bits being set in the bitmap. Seems like calling it nr_pages
or num_pages would be more appropriate.
Isn't this bitmap out of date by the...
2016 Jul 27
4
[PATCH v2 repost 6/7] mm: add the related functions to get free page info
...ne->free_area[order].free_list[t]) {
> + pfn = page_to_pfn(list_entry(curr, struct page, lru));
> + if (pfn >= start_pfn && pfn <= end_pfn) {
> + page_num = 1UL << order;
> + if (pfn + page_num > end_pfn)
> + page_num = end_pfn - pfn;
> + bitmap_set(bitmap, pfn - start_pfn, page_num);
> + }
> + }
> + }
Nit: The 'page_num' nomenclature really confused me here. It is the
number of bits being set in the bitmap. Seems like calling it nr_pages
or num_pages would be more appropriate.
Isn't this bitmap out of date by the...
2009 Nov 03
1
hivex.c: unchecked calloc
Hi Rich,
There's an unchecked calloc in hivex.c's hive_open:
h->bitmap = calloc (1 + h->size / 32, 1);
...
This subsequent deref could cause a segfault:
BITMAP_SET (h->bitmap, blkoff);
2016 Jul 27
2
[PATCH v2 repost 6/7] mm: add the related functions to get free page info
...> + pfn = page_to_pfn(list_entry(curr, struct page, lru));
>>> + if (pfn >= start_pfn && pfn <= end_pfn) {
>>> + page_num = 1UL << order;
>>> + if (pfn + page_num > end_pfn)
>>> + page_num = end_pfn - pfn;
>>> + bitmap_set(bitmap, pfn - start_pfn, page_num);
>>> + }
>>> + }
>>> + }
>>
>> Nit: The 'page_num' nomenclature really confused me here. It is the
>> number of bits being set in the bitmap. Seems like calling it nr_pages
>> or num_pages would be m...
2016 Jul 27
2
[PATCH v2 repost 6/7] mm: add the related functions to get free page info
...> + pfn = page_to_pfn(list_entry(curr, struct page, lru));
>>> + if (pfn >= start_pfn && pfn <= end_pfn) {
>>> + page_num = 1UL << order;
>>> + if (pfn + page_num > end_pfn)
>>> + page_num = end_pfn - pfn;
>>> + bitmap_set(bitmap, pfn - start_pfn, page_num);
>>> + }
>>> + }
>>> + }
>>
>> Nit: The 'page_num' nomenclature really confused me here. It is the
>> number of bits being set in the bitmap. Seems like calling it nr_pages
>> or num_pages would be m...
2018 Dec 03
1
Re: [PATCH nbdkit v2] common: Move shared bitmap code to a common library.
...;< and >> instead of / and % aid the compiler, since we know
we have powers of 2 based on initialization, but the compiler might not
see it locally?
> +/* Set the bit(s) associated with the given block.
> + * If out of range, it is ignored.
> + */
> +static inline void
> +bitmap_set_blk (const struct bitmap *bm, uint64_t blk, unsigned v)
> +{
> + uint64_t blk_offset = blk / (8 / bm->bpb);
> + unsigned blk_bit = bm->bpb * (blk % (8 / bm->bpb));
> +
> + if (blk_offset >= bm->size) {
> + nbdkit_debug ("bitmap_set: block number is out of...
2018 Dec 02
2
[PATCH nbdkit v2] common: Move shared bitmap code to a common library.
This is exactly the same as v1:
https://www.redhat.com/archives/libguestfs/2018-December/msg00004.html
except that it now frees the bitmap on unload (which the old code did
not - there was always a memory leak).
Rich.
2011 Aug 10
1
[PATCH] Report last-modified time of hive root and nodes
...32 bits of the file
+ * (because blocks are 4-byte aligned). We found that the average
+ * block size in a registry file is ~50 bytes. So roughly 1 in 12
+ * bits in the bitmap will be set, making it likely a more efficient
+ * structure than a hash table.
+ */
+ char *bitmap;
+#define BITMAP_SET(bitmap,off) (bitmap[(off)>>5] |= 1 << (((off)>>2)&7))
+#define BITMAP_CLR(bitmap,off) (bitmap[(off)>>5] &= ~ (1 << (((off)>>2)&7)))
+#define BITMAP_TST(bitmap,off) (bitmap[(off)>>5] & (1 << (((off)>>2)&7)))
+#define IS_VALID_...
2016 Jul 27
0
[PATCH v2 repost 6/7] mm: add the related functions to get free page info
...ist[t]) {
> > + pfn = page_to_pfn(list_entry(curr, struct page, lru));
> > + if (pfn >= start_pfn && pfn <= end_pfn) {
> > + page_num = 1UL << order;
> > + if (pfn + page_num > end_pfn)
> > + page_num = end_pfn - pfn;
> > + bitmap_set(bitmap, pfn - start_pfn, page_num);
> > + }
> > + }
> > + }
>
> Nit: The 'page_num' nomenclature really confused me here. It is the
> number of bits being set in the bitmap. Seems like calling it nr_pages
> or num_pages would be more appropriate.
>
&...
2016 Jul 27
0
[PATCH v2 repost 6/7] mm: add the related functions to get free page info
...+ list_for_each(curr, &zone->free_area[order].free_list[t]) {
+ pfn = page_to_pfn(list_entry(curr, struct page, lru));
+ if (pfn >= start_pfn && pfn <= end_pfn) {
+ page_num = 1UL << order;
+ if (pfn + page_num > end_pfn)
+ page_num = end_pfn - pfn;
+ bitmap_set(bitmap, pfn - start_pfn, page_num);
+ }
+ }
+ }
+
+ spin_unlock_irqrestore(&zone->lock, flags);
+}
+
+int get_free_pages(unsigned long start_pfn, unsigned long end_pfn,
+ unsigned long *bitmap, unsigned long len)
+{
+ struct zone *zone;
+ int ret = 0;
+
+ if (bitmap == NULL || start_pfn...
2016 Jul 28
0
[PATCH v2 repost 6/7] mm: add the related functions to get free page info
...ist[t]) {
> > + pfn = page_to_pfn(list_entry(curr, struct page, lru));
> > + if (pfn >= start_pfn && pfn <= end_pfn) {
> > + page_num = 1UL << order;
> > + if (pfn + page_num > end_pfn)
> > + page_num = end_pfn - pfn;
> > + bitmap_set(bitmap, pfn - start_pfn,
> page_num);
> > + }
> > + }
> > + }
>
> Nit: The 'page_num' nomenclature really confused me here. It is the
> number of bits being set in the bitmap. Seems like calling it nr_pages or
> num_pages would be more appropriate.
&g...
2016 Jul 28
0
[PATCH v2 repost 6/7] mm: add the related functions to get free page info
...n(list_entry(curr, struct page, lru));
> >>> + if (pfn >= start_pfn && pfn <= end_pfn) {
> >>> + page_num = 1UL << order;
> >>> + if (pfn + page_num > end_pfn)
> >>> + page_num = end_pfn - pfn;
> >>> + bitmap_set(bitmap, pfn - start_pfn,
> page_num);
> >>> + }
> >>> + }
> >>> + }
> >>
> >> Nit: The 'page_num' nomenclature really confused me here. It is the
> >> number of bits being set in the bitmap. Seems like calling it
> &...
2016 Jul 27
0
[PATCH v2 repost 6/7] mm: add the related functions to get free page info
...n(list_entry(curr, struct page, lru));
> >>> + if (pfn >= start_pfn && pfn <= end_pfn) {
> >>> + page_num = 1UL << order;
> >>> + if (pfn + page_num > end_pfn)
> >>> + page_num = end_pfn - pfn;
> >>> + bitmap_set(bitmap, pfn - start_pfn, page_num);
> >>> + }
> >>> + }
> >>> + }
> >>
> >> Nit: The 'page_num' nomenclature really confused me here. It is the
> >> number of bits being set in the bitmap. Seems like calling it nr_pages
&g...
2019 Jan 01
3
[PATCH nbdkit] include: Annotate function parameters with attribute((nonnull)).
Should we use attribute((nonnull)) at all? There's a very interesting
history of this in libvirt -- try looking at commit eefb881 plus the
commits referencing eefb881 -- but it does seem to work for me using
recent GCC and Clang.
I only did a few functions because annotating them gets old quickly...
Rich.
2016 Jul 27
1
[PATCH v2 repost 6/7] mm: add the related functions to get free page info
...ne->free_area[order].free_list[t]) {
> + pfn = page_to_pfn(list_entry(curr, struct page, lru));
> + if (pfn >= start_pfn && pfn <= end_pfn) {
> + page_num = 1UL << order;
> + if (pfn + page_num > end_pfn)
> + page_num = end_pfn - pfn;
> + bitmap_set(bitmap, pfn - start_pfn, page_num);
> + }
> + }
> + }
> +
> + spin_unlock_irqrestore(&zone->lock, flags);
> +}
> +
> +int get_free_pages(unsigned long start_pfn, unsigned long end_pfn,
> + unsigned long *bitmap, unsigned long len)
> +{
> + struct zone *zo...
2016 Jul 27
1
[PATCH v2 repost 6/7] mm: add the related functions to get free page info
...ne->free_area[order].free_list[t]) {
> + pfn = page_to_pfn(list_entry(curr, struct page, lru));
> + if (pfn >= start_pfn && pfn <= end_pfn) {
> + page_num = 1UL << order;
> + if (pfn + page_num > end_pfn)
> + page_num = end_pfn - pfn;
> + bitmap_set(bitmap, pfn - start_pfn, page_num);
> + }
> + }
> + }
> +
> + spin_unlock_irqrestore(&zone->lock, flags);
> +}
> +
> +int get_free_pages(unsigned long start_pfn, unsigned long end_pfn,
> + unsigned long *bitmap, unsigned long len)
> +{
> + struct zone *zo...
2018 Dec 01
0
[PATCH nbdkit] common: Move shared bitmap code to a common library.
...in bytes. */
+static inline unsigned
+bitmap_get (const struct bitmap *bm, uint64_t offset, unsigned default_)
+{
+ return bitmap_get_blk (bm, offset / bm->blksize, default_);
+}
+
+/* Set the bit(s) associated with the given block.
+ * If out of range, it is ignored.
+ */
+static inline void
+bitmap_set_blk (const struct bitmap *bm, uint64_t blk, unsigned v)
+{
+ uint64_t blk_offset = blk / (8 / bm->bpb);
+ unsigned blk_bit = bm->bpb * (blk % (8 / bm->bpb));
+
+ if (blk_offset >= bm->size) {
+ nbdkit_debug ("bitmap_set: block number is out of range");
+ return;
+...
2018 Dec 02
0
[PATCH nbdkit v2] common: Move shared bitmap code to a common library.
...in bytes. */
+static inline unsigned
+bitmap_get (const struct bitmap *bm, uint64_t offset, unsigned default_)
+{
+ return bitmap_get_blk (bm, offset / bm->blksize, default_);
+}
+
+/* Set the bit(s) associated with the given block.
+ * If out of range, it is ignored.
+ */
+static inline void
+bitmap_set_blk (const struct bitmap *bm, uint64_t blk, unsigned v)
+{
+ uint64_t blk_offset = blk / (8 / bm->bpb);
+ unsigned blk_bit = bm->bpb * (blk % (8 / bm->bpb));
+
+ if (blk_offset >= bm->size) {
+ nbdkit_debug ("bitmap_set: block number is out of range");
+ return;
+...