From patchwork Fri Oct 26 11:43:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 10657277 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1CF2013A9 for ; Fri, 26 Oct 2018 11:43:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DB052AF38 for ; Fri, 26 Oct 2018 11:43:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 023B72B6CD; Fri, 26 Oct 2018 11:43:31 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 C16A42AF38 for ; Fri, 26 Oct 2018 11:43:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727558AbeJZUUK (ORCPT ); Fri, 26 Oct 2018 16:20:10 -0400 Received: from mx2.suse.de ([195.135.220.15]:33528 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727462AbeJZUUK (ORCPT ); Fri, 26 Oct 2018 16:20:10 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 368C3ABDC for ; Fri, 26 Oct 2018 11:43:23 +0000 (UTC) From: Nikolay Borisov To: linux-btrfs@vger.kernel.org Cc: Nikolay Borisov Subject: [PATCH 0/5] Misc cleanups in balance code Date: Fri, 26 Oct 2018 14:43:16 +0300 Message-Id: <1540554201-11305-1-git-send-email-nborisov@suse.com> X-Mailer: git-send-email 2.7.4 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 While investigating the balance hang I came across various inconsistencies in the source. This series aims to fix those. The first patch is (I believe) a fix to a longstanding bug that could cause balance to fail due to ENOSPC. The code no properly ensures that there is at least 1g of unallocated space on every device being balance. Patch 2 makes btrfs_can_relocate a bit more obvious and removes leftovers from previous cleanup Patches 3/4/5 remove some redundant code from various functions. This series has survived multiple xfstest runs. Nikolay Borisov (5): btrfs: Ensure at least 1g is free for balance btrfs: Refactor btrfs_can_relocate btrfs: Remove superfluous check form btrfs_remove_chunk btrfs: Sink find_lock_delalloc_range's 'max_bytes' argument btrfs: Replace BUG_ON with ASSERT in find_lock_delalloc_range fs/btrfs/ctree.h | 2 +- fs/btrfs/extent-tree.c | 39 ++++++++++++++------------------------- fs/btrfs/extent_io.c | 13 ++++++------- fs/btrfs/extent_io.h | 2 +- fs/btrfs/tests/extent-io-tests.c | 10 +++++----- fs/btrfs/volumes.c | 17 +++++++---------- 6 files changed, 34 insertions(+), 49 deletions(-)