From patchwork Tue Feb 9 03:48:29 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: TARUISI Hiroaki X-Patchwork-Id: 77932 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o193milY028765 for ; Tue, 9 Feb 2010 03:48:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753598Ab0BIDsf (ORCPT ); Mon, 8 Feb 2010 22:48:35 -0500 Received: from fgwmail6.fujitsu.co.jp ([192.51.44.36]:47494 "EHLO fgwmail6.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753589Ab0BIDsf (ORCPT ); Mon, 8 Feb 2010 22:48:35 -0500 Received: from m5.gw.fujitsu.co.jp ([10.0.50.75]) by fgwmail6.fujitsu.co.jp (Fujitsu Gateway) with ESMTP id o193mXMq009429 for (envelope-from taruishi.hiroak@jp.fujitsu.com); Tue, 9 Feb 2010 12:48:33 +0900 Received: from smail (m5 [127.0.0.1]) by outgoing.m5.gw.fujitsu.co.jp (Postfix) with ESMTP id 2C8E045DE56 for ; Tue, 9 Feb 2010 12:48:33 +0900 (JST) Received: from s5.gw.fujitsu.co.jp (s5.gw.fujitsu.co.jp [10.0.50.95]) by m5.gw.fujitsu.co.jp (Postfix) with ESMTP id F124D45DE55 for ; Tue, 9 Feb 2010 12:48:32 +0900 (JST) Received: from s5.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s5.gw.fujitsu.co.jp (Postfix) with ESMTP id CFB37E18001 for ; Tue, 9 Feb 2010 12:48:32 +0900 (JST) Received: from m022.s.css.fujitsu.com (m022.s.css.fujitsu.com [10.0.81.62]) by s5.gw.fujitsu.co.jp (Postfix) with ESMTP id 6BF3F1DB803F for ; Tue, 9 Feb 2010 12:48:32 +0900 (JST) Received: from m022.css.fujitsu.com (m022 [127.0.0.1]) by m022.s.css.fujitsu.com (Postfix) with ESMTP id 5810F1805D; Tue, 9 Feb 2010 12:48:32 +0900 (JST) Received: from [127.0.0.1] (unknown [10.124.100.186]) by m022.s.css.fujitsu.com (Postfix) with ESMTP id 3A04A1804C; Tue, 9 Feb 2010 12:48:32 +0900 (JST) X-SecurityPolicyCheck-FJ: OK by FujitsuOutboundMailChecker v1.4.0 Received: from paxd3.soft.fujitsu.com[10.124.100.186] by paxd3.soft.fujitsu.com (FujitsuOutboundMailChecker v1.4.0/9992[10.124.100.186]); Tue, 09 Feb 2010 12:49:01 +0900 (JST) Message-ID: <4B70DB0D.2060007@jp.fujitsu.com> Date: Tue, 09 Feb 2010 12:48:29 +0900 From: TARUISI Hiroaki User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; ja; rv:1.9.1.7) Gecko/20100111 Thunderbird/3.0.1 MIME-Version: 1.0 To: gjalves@gjalves.com.br CC: linux-btrfs@vger.kernel.org Subject: [PATCH]btrfs: Update existing btrfs_device for renaming device References: <69e11d1f0911071341n4c0a845ds7bbf5d64b039d8f@mail.gmail.com> <69e11d1f0911071344n7c059bd3o53896f4e8982e20b@mail.gmail.com> In-Reply-To: <69e11d1f0911071344n7c059bd3o53896f4e8982e20b@mail.gmail.com> X-Enigmail-Version: 1.0.1 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 09 Feb 2010 03:48:44 +0000 (UTC) Index: b/fs/btrfs/volumes.c =================================================================== --- a/fs/btrfs/volumes.c 2010-02-09 12:11:33.000000000 +0900 +++ b/fs/btrfs/volumes.c 2010-02-09 12:43:29.000000000 +0900 @@ -365,6 +365,7 @@ static noinline int device_list_add(cons struct btrfs_device *device; struct btrfs_fs_devices *fs_devices; u64 found_transid = btrfs_super_generation(disk_super); + char *name; fs_devices = find_fsid(disk_super->fsid); if (!fs_devices) { @@ -411,6 +412,12 @@ static noinline int device_list_add(cons device->fs_devices = fs_devices; fs_devices->num_devices++; + } else if (strcmp(device->name, path)) { + name = kstrdup(path, GFP_NOFS); + if (!device->name) + return -ENOMEM; + kfree(device->name); + device->name = name; } if (found_transid > fs_devices->latest_trans) {