From patchwork Mon Oct 17 18:13:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13009235 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3A4EC433FE for ; Mon, 17 Oct 2022 18:16:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8F2178E0006; Mon, 17 Oct 2022 14:16:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8A2096B007D; Mon, 17 Oct 2022 14:16:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 792818E0006; Mon, 17 Oct 2022 14:16:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 68D176B007B for ; Mon, 17 Oct 2022 14:16:45 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 3B253120626 for ; Mon, 17 Oct 2022 18:16:45 +0000 (UTC) X-FDA: 80031247170.29.5E402A1 Received: from 66-220-144-178.mail-mxout.facebook.com (66-220-144-178.mail-mxout.facebook.com [66.220.144.178]) by imf29.hostedemail.com (Postfix) with ESMTP id C356712003E for ; Mon, 17 Oct 2022 18:16:44 +0000 (UTC) Received: by dev1180.prn1.facebook.com (Postfix, from userid 425415) id 2E69439C99BE; Mon, 17 Oct 2022 11:13:56 -0700 (PDT) From: Stefan Roesch To: kernel-team@fb.com, linux-block@vger.kernel.org, linux-mm@kvack.org Cc: shr@devkernel.io, axboe@kernel.dk, clm@meta.com, willy@infradead.org, hch@infradead.org Subject: [RFC PATCH v2 06/14] mm: split off __bdi_set_max_ratio() function Date: Mon, 17 Oct 2022 11:13:29 -0700 Message-Id: <20221017181337.3884657-7-shr@devkernel.io> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221017181337.3884657-1-shr@devkernel.io> References: <20221017181337.3884657-1-shr@devkernel.io> MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666030604; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LqUVGiHmiJ6DXSLgcbrND54x5kK2lO6fc/yi//3REBY=; b=Qsyg6IDT7XBMvFXO6F3KZ7t0OddJqOX/TzER75bUOs0xD1YvD+FIFB+2zL2bcmKI7u7Mew dy1eq/4FPGEBAq27s0R40P9pfIl6pDDqx6nncLXC3NO5O3ne9El3zRCZ0atRVvUSlqBcwF ol3G5rLyxrS61n7wbflU/8j007OyQPc= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=none; spf=neutral (imf29.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666030604; a=rsa-sha256; cv=none; b=36gMnysM+Hrf7d0hQIjYcBW3WZozUwBkAyUz2QoRFWqI70iHEWcGYBAxyry8nkcFwybulI CJVhftL/8MYWSDJ+dXSnUYGW2jAiQiWUZLI/VZlbtxjrH6/jDir+cfkOmsYfAI7hCtGVpW DoqmGrbBFy80n8qq2keHHZ4LkBonbLs= X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: C356712003E X-Rspam-User: Authentication-Results: imf29.hostedemail.com; dkim=none; spf=neutral (imf29.hostedemail.com: 66.220.144.178 is neither permitted nor denied by domain of shr@devkernel.io) smtp.mailfrom=shr@devkernel.io; dmarc=none X-Stat-Signature: 9mjjppsiyjcn5h11cco5i5jdm1c3jzhm X-HE-Tag: 1666030604-78182 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This splits off the __bdi_set_max_ratio() function from the bdi_set_max_ratio() function. The __bdi_set_max_ratio() function will also be called from the bdi_set_max_bytes() function, which will be introduced in the next patch. Signed-off-by: Stefan Roesch --- mm/page-writeback.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 0b9dcf5afda2..8b8936603783 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -692,14 +692,10 @@ int bdi_set_min_ratio(struct backing_dev_info *bdi, unsigned int min_ratio) return ret; } -int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned max_ratio) +static int __bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio) { int ret = 0; - if (max_ratio > 100) - return -EINVAL; - max_ratio *= BDI_RATIO_SCALE; - spin_lock_bh(&bdi_lock); if (bdi->min_ratio > max_ratio) { ret = -EINVAL; @@ -711,6 +707,14 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned max_ratio) return ret; } + +int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio) +{ + if (max_ratio > 100) + return -EINVAL; + + return __bdi_set_max_ratio(bdi, max_ratio * BDI_RATIO_SCALE); +} EXPORT_SYMBOL(bdi_set_max_ratio); unsigned long long bdi_get_max_bytes(struct backing_dev_info *bdi)