From patchwork Thu Oct 4 21:24:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans van Kranenburg X-Patchwork-Id: 10626891 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 CA8F317E0 for ; Thu, 4 Oct 2018 21:31:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BBC482963F for ; Thu, 4 Oct 2018 21:31:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B088629644; Thu, 4 Oct 2018 21:31:01 +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 5D9112963F for ; Thu, 4 Oct 2018 21:31:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727354AbeJEE0J (ORCPT ); Fri, 5 Oct 2018 00:26:09 -0400 Received: from smtp.dpl.mendix.net ([83.96.177.10]:45760 "EHLO smtp.dpl.mendix.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726826AbeJEE0J (ORCPT ); Fri, 5 Oct 2018 00:26:09 -0400 Received: from mekker.bofh.hq.mendix.net (mekker.bofh.hq.mendix.net [IPv6:2001:828:13c8:10b::21]) by smtp.dpl.mendix.net (Postfix) with ESMTP id 024C1202A9 for ; Thu, 4 Oct 2018 23:24:44 +0200 (CEST) From: Hans van Kranenburg To: linux-btrfs@vger.kernel.org Subject: [PATCH 1/6] btrfs: alloc_chunk: do not refurbish num_bytes Date: Thu, 4 Oct 2018 23:24:38 +0200 Message-Id: <20181004212443.26519-2-hans.van.kranenburg@mendix.com> X-Mailer: git-send-email 2.19.0.329.g76f2f5c1e3 In-Reply-To: <20181004212443.26519-1-hans.van.kranenburg@mendix.com> References: <20181004212443.26519-1-hans.van.kranenburg@mendix.com> 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 num_bytes is used to store the chunk length of the chunk that we're allocating. Do not reuse it for something really different in the same function. Signed-off-by: Hans van Kranenburg Reviewed-by: Nikolay Borisov --- fs/btrfs/volumes.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index f4405e430da6..9c9bb127eeee 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -4837,8 +4837,9 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, goto error_del_extent; for (i = 0; i < map->num_stripes; i++) { - num_bytes = map->stripes[i].dev->bytes_used + stripe_size; - btrfs_device_set_bytes_used(map->stripes[i].dev, num_bytes); + btrfs_device_set_bytes_used(map->stripes[i].dev, + map->stripes[i].dev->bytes_used + + stripe_size); } atomic64_sub(stripe_size * map->num_stripes, &info->free_chunk_space);