From patchwork Tue Jan 19 16:04:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 73897 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o0JG4M4e024932 for ; Tue, 19 Jan 2010 16:04:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754346Ab0ASQEU (ORCPT ); Tue, 19 Jan 2010 11:04:20 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754131Ab0ASQEU (ORCPT ); Tue, 19 Jan 2010 11:04:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54525 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754261Ab0ASQET (ORCPT ); Tue, 19 Jan 2010 11:04:19 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o0JG4IT2002459 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 19 Jan 2010 11:04:18 -0500 Received: from localhost.localdomain (vpn-9-159.rdu.redhat.com [10.11.9.159]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o0JG4IZJ020069 for ; Tue, 19 Jan 2010 11:04:18 -0500 Date: Tue, 19 Jan 2010 11:04:17 -0500 From: Josef Bacik To: linux-btrfs@vger.kernel.org Subject: [RFC] make btrfs-image work Message-ID: <20100119160417.GA16384@localhost.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org diff --git a/btrfs-image.c b/btrfs-image.c index f2bbcc8..2d45ac3 100644 --- a/btrfs-image.c +++ b/btrfs-image.c @@ -564,41 +564,6 @@ static int create_metadump(const char *input, FILE *out, int num_threads, return 0; } -static void update_super(u8 *buffer) -{ - struct btrfs_super_block *super = (struct btrfs_super_block *)buffer; - struct btrfs_chunk *chunk; - struct btrfs_disk_key *key; - u32 sectorsize = btrfs_super_sectorsize(super); - u64 flags = btrfs_super_flags(super); - - flags |= BTRFS_SUPER_FLAG_METADUMP; - btrfs_set_super_flags(super, flags); - - key = (struct btrfs_disk_key *)(super->sys_chunk_array); - chunk = (struct btrfs_chunk *)(super->sys_chunk_array + - sizeof(struct btrfs_disk_key)); - - btrfs_set_disk_key_objectid(key, BTRFS_FIRST_CHUNK_TREE_OBJECTID); - btrfs_set_disk_key_type(key, BTRFS_CHUNK_ITEM_KEY); - btrfs_set_disk_key_offset(key, 0); - - btrfs_set_stack_chunk_length(chunk, (u64)-1); - btrfs_set_stack_chunk_owner(chunk, BTRFS_EXTENT_TREE_OBJECTID); - btrfs_set_stack_chunk_stripe_len(chunk, 64 * 1024); - btrfs_set_stack_chunk_type(chunk, BTRFS_BLOCK_GROUP_SYSTEM); - btrfs_set_stack_chunk_io_align(chunk, sectorsize); - btrfs_set_stack_chunk_io_width(chunk, sectorsize); - btrfs_set_stack_chunk_sector_size(chunk, sectorsize); - btrfs_set_stack_chunk_num_stripes(chunk, 1); - btrfs_set_stack_chunk_sub_stripes(chunk, 0); - chunk->stripe.devid = super->dev_item.devid; - chunk->stripe.offset = cpu_to_le64(0); - memcpy(chunk->stripe.dev_uuid, super->dev_item.uuid, BTRFS_UUID_SIZE); - btrfs_set_super_sys_array_size(super, sizeof(*key) + sizeof(*chunk)); - csum_block(buffer, 4096); -} - static void *restore_worker(void *data) { struct mdrestore_struct *mdres = (struct mdrestore_struct *)data; @@ -637,9 +602,6 @@ static void *restore_worker(void *data) size = async->bufsize; } - if (async->start == BTRFS_SUPER_INFO_OFFSET) - update_super(outbuf); - ret = pwrite64(outfd, outbuf, size, async->start); BUG_ON(ret != size);