From patchwork Tue Oct 11 01:00:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roesch X-Patchwork-Id: 13003483 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 56C82C433FE for ; Tue, 11 Oct 2022 01:01:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0DE42900004; Mon, 10 Oct 2022 21:01:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 04106900003; Mon, 10 Oct 2022 21:01:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC765900004; Mon, 10 Oct 2022 21:01:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 98CFB900002 for ; Mon, 10 Oct 2022 21:01:23 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 5EB45C0FFC for ; Tue, 11 Oct 2022 01:01:23 +0000 (UTC) X-FDA: 80006865246.01.6A2B6D6 Received: from 66-220-144-178.mail-mxout.facebook.com (66-220-144-178.mail-mxout.facebook.com [66.220.144.178]) by imf27.hostedemail.com (Postfix) with ESMTP id D7BE84001A for ; Tue, 11 Oct 2022 01:01:22 +0000 (UTC) Received: by dev1180.prn1.facebook.com (Postfix, from userid 425415) id 0ED0134BDDDA; Mon, 10 Oct 2022 18:01:06 -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 Subject: [RFC PATCH v1 06/14] mm: split off __bdi_set_max_ratio() function Date: Mon, 10 Oct 2022 18:00:36 -0700 Message-Id: <20221011010044.851537-7-shr@devkernel.io> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221011010044.851537-1-shr@devkernel.io> References: <20221011010044.851537-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=1665450083; 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=49SB/mXGyakrtnFbD0yn79grhDphnqV3sZ3SnoMjaoCden6QoaJT4Bz13LB1u7EWQTJBZX J/CU0OOb/SYBy4asE5G82mtBVjhdPRaxf8ref4UlmXGbtXsdOhMQm0tOIyh4Y5gYRrFO5c 3dL4/uekXZiGbimEPuLuiar2745IIkk= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; spf=neutral (imf27.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=1665450083; a=rsa-sha256; cv=none; b=vxNqjEP1Wa/9mQSLB0SASjYUkm3IAmcsY7cPN5s+3cB06cbpCJpYlchsk8l9PdKgxdzbtY eWVRGbFOc5fnZQl/y3+cBaOl15ymnVoUsinKTRoZ0PAYiyQHRaPBf77hIrPwkNjTjCqL0D QwnR35cyty4XXOugfm3mygC9cTBh5II= Authentication-Results: imf27.hostedemail.com; dkim=none; spf=neutral (imf27.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-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: tbxn7x937xyxqfpipiw4u3dz8n3tbsk1 X-Rspamd-Queue-Id: D7BE84001A X-HE-Tag: 1665450082-996552 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)