From patchwork Wed Jan 6 09:02:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Tygier X-Patchwork-Id: 7965451 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 137A49F38D for ; Wed, 6 Jan 2016 09:02:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4422B20172 for ; Wed, 6 Jan 2016 09:02:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6ED2C20138 for ; Wed, 6 Jan 2016 09:02:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752372AbcAFJCr (ORCPT ); Wed, 6 Jan 2016 04:02:47 -0500 Received: from plane.gmane.org ([80.91.229.3]:55959 "EHLO plane.gmane.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752174AbcAFJCo (ORCPT ); Wed, 6 Jan 2016 04:02:44 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1aGjzO-0004X9-5S for linux-btrfs@vger.kernel.org; Wed, 06 Jan 2016 10:02:42 +0100 Received: from host-78-149-214-223.as13285.net ([78.149.214.223]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 06 Jan 2016 10:02:42 +0100 Received: from samtygier by host-78-149-214-223.as13285.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 06 Jan 2016 10:02:42 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: linux-btrfs@vger.kernel.org From: sam tygier Subject: [PATCH v3] Btrfs: Check metadata redundancy on balance Date: Wed, 6 Jan 2016 09:02:31 +0000 Lines: 41 Message-ID: <568CD827.3060601@yahoo.co.uk> Mime-Version: 1.0 X-Complaints-To: usenet@ger.gmane.org Cc: dave@jikos.cz X-Gmane-NNTP-Posting-Host: host-78-149-214-223.as13285.net X-Mozilla-News-Host: news://news.gmane.org:119 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.5.0 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, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,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 From: Sam Tygier Date: Wed, 6 Jan 2016 08:46:12 +0000 Subject: [PATCH] Btrfs: Check metadata redundancy on balance When converting a filesystem via balance check that metadata mode is at least as redundant as the data mode. For example give warning when: -dconvert=raid1 -mconvert=single Signed-off-by: Sam Tygier --- v3: Use btrfs_warn() Mention profiles in message v2: Use btrfs_get_num_tolerated_disk_barrier_failures() --- fs/btrfs/volumes.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index a23399e..be91458 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -3756,6 +3756,14 @@ int btrfs_balance(struct btrfs_balance_control *bctl, } } while (read_seqretry(&fs_info->profiles_lock, seq)); + if (btrfs_get_num_tolerated_disk_barrier_failures(bctl->meta.target) < + btrfs_get_num_tolerated_disk_barrier_failures(bctl->data.target)) { + btrfs_warn(fs_info, + "Warning: metatdata profile %llu has lower redundancy " + "than data profile %llu\n", bctl->meta.target, + bctl->data.target); + } + if (bctl->sys.flags & BTRFS_BALANCE_ARGS_CONVERT) { fs_info->num_tolerated_disk_barrier_failures = min( btrfs_calc_num_tolerated_disk_barrier_failures(fs_info),