aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJohn Levon <john.levon@nutanix.com>2022-05-27 12:54:26 +0100
committerGitHub <noreply@github.com>2022-05-27 12:54:26 +0100
commit065c33e7dc7bbd1d5964a5a3af173a69ad3ee931 (patch)
treed629dc61d6ac7f966ab3983951121f307999f9c5 /lib
parent54b7ef99497b2a4aa703a33342b54c76a709b0fe (diff)
downloadlibvfio-user-065c33e7dc7bbd1d5964a5a3af173a69ad3ee931.zip
libvfio-user-065c33e7dc7bbd1d5964a5a3af173a69ad3ee931.tar.gz
libvfio-user-065c33e7dc7bbd1d5964a5a3af173a69ad3ee931.tar.bz2
remove refcnt from region (#673)
The reference count is unused, and not atomically handled, remove it. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/dma.c2
-rw-r--r--lib/dma.h3
2 files changed, 0 insertions, 5 deletions
diff --git a/lib/dma.c b/lib/dma.c
index 2ba331f..2719639 100644
--- a/lib/dma.c
+++ b/lib/dma.c
@@ -172,8 +172,6 @@ MOCK_DEFINE(dma_controller_remove_region)(dma_controller_t *dma,
dma->vfu_ctx->in_cb = CB_NONE;
}
- assert(region->refcnt == 0);
-
if (region->info.vaddr != NULL) {
dma_controller_unmap_region(dma, region);
} else {
diff --git a/lib/dma.h b/lib/dma.h
index afd7345..6e31f15 100644
--- a/lib/dma.h
+++ b/lib/dma.h
@@ -96,7 +96,6 @@ typedef struct {
vfu_dma_info_t info;
int fd; // File descriptor to mmap
off_t offset; // File offset
- int refcnt; // Number of users of this region
char *dirty_bitmap; // Dirty page bitmap
} dma_memory_region_t;
@@ -255,7 +254,6 @@ dma_map_sg(dma_controller_t *dma, dma_sg_t *sg, struct iovec *iov,
sg->dma_addr + sg->offset + sg->length);
iov->iov_base = region->info.vaddr + sg->offset;
iov->iov_len = sg->length;
- region->refcnt++;
sg++;
iov++;
@@ -326,7 +324,6 @@ dma_unmap_sg(dma_controller_t *dma, dma_sg_t *sg, int cnt)
vfu_log(dma->vfu_ctx, LOG_DEBUG, "unmap %p-%p",
sg->dma_addr + sg->offset,
sg->dma_addr + sg->offset + sg->length);
- r->refcnt--;
sg++;
} while (--cnt > 0);
}