diff --git a/exec.c b/exec.c
index 117c9a8..f8de928 100644
--- a/exec.c
+++ b/exec.c
@@ -1812,38 +1812,9 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t length)
 }
 #endif /* !_WIN32 */
 
-int qemu_get_ram_fd(ram_addr_t addr)
+void *qemu_get_ram_block_host_ptr(RAMBlock *ram_block)
 {
-    RAMBlock *block;
-    int fd;
-
-    rcu_read_lock();
-    block = qemu_get_ram_block(addr);
-    fd = block->fd;
-    rcu_read_unlock();
-    return fd;
-}
-
-void qemu_set_ram_fd(ram_addr_t addr, int fd)
-{
-    RAMBlock *block;
-
-    rcu_read_lock();
-    block = qemu_get_ram_block(addr);
-    block->fd = fd;
-    rcu_read_unlock();
-}
-
-void *qemu_get_ram_block_host_ptr(ram_addr_t addr)
-{
-    RAMBlock *block;
-    void *ptr;
-
-    rcu_read_lock();
-    block = qemu_get_ram_block(addr);
-    ptr = ramblock_ptr(block, 0);
-    rcu_read_unlock();
-    return ptr;
+    return ramblock_ptr(ram_block, 0);
 }
 
 /* Return a host pointer to ram allocated with qemu_ram_alloc.
diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index e40f23b..1e930fa 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -533,7 +533,9 @@ static void process_msg_shmem(IVShmemState *s, int fd, Error **errp)
     }
     memory_region_init_ram_ptr(&s->server_bar2, OBJECT(s),
                                "ivshmem.bar2", size, ptr);
-    qemu_set_ram_fd(memory_region_get_ram_addr(&s->server_bar2), fd);
+    assert(s->server_bar2.ram_block);
+    s->server_bar2.ram_block->fd = fd;
+
     s->ivshmem_bar2 = &s->server_bar2;
 }
 
@@ -939,8 +941,8 @@ static void ivshmem_exit(PCIDevice *dev)
                 error_report("Failed to munmap shared memory %s",
                              strerror(errno));
             }
-
-            fd = qemu_get_ram_fd(memory_region_get_ram_addr(s->ivshmem_bar2));
+            assert(s->ivshmem_bar2->ram_block);
+            fd = s->ivshmem_bar2->ram_block->fd;
             close(fd);
         }
 
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 5914e85..5082e04 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -248,17 +248,18 @@ static int vhost_user_set_mem_table(struct vhost_dev *dev,
     for (i = 0; i < dev->mem->nregions; ++i) {
         struct vhost_memory_region *reg = dev->mem->regions + i;
         ram_addr_t ram_addr;
+        MemoryRegion *mr;
 
         assert((uintptr_t)reg->userspace_addr == reg->userspace_addr);
-        qemu_ram_addr_from_host((void *)(uintptr_t)reg->userspace_addr,
+        mr = qemu_ram_addr_from_host((void *)(uintptr_t)reg->userspace_addr,
                                 &ram_addr);
-        fd = qemu_get_ram_fd(ram_addr);
+        fd = mr->ram_block->fd;
         if (fd > 0) {
             msg.payload.memory.regions[fd_num].userspace_addr = reg->userspace_addr;
             msg.payload.memory.regions[fd_num].memory_size  = reg->memory_size;
             msg.payload.memory.regions[fd_num].guest_phys_addr = reg->guest_phys_addr;
             msg.payload.memory.regions[fd_num].mmap_offset = reg->userspace_addr -
-                (uintptr_t) qemu_get_ram_block_host_ptr(ram_addr);
+              (uintptr_t) qemu_get_ram_block_host_ptr(mr->ram_block);
             assert(fd_num < VHOST_MEMORY_MAX_NREGIONS);
             fds[fd_num++] = fd;
         }
@@ -622,11 +623,13 @@ static bool vhost_user_can_merge(struct vhost_dev *dev,
 
     mr = qemu_ram_addr_from_host((void *)(uintptr_t)start1, &ram_addr);
     assert(mr);
-    mfd = qemu_get_ram_fd(ram_addr);
+    assert(mr->ram_block);
+    mfd = mr->ram_block->fd;
 
     mr = qemu_ram_addr_from_host((void *)(uintptr_t)start2, &ram_addr);
     assert(mr);
-    rfd = qemu_get_ram_fd(ram_addr);
+    assert(mr->ram_block);
+    rfd = mr->ram_block->fd;
 
     return mfd == rfd;
 }
diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h
index 5b6e1b8..9a01d4a 100644
--- a/include/exec/ram_addr.h
+++ b/include/exec/ram_addr.h
@@ -105,9 +105,7 @@ RAMBlock *qemu_ram_alloc_resizeable(ram_addr_t size, ram_addr_t max_size,
                                                     uint64_t length,
                                                     void *host),
                                     MemoryRegion *mr, Error **errp);
-int qemu_get_ram_fd(ram_addr_t addr);
-void qemu_set_ram_fd(ram_addr_t addr, int fd);
-void *qemu_get_ram_block_host_ptr(ram_addr_t addr);
+void *qemu_get_ram_block_host_ptr(RAMBlock *ram_block);
 void qemu_ram_free(RAMBlock *block);
 
 int qemu_ram_resize(RAMBlock *block, ram_addr_t newsize, Error **errp);
diff --git a/memory.c b/memory.c
index 239e6da..9cff7e2 100644
--- a/memory.c
+++ b/memory.c
@@ -1641,7 +1641,7 @@ int memory_region_get_fd(MemoryRegion *mr)
 
     assert(mr->ram_block);
 
-    return qemu_get_ram_fd(memory_region_get_ram_addr(mr) & TARGET_PAGE_MASK);
+    return mr->ram_block->fd;
 }
 
 void *memory_region_get_ram_ptr(MemoryRegion *mr)
