From patchwork Thu Jul 4 04:06:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Bo X-Patchwork-Id: 2821751 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A408CBF4A1 for ; Thu, 4 Jul 2013 04:07:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A6E092014B for ; Thu, 4 Jul 2013 04:07:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A05232014A for ; Thu, 4 Jul 2013 04:07:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750909Ab3GDEHF (ORCPT ); Thu, 4 Jul 2013 00:07:05 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:50452 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750705Ab3GDEHE (ORCPT ); Thu, 4 Jul 2013 00:07:04 -0400 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r6446wBI023343 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 4 Jul 2013 04:06:58 GMT Received: from userz7022.oracle.com (userz7022.oracle.com [156.151.31.86]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r6446udG026042 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 4 Jul 2013 04:06:57 GMT Received: from abhmt111.oracle.com (abhmt111.oracle.com [141.146.116.63]) by userz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r6446uWi023553; Thu, 4 Jul 2013 04:06:56 GMT Received: from localhost.localdomain (/10.191.12.21) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 03 Jul 2013 21:06:55 -0700 Date: Thu, 4 Jul 2013 12:06:47 +0800 From: Liu Bo To: Chris Mason Cc: Miao Xie , linux-btrfs@vger.kernel.org Subject: Re: [RFC PATCH 00/12] Btrfs-progs: introduce chunk recover function Message-ID: <20130704040646.GA3577@localhost.localdomain> Reply-To: bo.li.liu@oracle.com References: <1372857920-4678-1-git-send-email-miaox@cn.fujitsu.com> <20130703203644.14981.18637@localhost.localdomain> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20130703203644.14981.18637@localhost.localdomain> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: acsinet22.oracle.com [141.146.126.238] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, Jul 03, 2013 at 04:36:44PM -0400, Chris Mason wrote: > Quoting Miao Xie (2013-07-03 09:25:08) > > This patchset introduced chunk recover function, which was implemented by > > scanning the whoel disks in the filesystem. Now, we can recover Single, > > Dup, RAID1 chunks, and RAID0, RAID10, RAID5, RAID6 metadata chunks. > > Really nice. I've integrated this with Liu Bo's btrfs-image fixes and > put it into a branch called integration. I've tested both repair and > image here, but if you could please double check the merge I'd > appreciate it. We still need another patch to make image work(actually we need to initialize missing device's uuid to NULL). It's the read_one_dev() part in https://patchwork.kernel.org/patch/2787291/ -liubo --- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/volumes.c b/volumes.c index d6f81f8..061f094 100644 --- a/volumes.c +++ b/volumes.c @@ -116,6 +116,7 @@ static int device_list_add(const char *path, /* we can safely leave the fs_devices entry around */ return -ENOMEM; } + device->fd = -1; device->devid = devid; memcpy(device->uuid, disk_super->dev_item.uuid, BTRFS_UUID_SIZE); @@ -1628,10 +1629,10 @@ static int read_one_dev(struct btrfs_root *root, if (!device) { printk("warning devid %llu not found already\n", (unsigned long long)devid); - device = kmalloc(sizeof(*device), GFP_NOFS); + device = kzalloc(sizeof(*device), GFP_NOFS); if (!device) return -ENOMEM; - device->total_ios = 0; + device->fd = -1; list_add(&device->dev_list, &root->fs_info->fs_devices->devices); }