EXPORT_SYMBOL_GPL(dax_truncate_page);
 
 #ifdef CONFIG_FS_IOMAP
+static sector_t dax_iomap_sector(struct iomap *iomap, loff_t pos)
+{
+       return iomap->blkno + (((pos & PAGE_MASK) - iomap->offset) >> 9);
+}
+
 static loff_t
 dax_iomap_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
                struct iomap *iomap)
                struct blk_dax_ctl dax = { 0 };
                ssize_t map_len;
 
-               dax.sector = iomap->blkno +
-                       (((pos & PAGE_MASK) - iomap->offset) >> 9);
+               dax.sector = dax_iomap_sector(iomap, pos);
                dax.size = (length + offset + PAGE_SIZE - 1) & PAGE_MASK;
                map_len = dax_map_atomic(iomap->bdev, &dax);
                if (map_len < 0) {
                goto unlock_entry;
        }
 
-       sector = iomap.blkno + (((pos & PAGE_MASK) - iomap.offset) >> 9);
+       sector = dax_iomap_sector(&iomap, pos);
 
        if (vmf->cow_page) {
                switch (iomap.type) {