From patchwork Wed Nov 9 13:03:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Mamedov X-Patchwork-Id: 9419189 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4835E6022E for ; Wed, 9 Nov 2016 13:03:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 39D482914F for ; Wed, 9 Nov 2016 13:03:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2E58D29276; Wed, 9 Nov 2016 13:03:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 991FA2914F for ; Wed, 9 Nov 2016 13:03:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753008AbcKINDH (ORCPT ); Wed, 9 Nov 2016 08:03:07 -0500 Received: from len.romanrm.net ([195.154.117.182]:34474 "EHLO len.romanrm.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752065AbcKINDH (ORCPT ); Wed, 9 Nov 2016 08:03:07 -0500 Received: from natsu (unknown [IPv6:fd39::e9:9eff:fe8f:1bcf]) by len.romanrm.net (Postfix) with SMTP id 1860D2F0B6 for ; Wed, 9 Nov 2016 13:03:02 +0000 (UTC) Date: Wed, 9 Nov 2016 18:03:01 +0500 From: Roman Mamedov To: "linux-btrfs@vger.kernel.org" Subject: [RFC] [PATCH] Mounting "degraded, rw" should allow for any number of devices missing Message-ID: <20161109180301.17aa7726@natsu> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hello, Mounting "degraded,rw" should allow for any number of devices missing, as in many cases the current check seems overly strict and not helpful during what is already a manual recovery scenario. Let's assume the user applying the "degraded" option knows best what condition their FS is in and what are the next steps required to recover from the degraded state. Specifically this would allow salvaging "JBOD-style" arrays of data=single metadata=RAID1, if the user is ready to accept loss of data portions which were on the removed drive. Currently if one of the disks got removed it is not possible for such array to be mounted rw at all -- hence not possible to "dev delete missing" and the only solution is to recreate the FS. Besides, I am currently testing a concept of SSD+HDD array with data=single and metadata=RAID1, where the SSD is used for RAID1 metadata chunks only. E.g. my 13 TB FS only has about 14 GB of metadata at the moment, so I could comfortably use a spare 60GB SSD as a metadata-only device for it. (Making all metadata reads prefer SSD could be the next step.) It would be nice to be able to just lose/fail/forget that SSD, without having to redo the entire FS. But again, since the remaining device has data=single, currently it won't be write-mountable in the degraded state, even though the missing device had only ever contained RAID1 chunks. Maybe someone has other ideas how to solve the above scenarios? Thanks --- 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 --- linux-amd64-4.4/fs/btrfs/disk-io.c.orig 2016-11-09 16:19:50.431117913 +0500 +++ linux-amd64-4.4/fs/btrfs/disk-io.c 2016-11-09 16:20:31.567117874 +0500 @@ -2992,7 +2992,8 @@ btrfs_calc_num_tolerated_disk_barrier_failures(fs_info); if (fs_info->fs_devices->missing_devices > fs_info->num_tolerated_disk_barrier_failures && - !(sb->s_flags & MS_RDONLY)) { + !(sb->s_flags & MS_RDONLY) && + !btrfs_raw_test_opt(fs_info->mount_opt, DEGRADED)) { pr_warn("BTRFS: missing devices(%llu) exceeds the limit(%d), writeable mount is not allowed\n", fs_info->fs_devices->missing_devices, fs_info->num_tolerated_disk_barrier_failures);