summaryrefslogtreecommitdiff
path: root/super-recover.c
diff options
context:
space:
mode:
authorNikolay Borisov <nborisov@suse.com>2017-12-05 10:39:45 +0200
committerDavid Sterba <dsterba@suse.com>2018-01-31 15:14:01 +0100
commit90a00b3c79584eee7c282623c39ec88d3662be25 (patch)
tree56679929748ef8634640a38559c2819fe44bd991 /super-recover.c
parent6eccbe81f1baf11e00d55bdf86827c632de4cc5f (diff)
btrfs-progs: Remove recover_get_good_super
Currently getting the good super really consists of just getting the first entry on the linked list, since it's the one with the highest transid. So remove the function and just use list_first_entry directly. Signed-off-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'super-recover.c')
-rw-r--r--super-recover.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/super-recover.c b/super-recover.c
index 6a13d81b..e1251310 100644
--- a/super-recover.c
+++ b/super-recover.c
@@ -177,15 +177,6 @@ static int read_fs_supers(struct btrfs_recover_superblock *recover)
return 0;
}
-static struct super_block_record *recover_get_good_super(
- struct btrfs_recover_superblock *recover)
-{
- struct super_block_record *record;
- record = list_entry(recover->good_supers.next,
- struct super_block_record, list);
- return record;
-}
-
static void print_super_info(struct super_block_record *record)
{
printf("\t\tdevice name = %s\n", record->device_name);
@@ -280,7 +271,9 @@ int btrfs_recover_superblocks(const char *dname,
goto no_recover;
}
}
- record = recover_get_good_super(&recover);
+ record = list_first_entry(&recover.good_supers,
+ struct super_block_record, list);
+
root = open_ctree(record->device_name, record->bytenr,
OPEN_CTREE_RECOVER_SUPER | OPEN_CTREE_WRITES);
if (!root) {