From patchwork Tue Feb 9 06:36:45 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: TARUISI Hiroaki X-Patchwork-Id: 77947 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 o196aO4u001117 for ; Tue, 9 Feb 2010 06:36:24 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753360Ab0BIGgW (ORCPT ); Tue, 9 Feb 2010 01:36:22 -0500 Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:60308 "EHLO fgwmail5.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753228Ab0BIGgW (ORCPT ); Tue, 9 Feb 2010 01:36:22 -0500 Received: from m6.gw.fujitsu.co.jp ([10.0.50.76]) by fgwmail5.fujitsu.co.jp (Fujitsu Gateway) with ESMTP id o196aKMO012510 for (envelope-from taruishi.hiroak@jp.fujitsu.com); Tue, 9 Feb 2010 15:36:20 +0900 Received: from smail (m6 [127.0.0.1]) by outgoing.m6.gw.fujitsu.co.jp (Postfix) with ESMTP id 72F722C6A73 for ; Tue, 9 Feb 2010 15:36:20 +0900 (JST) Received: from s6.gw.fujitsu.co.jp (s6.gw.fujitsu.co.jp [10.0.50.96]) by m6.gw.fujitsu.co.jp (Postfix) with ESMTP id 7A4811EF081 for ; Tue, 9 Feb 2010 15:36:18 +0900 (JST) Received: from s6.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s6.gw.fujitsu.co.jp (Postfix) with ESMTP id 610DC1DB803A for ; Tue, 9 Feb 2010 15:36:18 +0900 (JST) Received: from m021.s.css.fujitsu.com (m021.s.css.fujitsu.com [10.0.81.61]) by s6.gw.fujitsu.co.jp (Postfix) with ESMTP id 179A21DB8037 for ; Tue, 9 Feb 2010 15:36:18 +0900 (JST) Received: from m021.css.fujitsu.com (m021 [127.0.0.1]) by m021.s.css.fujitsu.com (Postfix) with ESMTP id 6A37718077; Tue, 9 Feb 2010 15:36:17 +0900 (JST) Received: from [127.0.0.1] (unknown [10.124.100.186]) by m021.s.css.fujitsu.com (Postfix) with ESMTP id 4CF6D1806A; Tue, 9 Feb 2010 15:36:17 +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 15:36:49 +0900 (JST) Message-ID: <4B71027D.8080600@jp.fujitsu.com> Date: Tue, 09 Feb 2010 15:36:45 +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 v2]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 06:36:24 +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 13:54:39.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 (!name) + return -ENOMEM; + kfree(device->name); + device->name = name; } if (found_transid > fs_devices->latest_trans) {