diff --git a/glnx-fdio.c b/glnx-fdio.c
index 7db33c4c61e45ef7ed105bde15d10296047c18fa..466cbc4e82e472e230b3739b5bcee86776865eee 100644
--- a/glnx-fdio.c
+++ b/glnx-fdio.c
@@ -354,7 +354,7 @@ static int btrfs_reflink(int infd, int outfd) {
         return 0;
 }
 
-static int loop_write(int fd, const void *buf, size_t nbytes) {
+int glnx_loop_write(int fd, const void *buf, size_t nbytes) {
         const uint8_t *p = buf;
 
         g_return_val_if_fail(fd >= 0, -1);
@@ -437,7 +437,7 @@ static int copy_bytes(int fdf, int fdt, off_t max_bytes, bool try_reflink) {
                         if (n == 0) /* EOF */
                                 break;
 
-                        r = loop_write(fdt, buf, (size_t) n);
+                        r = glnx_loop_write(fdt, buf, (size_t) n);
                         if (r < 0)
                                 return r;
                 }
@@ -685,7 +685,7 @@ glnx_file_replace_contents_with_perms_at (int                   dfd,
       goto out;
     }
 
-  if ((r = loop_write (fd, buf, len)) != 0)
+  if ((r = glnx_loop_write (fd, buf, len)) != 0)
     {
       errno = -r;
       glnx_set_error_from_errno (error);
diff --git a/glnx-fdio.h b/glnx-fdio.h
index a90544a9d80c2cc2a600e9f93f0d158aee8e1baf..c0fd4e4832070f8e89b4310356baf4b18dcf9664 100644
--- a/glnx-fdio.h
+++ b/glnx-fdio.h
@@ -102,6 +102,9 @@ glnx_readlinkat_malloc (int            dfd,
                         GCancellable  *cancellable,
                         GError       **error);
 
+int
+glnx_loop_write (int fd, const void *buf, size_t nbytes);
+
 typedef enum {
   GLNX_FILE_COPY_OVERWRITE,
   GLNX_FILE_COPY_NOXATTRS,