Displaying 10 results from an estimated 10 matches for "bitmap_for".
2019 Jan 01
0
[PATCH nbdkit v2 1/4] common/bitmap: Add bitmap_next function and tests.
...file.am | 1 +
8 files changed, 279 insertions(+)
diff --git a/common/bitmap/bitmap.h b/common/bitmap/bitmap.h
index f943933..80fd5e4 100644
--- a/common/bitmap/bitmap.h
+++ b/common/bitmap/bitmap.h
@@ -165,4 +165,10 @@ bitmap_set (const struct bitmap *bm, uint64_t offset, unsigned v)
#define bitmap_for(bm, /* uint64_t */ blknum) \
for ((blknum) = 0; (blknum) < (bm)->size * (bm)->ibpb; ++(blknum))
+/* Find the next non-zero block in the bitmap, starting at ?blk?.
+ * Returns -1 if the bitmap is all zeroes from blk to the end of the
+ * bitmap.
+ */
+extern i...
2018 Dec 03
3
[PATCH nbdkit v3] common: Move shared bitmap code to a common library.
v2:
https://www.redhat.com/archives/libguestfs/2018-December/msg00039.html
v2 -> v3:
- Fix all the issues raised in Eric's review.
- Precompute some numbers to make the calculations easier.
- Calculations now use bitshifts and masks in preference to division
and modulo.
- Clear existing bits before setting (which fixes a bug in the cache
filter).
Rich.
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.
2018 Dec 03
1
Re: [PATCH nbdkit v2] common: Move shared bitmap code to a common library.
...orks with virtual disk offset in bytes. */
> +static inline void
> +bitmap_set (const struct bitmap *bm, uint64_t offset, unsigned v)
> +{
> + return bitmap_set_blk (bm, offset / bm->blksize, v);
> +}
> +
> +/* Iterate over blocks represented in the bitmap. */
> +#define bitmap_for(bm, /* uint64_t */ blknum) \
> + for (blknum = 0; blknum < (bm)->size * (8 / (bm)->bpb); ++blknum)
For safety, you should probably:
for ((blknum) = 0; (blknum) < (bm)->size * (8 / (bm->bpb); ++(blknum))
--
Eric Blake, Principal Software Engineer...
2018 Dec 01
0
[PATCH nbdkit] common: Move shared bitmap code to a common library.
...lt;< blk_bit;
+}
+
+/* As above bit works with virtual disk offset in bytes. */
+static inline void
+bitmap_set (const struct bitmap *bm, uint64_t offset, unsigned v)
+{
+ return bitmap_set_blk (bm, offset / bm->blksize, v);
+}
+
+/* Iterate over blocks represented in the bitmap. */
+#define bitmap_for(bm, /* uint64_t */ blknum) \
+ for (blknum = 0; blknum < (bm)->size * (8 / (bm)->bpb); ++blknum)
+
+#endif /* NBDKIT_BITMAP_H */
diff --git a/configure.ac b/configure.ac
index 39a7e6d..a3e4457 100644
--- a/configure.ac
+++ b/configure.ac
@@ -779,6 +779,7 @@ AC_CO...
2018 Dec 02
0
[PATCH nbdkit v2] common: Move shared bitmap code to a common library.
...lt;< blk_bit;
+}
+
+/* As above bit works with virtual disk offset in bytes. */
+static inline void
+bitmap_set (const struct bitmap *bm, uint64_t offset, unsigned v)
+{
+ return bitmap_set_blk (bm, offset / bm->blksize, v);
+}
+
+/* Iterate over blocks represented in the bitmap. */
+#define bitmap_for(bm, /* uint64_t */ blknum) \
+ for (blknum = 0; blknum < (bm)->size * (8 / (bm)->bpb); ++blknum)
+
+#endif /* NBDKIT_BITMAP_H */
diff --git a/configure.ac b/configure.ac
index 39a7e6d..a3e4457 100644
--- a/configure.ac
+++ b/configure.ac
@@ -779,6 +779,7 @@ AC_CO...
2018 Dec 03
0
[PATCH nbdkit v3] common: Move shared bitmap code to a common library.
...lt;< blk_bit;
+}
+
+/* As above bit works with virtual disk offset in bytes. */
+static inline void
+bitmap_set (const struct bitmap *bm, uint64_t offset, unsigned v)
+{
+ return bitmap_set_blk (bm, offset / bm->blksize, v);
+}
+
+/* Iterate over blocks represented in the bitmap. */
+#define bitmap_for(bm, /* uint64_t */ blknum) \
+ for ((blknum) = 0; (blknum) < (bm)->size * (8 / (bm)->bpb); ++(blknum))
+
+#endif /* NBDKIT_BITMAP_H */
diff --git a/common/bitmap/bitmap.c b/common/bitmap/bitmap.c
new file mode 100644
index 0000000..fb5dbe7
--- /dev/null
+++ b/com...
2018 Dec 01
2
[PATCH nbdkit] common: Move shared bitmap code to a common library.
I have some patches I'm working on to fix the cache filter.
However this is a prelude. It should be simply pure refactoring.
All tests pass still.
Rich.
2018 Dec 28
12
[PATCH nbdkit 0/9] cache: Implement cache-max-size and method of reclaiming space from the cache.
This patch series enhances the cache filter in a few ways, primarily
adding a "cache-on-read" feature (similar to qemu's copyonread); and
adding the ability to limit the cache size and the antecedent of that
which is having a method to reclaim cache blocks.
As the cache is stored as a sparse temporary file, reclaiming cache
blocks simply means punching holes in the temporary file.
2019 Jan 01
7
[PATCH nbdkit v2 0/4] cache: Implement cache-max-size etc.
These are essentially identical to what was previously posted as
patches 6/9 through 9/9 here:
https://www.redhat.com/archives/libguestfs/2018-December/msg00145.html
except that it has been rebased onto the current git master and
retested thoroughly.
Rich.