Re: [PATCH 5/8] btrfs: check if the fsid in the primary sb and copy sb are same

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 







+    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




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux