Displaying 9 results from an estimated 9 matches for "bm_bit".
Did you mean:
1mbit
2018 Dec 01
0
[PATCH nbdkit] common: Move shared bitmap code to a common library.
...cate: %m");
@@ -246,36 +223,6 @@ cache_prepare (struct nbdkit_next_ops *next_ops, void *nxdata,
return 0;
}
-/* Return true if the block is allocated. Consults the bitmap. */
-static enum bm_entry
-blk_get_bitmap_entry (uint64_t blknum)
-{
- uint64_t bm_offset = blknum / 4;
- uint64_t bm_bit = 2 * (blknum % 4);
-
- if (bm_offset >= bm_size) {
- nbdkit_debug ("blk_get_bitmap_entry: block number is out of range");
- return BLOCK_NOT_CACHED;
- }
-
- return (bitmap[bm_offset] & (3 << bm_bit)) >> bm_bit;
-}
-
-/* Update cache state of a block. */
-stati...
2018 Dec 02
0
[PATCH nbdkit v2] common: Move shared bitmap code to a common library.
...cate: %m");
@@ -246,36 +225,6 @@ cache_prepare (struct nbdkit_next_ops *next_ops, void *nxdata,
return 0;
}
-/* Return true if the block is allocated. Consults the bitmap. */
-static enum bm_entry
-blk_get_bitmap_entry (uint64_t blknum)
-{
- uint64_t bm_offset = blknum / 4;
- uint64_t bm_bit = 2 * (blknum % 4);
-
- if (bm_offset >= bm_size) {
- nbdkit_debug ("blk_get_bitmap_entry: block number is out of range");
- return BLOCK_NOT_CACHED;
- }
-
- return (bitmap[bm_offset] & (3 << bm_bit)) >> bm_bit;
-}
-
-/* Update cache state of a block. */
-stati...
2018 Dec 03
0
[PATCH nbdkit v3] common: Move shared bitmap code to a common library.
...cate: %m");
@@ -246,36 +225,6 @@ cache_prepare (struct nbdkit_next_ops *next_ops, void *nxdata,
return 0;
}
-/* Return true if the block is allocated. Consults the bitmap. */
-static enum bm_entry
-blk_get_bitmap_entry (uint64_t blknum)
-{
- uint64_t bm_offset = blknum / 4;
- uint64_t bm_bit = 2 * (blknum % 4);
-
- if (bm_offset >= bm_size) {
- nbdkit_debug ("blk_get_bitmap_entry: block number is out of range");
- return BLOCK_NOT_CACHED;
- }
-
- return (bitmap[bm_offset] & (3 << bm_bit)) >> bm_bit;
-}
-
-/* Update cache state of a block. */
-stati...
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 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 Jan 21
2
Re: [PATCH nbdkit] filters: Add copy-on-write filter.
...turn size;
}
@@ -200,6 +228,36 @@ cow_can_flush (struct nbdkit_next_ops *next_ops, void *nxdata, void *handle)
return 1;
}
+/* Return true if the block is allocated. Consults the bitmap. */
+static bool
+blk_is_allocated (uint64_t blknum)
+{
+ uint64_t bm_offset = blknum / 8;
+ uint64_t bm_bit = blknum % 8;
+
+ if (bm_offset >= bm_size) {
+ nbdkit_debug ("blk_is_allocated: block number is out of range");
+ return false;
+ }
+
+ return bitmap[bm_offset] & (1 << bm_bit);
+}
+
+/* Mark a block as allocated. */
+static void
+blk_set_allocated (uint64_t blknum)...
2018 Jan 22
1
[PATCH nbdkit] filters: Add caching filter.
This adds a cache filter, which works like the COW filter in reverse.
For realistic use it needs a bit more work, especially to add limits
on the size of the cache, a more sensible cache replacement policy,
and perhaps some kind of background worker to write dirty blocks out.
Rich.
2018 Jan 20
4
[PATCH nbdkit] filters: Add copy-on-write filter.
Eric, you'll probably find the design "interesting" ...
It does work, for me at least.
Rich.