btrfsprogs/0169-btrfs-progs-Check-metadata-mirrors-in-find-root.patch
David Sterba 16faca8b7b Accepting request 229373 from home:dsterba:branches:filesystems
- fsck: fixes and enahancements to --init-extent-tree mode
- fsck: chunk-recover updates
- scrub: add force option -f
- send: check if subvolumes are read-only
- subvol snapshot: add options to affect commit behaviour
- btrfs: add properties command group
- restore: add dry-run option
- restore: fix restoring of compressed files
- mkfs: support for no-holes feature
- mkfs: option -r deals with hardlinks and relative paths
- mkfs: discard phase is interruptible
- documentation updates
- cleaned spec file
- Removed patches:
  * 0162-btrfs-progs-fix-loop-device-mount-checks.patch
  * 0165-Revert-btrfs-progs-update-options-in-find-root.c.patch
  * 0166-Btrfs-progs-add-some-verbose-output-to-find-root.patch
  * 0169-btrfs-progs-Check-metadata-mirrors-in-find-root.patch

OBS-URL: https://build.opensuse.org/request/show/229373
OBS-URL: https://build.opensuse.org/package/show/filesystems/btrfsprogs?expand=0&rev=149
2014-04-08 11:58:43 +00:00

54 lines
1.6 KiB
Diff

From 4469ed43b26b6e7d5ad5cfea45e99708e39de4a6 Mon Sep 17 00:00:00 2001
From: David Marcin <djmarcin@google.com>
Date: Wed, 16 Nov 2011 12:18:08 -0800
Subject: [PATCH 169/170] btrfs-progs: Check metadata mirrors in find-root.
Signed-off-by: David Marcin <djmarcin@google.com>
---
btrfs-find-root.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
Index: btrfs-progs-v3.14/btrfs-find-root.c
===================================================================
--- btrfs-progs-v3.14.orig/btrfs-find-root.c
+++ btrfs-progs-v3.14/btrfs-find-root.c
@@ -230,6 +230,8 @@ static int find_root(struct btrfs_root *
while (1) {
u64 map_length = 4096;
u64 type;
+ int mirror_num;
+ int num_copies;
if (offset >
btrfs_super_total_bytes(root->fs_info->super_copy)) {
@@ -246,9 +248,11 @@ static int find_root(struct btrfs_root *
}
offset = metadata_offset;
}
+ mirror_num = 1;
+ again:
err = __btrfs_map_block(&root->fs_info->mapping_tree, READ,
offset, &map_length, &type,
- &multi, 0, NULL);
+ &multi, mirror_num, NULL);
if (err) {
offset += map_length;
continue;
@@ -267,9 +271,16 @@ static int find_root(struct btrfs_root *
err = read_physical(root, fd, offset, bytenr, map_length);
if (!err) {
+ /* Found the root. */
ret = 0;
break;
} else if (err < 0) {
+ num_copies = btrfs_num_copies(&root->fs_info->mapping_tree,
+ offset, map_length);
+ mirror_num++;
+ if (mirror_num <= num_copies)
+ goto again;
+ /* Unrecoverable error in read. */
ret = err;
break;
}