On Thu, Mar 8, 2018 at 8:57 PM, Dr. David Alan Gilbert (git) <dgilb...@redhat.com> wrote: > From: "Dr. David Alan Gilbert" <dgilb...@redhat.com> > > Utility for testing the map when you already know the offset > in the RAMBlock. > > Signed-off-by: Dr. David Alan Gilbert <dgilb...@redhat.com> > Reviewed-by: Peter Xu <pet...@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lur...@redhat.com> > --- > migration/ram.c | 5 +++++ > migration/ram.h | 1 + > 2 files changed, 6 insertions(+) > > diff --git a/migration/ram.c b/migration/ram.c > index 3b6c077964..3d754422e8 100644 > --- a/migration/ram.c > +++ b/migration/ram.c > @@ -169,6 +169,11 @@ int ramblock_recv_bitmap_test(RAMBlock *rb, void > *host_addr) > rb->receivedmap); > } > > +bool ramblock_recv_bitmap_test_byte_offset(RAMBlock *rb, uint64_t > byte_offset) > +{ > + return test_bit(byte_offset >> TARGET_PAGE_BITS, rb->receivedmap); > +} > + > void ramblock_recv_bitmap_set(RAMBlock *rb, void *host_addr) > { > set_bit_atomic(ramblock_recv_bitmap_offset(host_addr, rb), > rb->receivedmap); > diff --git a/migration/ram.h b/migration/ram.h > index 53f0021c51..5030be110a 100644 > --- a/migration/ram.h > +++ b/migration/ram.h > @@ -60,6 +60,7 @@ int ram_postcopy_incoming_init(MigrationIncomingState *mis); > void ram_handle_compressed(void *host, uint8_t ch, uint64_t size); > > int ramblock_recv_bitmap_test(RAMBlock *rb, void *host_addr); > +bool ramblock_recv_bitmap_test_byte_offset(RAMBlock *rb, uint64_t > byte_offset); > void ramblock_recv_bitmap_set(RAMBlock *rb, void *host_addr); > void ramblock_recv_bitmap_set_range(RAMBlock *rb, void *host_addr, size_t > nr); > > -- > 2.14.3 > > -- Marc-André Lureau