From patchwork Tue Aug 27 10:50:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 2850121 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 470419F271 for ; Tue, 27 Aug 2013 10:51:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5E1F92049D for ; Tue, 27 Aug 2013 10:51:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4F446204A7 for ; Tue, 27 Aug 2013 10:51:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752922Ab3H0KvH (ORCPT ); Tue, 27 Aug 2013 06:51:07 -0400 Received: from mail-lb0-f174.google.com ([209.85.217.174]:63815 "EHLO mail-lb0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752143Ab3H0KvG (ORCPT ); Tue, 27 Aug 2013 06:51:06 -0400 Received: by mail-lb0-f174.google.com with SMTP id w6so2382405lbh.19 for ; Tue, 27 Aug 2013 03:51:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=l07beCHCNnWhrvCD5OlzzfRqT1uLF4PtomXkM4urJfE=; b=w8EX+jk2VtowhGzq8+HMpgVir6/6rjA1SBh5Y/kVQXNnIg/mLhbWb7bKUdMqjEkyYZ XCiQHkMS0A50NxWlLBszagkTa6CTquqpz7y0UnZPUoZoEhx+3YTGta4SwK2m8NT0uJBi zM0Kz6VHH8O/xd1v5xnWqR2/U5Jef3ICZj9fwZD9sW4KUWKTxWo+PNPmN4ZroBoPOhGz xZfyyKQSo7rszHN3Rwuw7kZJfvPiCwMowpgLA/S58u9x//E73ylfy0VKElx9qjwqrdU9 UYcOIwLby4rxib0beqt0RzMPLq71ZiQDW2JQjMYLbc8Hee3k2ttZOwXa5H+Mec393tOp Fx7w== X-Received: by 10.152.120.73 with SMTP id la9mr18092975lab.3.1377600663967; Tue, 27 Aug 2013 03:51:03 -0700 (PDT) Received: from localhost ([109.110.94.226]) by mx.google.com with ESMTPSA id ur6sm6919724lbc.5.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 27 Aug 2013 03:51:03 -0700 (PDT) From: Ilya Dryomov To: linux-btrfs@vger.kernel.org Cc: Chris Mason , Xavier Bassery , idryomov@gmail.com Subject: [PATCH] Btrfs: stop refusing the relocation of chunk 0 Date: Tue, 27 Aug 2013 13:50:44 +0300 Message-Id: <1377600644-10349-1-git-send-email-idryomov@gmail.com> X-Mailer: git-send-email 1.7.10.4 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-9.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 AFAICT chunk 0 is no longer special, and so it should be restriped just like every other chunk. One reason for this change is us refusing the relocation can lead to filesystems that can only be mounted ro, and never rw -- see the bugzilla [1] for details. The other reason is that device removal code is already doing this: it will happily relocate chunk 0 is part of shrinking the device. [1] https://bugzilla.kernel.org/show_bug.cgi?id=60594 Reported-by: Xavier Bassery Signed-off-by: Ilya Dryomov --- fs/btrfs/volumes.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index c9a0977..e8325de 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -2991,10 +2991,6 @@ again: if (found_key.objectid != key.objectid) break; - /* chunk zero is special */ - if (found_key.offset == 0) - break; - chunk = btrfs_item_ptr(leaf, slot, struct btrfs_chunk); if (!counting) { @@ -3030,6 +3026,8 @@ again: spin_unlock(&fs_info->balance_lock); } loop: + if (found_key.offset == 0) + break; key.offset = found_key.offset - 1; }