Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp3257271pxm; Mon, 28 Feb 2022 15:46:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJzPG7arjta7ttzDNLfVVhHlAkRat70EHvU1lmK+7mizCGrNhdCA2WMC1kwinxHTsERL/XRE X-Received: by 2002:a17:906:e28a:b0:6d6:e2e9:d39d with SMTP id gg10-20020a170906e28a00b006d6e2e9d39dmr1226782ejb.2.1646091981742; Mon, 28 Feb 2022 15:46:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646091981; cv=none; d=google.com; s=arc-20160816; b=dVzeTsMTBnBhF406A8/2lG9n3JNdXCmf5CkxTaek+mDv6bzLVxSWATXcY1VqJvOncY zpUdR+UQ/UElwuseHMPNRUimESxX8wvABOaSMXGjo2UnQTTjYbqktW6xiH82CZmAtzFd 9m7S34oUyJDxIQS2k+/J7hsW53W3o8XFPs+Q6wfsS2yi2rKhRYFw/bKe2c09a6X7BU4D CW7GC6p7YFKBqRH3S/fH6bEF0bvXMeWY7c24g4SidpEzHzeD5x6xHkMWWh/v2TU+j/q/ sPuO9vKkcSTGfRPMsJuycfazP5CFEvg9Tt/bKDNbCeQmCgrydm/aAinAX1MxNVEywX6h QTYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=GsxpUBdbWqhwvtlxJIKUlO0M2+Pr5nAVEC771c3QJ/k=; b=Zboz6t12DH2BBUGVdH4lmXydJEDGjl1E8Y78D07KHwXMk5gX1B2elJ/3hzkyAM6ySD SNOfWmHIwmUd/QNAAhBcgB7UDaPemR4gybj+keTBSM1JaBmAtWMGzy6+aIQYEjhUSBBL FH2KjleW4ymJkhCAB7mdxEpT9PGR0WHnDXFZi0XgwdxZuOH0B1VzTj6mzmAyISBIMRnd aY8+R5IGON4+DHkm0w4+PTmyyu7qUCIk9EoZM9vxAdYBRsS24759ZZlIICV0BD2wcIjF uFIBo5tKZbMU2K7yuqsV3tEFRaTEAYAkiC3fhmsigaPbDfC3N8cnpdTunxFsAcrjl+Ax qUGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qchEkZ+1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s1-20020a50d481000000b0041289426455si7705796edi.573.2022.02.28.15.45.59; Mon, 28 Feb 2022 15:46:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qchEkZ+1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231636AbiB1Wys (ORCPT + 99 others); Mon, 28 Feb 2022 17:54:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231611AbiB1Wyp (ORCPT ); Mon, 28 Feb 2022 17:54:45 -0500 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F243D15A20; Mon, 28 Feb 2022 14:54:03 -0800 (PST) Received: by mail-ej1-x62b.google.com with SMTP id a8so27854704ejc.8; Mon, 28 Feb 2022 14:54:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GsxpUBdbWqhwvtlxJIKUlO0M2+Pr5nAVEC771c3QJ/k=; b=qchEkZ+1MqfOevkqUl4bSWLuZ7qjRLt9ku6OqIaZEEvQ1Qk7/DLqfnsHlKbEjJ10us LBhkjSIMZFSgCJvtojYCJpCHh8YzxsTVbhucBhA3VsJ7C2TAf3Lwqgr+BzzmjPD/0yBs UPo3BEBR0JiOfO+4v6eAy2FQqGoH8T+gF8QsSywoL7HNpkTyUPBGPPXBrUD9j3OCBk+l a5MnWFXFk1Dh2LVWDtF8lL7/kc1gLTmo5cRoTBoQVJ4CG+tmbr2WsDPYw2OiPBTnmV0t /g37eAyk1nRwEr1HkAsix34OpgNgU2BJczZO3qlGo0gA8biAcALfGZ0VoP8EEnvquJUA Nsjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GsxpUBdbWqhwvtlxJIKUlO0M2+Pr5nAVEC771c3QJ/k=; b=5dLqgCPEbvaoyZBCbFSH2f0YwVrW5APitT35avcmRtd1cN3ad7pLsnSceia6NZgS+l czASbRKUYb0NeYIs87BDoLdhgocXwel/2U15IWEgvlg6RR6SnkrstLu3p54WD2FthRKu V7g6/FliUmqLXDjzTyfZJ+emOkLFiTSb/2jyXDstkJ66EMC8O/RrY7OhtkEDaVlcf3im ln2CY7ZoWPK18BpFZbnFf3jS4i+om+a4LNQwVDVPCLLrwX3TEpabqP0S9Rk78aVXjVM1 nRZydnR9kfOw5lMBBt7gks/Hs6cC4lBjS55TOqoxO6FXWQ3bmgxp6JyFaOrhR1glU//N e3Tg== X-Gm-Message-State: AOAM5329SM5X//iobKfIrm/ep+0jrLhgHTcWKUGksnOVsumCLL0W+PaG NVJC6xeJysa4tELCUwMXeD4R/FwZfMpedA== X-Received: by 2002:a17:906:814f:b0:6a8:49fa:a3f5 with SMTP id z15-20020a170906814f00b006a849faa3f5mr7020486ejw.421.1646088842504; Mon, 28 Feb 2022 14:54:02 -0800 (PST) Received: from nlaptop.localdomain (ptr-dtfv0poj8u7zblqwbt6.18120a2.ip6.access.telenet.be. [2a02:1811:cc83:eef0:f2b6:6987:9238:41ca]) by smtp.gmail.com with ESMTPSA id o14-20020a170906774e00b006d5b915f27dsm4736885ejn.169.2022.02.28.14.52.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 14:53:22 -0800 (PST) From: Niels Dossche To: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Chris Mason , Josef Bacik , David Sterba , Niels Dossche , Johannes Thumshirn Subject: [PATCH] btrfs: add lockdep_assert_held to need_preemptive_reclaim Date: Mon, 28 Feb 2022 23:52:16 +0100 Message-Id: <20220228225215.16552-1-dossche.niels@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In a previous patch I extended the locking for member accesses of space_info. It was then suggested to also add a lockdep assertion for space_info->lock to need_preemptive_reclaim. Suggested-by: Johannes Thumshirn Signed-off-by: Niels Dossche --- fs/btrfs/space-info.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c index 294242c194d8..5464bd168d5b 100644 --- a/fs/btrfs/space-info.c +++ b/fs/btrfs/space-info.c @@ -734,9 +734,13 @@ static bool need_preemptive_reclaim(struct btrfs_fs_info *fs_info, { u64 global_rsv_size = fs_info->global_block_rsv.reserved; u64 ordered, delalloc; - u64 thresh = div_factor_fine(space_info->total_bytes, 90); + u64 thresh; u64 used; + lockdep_assert_held(&space_info->lock); + + thresh = div_factor_fine(space_info->total_bytes, 90); + /* If we're just plain full then async reclaim just slows us down. */ if ((space_info->bytes_used + space_info->bytes_reserved + global_rsv_size) >= thresh) -- 2.35.1