Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2138262ybc; Wed, 20 Nov 2019 09:26:55 -0800 (PST) X-Google-Smtp-Source: APXvYqy2GP6e8AEQhEN9IiQrmclwj2IXiaWeLNXWFQAAJ/JDOR8d96s1rqXfVNyeDI2x0tfNYw3a X-Received: by 2002:a17:907:2122:: with SMTP id qo2mr6848058ejb.12.1574270814871; Wed, 20 Nov 2019 09:26:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574270814; cv=none; d=google.com; s=arc-20160816; b=ZvHcTNzossTOn1hUJ2HCkOwagDtRRWlxu1tdmmcswMh02uR1DXN+hdg8gzvZ8hcjnz +6+IJmBfbFLi5btdhBeS72QV79iQCjPVSLm4coa7ggJCqnXcLCKS0ESb8K3FvoP6Cl2n ybsilxMmrwX5ljem4WTow8POpkht0WuKTZLuL0MZJbaEsUruAA343Tz2AmAR7j9dCIog EH8cmCae9rOmPsfsZJtyRpkeEAeOT8+OFN4B0dXbVKT+na8RJ23DOB99Xc322uVx4tXr GxxfzRuvKkrdDcxWy8Tz8hKs/CPVICnYyvzU3bon+I4Ry4Ki+EpPa/yXM9TQJ31DUmte 2XaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=xty4ksNLr5buFOJeEdQNXmch16ElgQkMAddpvffprIk=; b=iSIckRQ2QY+44v5MibxILt2O1YRsg5zjlVS0pAkisX21QwpvXldbOJVkqb2/Czt8uB nEp2tTn4HQmq5LcQkOEUZl1VfzoYfxjna4iKn9Fr6nv0iJ9s1WJTUj6ZWJXTQ8IpYKnK plIILiSVqOy0rCM4QrAdOJHmqscbNdXGMxSx6FW7L8qpWMFx/yWnBX96BomXRR+jTsT6 nvwbLI3JL2L28K2QOlJykEsNWsFN7aTGTRGr7ZiEQpJiN3dWJxyduiDXZRHdzBu20r0s eVTnBmr8zB5KUyq+P+D6x50K72MPc3UKgLX+vbHGarQrdeBcA0aKyPekNZUqZW5q4CBh pWFQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qh13si17047663ejb.407.2019.11.20.09.26.30; Wed, 20 Nov 2019 09:26:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732000AbfKTPkq (ORCPT + 99 others); Wed, 20 Nov 2019 10:40:46 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:53008 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731843AbfKTPkU (ORCPT ); Wed, 20 Nov 2019 10:40:20 -0500 Received: from [167.98.27.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iXS5X-0004d5-Fu; Wed, 20 Nov 2019 15:40:15 +0000 Received: from ben by deadeye with local (Exim 4.93-RC1) (envelope-from ) id 1iXS5V-0004P2-N8; Wed, 20 Nov 2019 15:40:13 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, Denis Kirjanov , "Hans van Kranenburg" Date: Wed, 20 Nov 2019 15:38:31 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 81/83] btrfs: partially apply b8b93addde In-Reply-To: X-SA-Exim-Connect-IP: 167.98.27.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.78-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Hans van Kranenburg Extracted from commit b8b93addde "btrfs: cleanup 64bit/32bit divs, provably bounded values", to allow commits 793ff2c88c6 "btrfs: volumes: Cleanup stripe size calculation" and baf92114c7 "btrfs: alloc_chunk: fix more DUP stripe size handling" to apply cleanly. [bwh: Add patch description] Signed-off-by: Ben Hutchings --- fs/btrfs/volumes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 4aa1a20fc5d7..b4b98a75ca8b 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -4274,8 +4274,8 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, */ if (stripe_size * data_stripes > max_chunk_size) { u64 mask = (1ULL << 24) - 1; - stripe_size = max_chunk_size; - do_div(stripe_size, data_stripes); + + stripe_size = div_u64(max_chunk_size, data_stripes); /* bump the answer up to a 16MB boundary */ stripe_size = (stripe_size + mask) & ~mask;