diff --git a/Documentation/btrfs-inspect-internal.rst b/Documentation/btrfs-inspect-internal.rst
index 710a34fb0cb9..8a9264d3dc5b 100644
--- a/Documentation/btrfs-inspect-internal.rst
+++ b/Documentation/btrfs-inspect-internal.rst
@@ -169,6 +169,13 @@ logical-resolve [-Pvo] [-s <bufsize>] <logical> <path>
         -v
                 (deprecated) alias for global *-v* option
 
+map-logical <logical> <device>
+        map the sector at given *logical* address in the linear filesystem space into
+        physical address.
+
+        .. note::
+                For RAID56, this will only map the data stripe.
+
 min-dev-size [options] <path>
         (needs root privileges)
 
diff --git a/cmds/inspect.c b/cmds/inspect.c
index 1534f2040f4e..271adf8c6fd4 100644
--- a/cmds/inspect.c
+++ b/cmds/inspect.c
@@ -29,6 +29,7 @@
 #include "kernel-shared/ctree.h"
 #include "common/send-utils.h"
 #include "kernel-shared/disk-io.h"
+#include "kernel-shared/volumes.h"
 #include "cmds/commands.h"
 #include "common/help.h"
 #include "common/open-utils.h"
@@ -125,6 +126,7 @@ static int cmd_inspect_inode_resolve(const struct cmd_struct *cmd,
 }
 static DEFINE_SIMPLE_COMMAND(inspect_inode_resolve, "inode-resolve");
 
+
 static const char * const cmd_inspect_logical_resolve_usage[] = {
 	"btrfs inspect-internal logical-resolve [-Pvo] [-s bufsize] <logical> <path>",
 	"Get file system paths for the given logical address",
@@ -348,6 +350,81 @@ out:
 }
 static DEFINE_SIMPLE_COMMAND(inspect_subvolid_resolve, "subvolid-resolve");
 
+static const char * const cmd_inspect_map_logical_usage[] = {
+	"btrfs inspect-internal map-logical <logical> <device>",
+	"Get the physical offset of a sector.",
+	NULL
+};
+
+static int print_mapping_info(struct btrfs_fs_info *fs_info, u64 logical)
+{
+	struct cache_extent *ce;
+	struct map_lookup *map;
+	int num_copies;
+	int cur_mirror;
+	int ret;
+
+	ce = search_cache_extent(&fs_info->mapping_tree.cache_tree, logical);
+	if (!ce) {
+		error("no chunk mapping found for logical %llu", logical);
+		return -ENOENT;
+	}
+	map = container_of(ce, struct map_lookup, ce);
+	/* For RAID56, we only return the data stripe. */
+	if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK)
+		num_copies = 1;
+	else
+		num_copies = btrfs_num_copies(fs_info, logical,
+					      fs_info->sectorsize);
+
+	for (cur_mirror = 1; cur_mirror <= num_copies; cur_mirror++) {
+		struct btrfs_multi_bio *multi = NULL;
+		u64 len = fs_info->sectorsize;
+
+		ret = btrfs_map_block(fs_info, READ, logical, &len, &multi,
+				      cur_mirror, NULL);
+		if (ret < 0) {
+			errno = -ret;
+			error("failed to map logical %llu: %m", logical);
+			return ret;
+		}
+		/* We're using READ, which should only return one mirror. */
+		ASSERT(multi && multi->num_stripes == 1);
+		printf("mirror %d logical %llu phyiscal %llu device %s\n",
+			cur_mirror, logical, multi->stripes[0].physical,
+			multi->stripes[0].dev->name);
+		free(multi);
+	}
+	return 0;
+}
+
+static int cmd_inspect_map_logical(const struct cmd_struct *cmd, int argc,
+				   char **argv)
+{
+	struct open_ctree_flags ocf = {0};
+	struct btrfs_fs_info *fs_info;
+	u64 logical;
+	int ret;
+
+	clean_args_no_options(cmd, argc, argv);
+
+	if (check_argc_exact(argc - optind, 2))
+		return 1;
+
+	ocf.filename = argv[optind + 1];
+	ocf.flags = OPEN_CTREE_CHUNK_ROOT_ONLY;
+	logical = arg_strtou64(argv[optind]);
+
+	fs_info = open_ctree_fs_info(&ocf);
+	if (!fs_info) {
+		error("failed to open btrfs on %s", ocf.filename);
+		return 1;
+	}
+	ret = print_mapping_info(fs_info, logical);
+	return !!ret;
+}
+static DEFINE_SIMPLE_COMMAND(inspect_map_logical, "map-logical");
+
 static const char* const cmd_inspect_rootid_usage[] = {
 	"btrfs inspect-internal rootid <path>",
 	"Get tree ID of the containing subvolume of path.",
@@ -690,6 +767,7 @@ static const struct cmd_group inspect_cmd_group = {
 		&cmd_struct_inspect_inode_resolve,
 		&cmd_struct_inspect_logical_resolve,
 		&cmd_struct_inspect_subvolid_resolve,
+		&cmd_struct_inspect_map_logical,
 		&cmd_struct_inspect_rootid,
 		&cmd_struct_inspect_min_dev_size,
 		&cmd_struct_inspect_dump_tree,
