Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:lafenghu
btrfsprogs
0120-btrfs-progs-Check-metadata-mirrors-in-find...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0120-btrfs-progs-Check-metadata-mirrors-in-find-root.patch of Package btrfsprogs
From a1ebf7b951c6796039748601404aa01fd283ddef Mon Sep 17 00:00:00 2001 From: David Marcin <djmarcin@google.com> Date: Wed, 16 Nov 2011 12:18:08 -0800 Subject: [PATCH 21/35] btrfs-progs: Check metadata mirrors in find-root. Signed-off-by: David Marcin <djmarcin@google.com> --- find-root.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/find-root.c b/find-root.c index c0f38b8..2899632 100644 --- a/find-root.c +++ b/find-root.c @@ -361,6 +361,8 @@ static int find_root(struct btrfs_root *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)) { @@ -377,8 +379,10 @@ static int find_root(struct btrfs_root *root) } offset = metadata_offset; } + mirror_num = 1; + again: err = __btrfs_map_block(&root->fs_info->mapping_tree, READ, - offset, &map_length, &type, &multi, 0); + offset, &map_length, &type, &multi, mirror_num); if (err) { offset += map_length; continue; @@ -396,9 +400,16 @@ static int find_root(struct btrfs_root *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; } -- 1.7.6.233.gd79bc
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor