From patchwork Tue Feb 15 01:55:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?546L5pOO?= X-Patchwork-Id: 12746430 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 lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 43AF7C433FE for ; Tue, 15 Feb 2022 02:06:25 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.272719.467654 (Exim 4.92) (envelope-from ) id 1nJnEI-0003xE-Fp; Tue, 15 Feb 2022 02:06:10 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 272719.467654; Tue, 15 Feb 2022 02:06:10 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nJnEI-0003x7-Cd; Tue, 15 Feb 2022 02:06:10 +0000 Received: by outflank-mailman (input) for mailman id 272719; Tue, 15 Feb 2022 02:06:09 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nJn5S-0006If-7W for xen-devel@lists.xenproject.org; Tue, 15 Feb 2022 01:57:02 +0000 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2071e.outbound.protection.outlook.com [2a01:111:f400:feab::71e]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 9093a397-8e02-11ec-b215-9bbe72dcb22c; Tue, 15 Feb 2022 02:57:01 +0100 (CET) Received: from SL2PR06MB3082.apcprd06.prod.outlook.com (2603:1096:100:37::17) by HK0PR06MB2771.apcprd06.prod.outlook.com (2603:1096:203:58::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11; Tue, 15 Feb 2022 01:56:50 +0000 Received: from SL2PR06MB3082.apcprd06.prod.outlook.com ([fe80::80b4:e787:47a9:41bb]) by SL2PR06MB3082.apcprd06.prod.outlook.com ([fe80::80b4:e787:47a9:41bb%4]) with mapi id 15.20.4975.019; Tue, 15 Feb 2022 01:56:50 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 9093a397-8e02-11ec-b215-9bbe72dcb22c ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kpP2y20MYGOxSEPc0GcMSozyevJPDMsBxdqncEMYFHZUXIqHOQUm3U6zc6bX08gaWINByP0mgLWcyEolNUIbMZUeVR96jnNGOS+3qKNK+yAFcoz0I0QHsQ1q3zhvUWmGVn08pviy2JxcOgV1kSzDnz/WcGizMamgwuDG40BMa3sE3Lg0eqG7lojfUpm0W0DBqkxn5Z1byrPwJmzkfXPTcQHaoea4iNsETG6/gzEI59iABrXLCsIUODhVzFT6LRDzqTqLCxNgijfHbaF7okxJiNSs5Lztfkk2abY0vsd/odOXWeDhGEffamBtN1iKHJ6cwpUJtnUhFbyxfzLRfI6RRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vnUOhbL312WydrIZGtqkVI+fDJEpdEbLKHZMp2nzkhA=; b=D1RYtJG1lkD9GW/NYymXmdEiW2jdSVEIIn2KMRY/hA9qYrNP4vgCeZ3xhQBGhmojpAzoA6x9EFUv4Bs6XcTekRDrjf1WRc9M+k2zLsIVwP75PQbukCQMn78Vye1NOShtL4PVSzb1IK2Z9iSsGYo5kYd3DZbCvqlXZScvpo2BVVmYAG0J+RGE987ZbCA7MuZ5iM7Frn/ooh0HA/wgjoELLQ8JC+qric+6xM9d+AxioqQhehszvk4X3VBEdaBP1prb3KnVuadVjhlVNbsE3w78LWOlsqguietVUT1TlxU1TEypxwGQZ4UnQ8yn7P8p0i2uXVdYwnE/j3LEjCTKeJMZZg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo0.onmicrosoft.com; s=selector2-vivo0-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vnUOhbL312WydrIZGtqkVI+fDJEpdEbLKHZMp2nzkhA=; b=GqIiQDLhuwcAXjWmqE+Zqk8WJ6EWQNe17U22epLF/Taq6SR7LyNVqeiDYrifXWhE6Kih08KhndBdwUzfXFhvo2gzZ2wdYFnC9f9GnNpVgKYxMKR+TjXg5wVlAHteb+FZKYnYOeU5tE/AuGwA8p5TUuuJ9ha81r51sD0n38p/J1Y= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; From: Qing Wang To: Konrad Rzeszutek Wilk , =?utf-8?q?Roger_Pau_Monn?= =?utf-8?q?=C3=A9?= , Jens Axboe , Michael Turquette , Stephen Boyd , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , Daniel Vetter , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , "Pan, Xinhui" , Srinivas Pandruvada , Jiri Kosina , Benjamin Tissoires , Dmitry Torokhov , Alasdair Kergon , Mike Snitzer , dm-devel@redhat.com, Mauro Carvalho Chehab , Hans Verkuil , xen-devel@lists.xenproject.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-input@vger.kernel.org, linux-media@vger.kernel.org Cc: Wang Qing Subject: [PATCH V3 10/13] md: use time_is_before_eq_jiffies() instead of open coding it Date: Mon, 14 Feb 2022 17:55:45 -0800 Message-Id: <1644890154-64915-9-git-send-email-wangqing@vivo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1644890154-64915-1-git-send-email-wangqing@vivo.com> References: <1644890154-64915-1-git-send-email-wangqing@vivo.com> X-ClientProxiedBy: HK2PR06CA0012.apcprd06.prod.outlook.com (2603:1096:202:2e::24) To SL2PR06MB3082.apcprd06.prod.outlook.com (2603:1096:100:37::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bc486b2e-0c4b-42c7-dbe7-08d9f0266e9e X-MS-TrafficTypeDiagnostic: HK0PR06MB2771:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1148; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QCWO2F/w7eHbPOL0e0e9xQNZ3K7Xw38kdf5QuAOps+fk4Qcyo4C93c+aP8pDzbFZqheTj3ekgZGi/KEmlKhO2hsT4HRpBrVAuDZtGAA/7+AhyggclMFAiPWcNsA85irQz1bxTwY4PAmsNiAwaQ7U5Spvdh/RaA08wsakr0eXNmjSl0CdZH2L7u52GJYQ+dB8pnl1cXqlAAk5se8p/5iZHmzeUUX1/TPuhcLcqUzRk2Eeo16YhX3yIkbFJ99sKMhYD2+1kDbpuUZct0ntXKZAy7BcLIGijpcXw0Y6emoKi4BJDB5WcD0wrbuEmvkgfGgyFwom4EhwUeuFZTyP1kHt35Ik673k2CMg80JKoPspYnxTcI2o5Xik5vtOOMqx/eT9W/9H8SZvl2hIT0dF3Wq5m0q+k7tNOi24kWszEVv9suEW8przc+tNA6lbAigv+gB8vbkfrg7QqsER7o9iPLvqpJTmdX2gUoNzdjHT6tCUiyLZQAvPLNgteDYd1Dzkg4eTX70lexMX35irUPEM2RmPi0t2FAljly1zKbkzhvyAl36WulZgHESjauZzgep/bb5v/rCPUyHKd8bgsMfHtFUXthTtzyD9BWd4ajwAsRRZbgQU05R+VhaLX38K/km+TYJ0bayJRFx9pzwfXH1M8z9nUyxmTz21Ial9TeG9T4gHHsfvkQSskZ4H6FJ81jCQZ9P6/CoG+ox2E6Dwdcz2v2DYxiJtDjHnbDQrDqcOOvtT8h4= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SL2PR06MB3082.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(6666004)(8936002)(83380400001)(26005)(186003)(6486002)(508600001)(107886003)(5660300002)(2906002)(7416002)(7406005)(921005)(110136005)(316002)(66476007)(8676002)(36756003)(66946007)(4326008)(66556008)(6506007)(6512007)(52116002)(86362001)(2616005)(38100700002)(38350700002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OcTsoEukQ+WkoN81aeNCUVTtA/p+y9SYnPvIhqVkCOJ9JSD22yIhnJ75M5XEn1Q4ZkQbaUON6f4JhZ5u52/RF/0lL9DGkR2VdAFmwZ7gbTKvT7PynwlXP0SjvYMWATYITfIVvjjwBQs+QxLhR0zB8XQ/iq78eCj4TYCPdttxNVqr8S4J5KrtL9Zxsj0cXdrtrvCIcr46hltG7mlz+KPHoF2zHRCFoLDMr52n6gbLaF8wzJ3K2InTyLh+JIhF+HH28Pr1pKUvCFwooMpQxcfalNpV/gPowcgYE5jmr9mk2nE5ilzdTc0KFh5COYqtoWV0rBnOlNbOtrOJEIlV6QM8D8TU0UZpUZxmQkC2jd9PAfL2IeaLgjV3AwyMjvD25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vk+7T2K68fUaVC9ryHb7xWFpB8NMG/yYbxGTVNoUtaxQqVHbF5DIgAwlsnIoFv7dGrWtY3/i7VolntJhqo5JtSAi38QA2b9HhMJjY63jsfbOhvCrzqV5bsjbSeml63n/PoRUV1knUfBzS+nz/JcBuzxJoW2O4wAS2s9D37807mfgId4FgCldTVMHQ74= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: bc486b2e-0c4b-42c7-dbe7-08d9f0266e9e X-MS-Exchange-CrossTenant-AuthSource: SL2PR06MB3082.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2022 01:56:50.7151 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zDKERJZpmV9cVwhCSBeq6+6IG4Ar72+JGr5GCs+hxdBhDvlX4ABHT2cnopQws+WWqunLrTbVc5vaE8NzrOjsrw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK0PR06MB2771 From: Wang Qing Use the helper function time_is_{before,after}_jiffies() to improve code readability. Signed-off-by: Wang Qing --- drivers/md/dm-writecache.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c index 5630b47..125bb5d --- a/drivers/md/dm-writecache.c +++ b/drivers/md/dm-writecache.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "dm-io-tracker.h" #define DM_MSG_PREFIX "writecache" @@ -1971,8 +1972,8 @@ static void writecache_writeback(struct work_struct *work) while (!list_empty(&wc->lru) && (wc->writeback_all || wc->freelist_size + wc->writeback_size <= wc->freelist_low_watermark || - (jiffies - container_of(wc->lru.prev, struct wc_entry, lru)->age >= - wc->max_age - wc->max_age / MAX_AGE_DIV))) { + time_is_before_eq_jiffies(container_of(wc->lru.prev, struct wc_entry, lru)->age + + wc->max_age - wc->max_age / MAX_AGE_DIV)) { n_walked++; if (unlikely(n_walked > WRITEBACK_LATENCY) &&