+ for (i = 0; i < BTRFS_SUPER_MIRROR_MAX; i++) {
+ u64 bytenr = btrfs_sb_offset(i);
+
+ ret = btrfs_read_disk_super(bdev, bytenr, &page, &disk_super);
+ if (ret) {
+ if (i == 0)
+ goto error_kfree;
+ /* copy2 is optional */
+ ret = 0;
+ continue;
+ }
+
+ if (i == 0) {
+ memcpy(disk_super_primary, disk_super,
+ sizeof(*disk_super_primary));
+ btrfs_release_disk_super(page);
+ continue;
Doing the memcpy is enough here, the bottom of the loop already releases
the disk page and continues on the next iteration.
The page map happens inside btrfs_read_disk_super(), we
need unmap before going for the next superblock.
You already have btrfs_release_disk_super(page); called at the end of
the iteration, right after the closing bracket for the else, see below...
Ah. You meant only memcpy. Yes.
This part of the code is completely changed in V2. Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html