Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4656688pxv; Tue, 29 Jun 2021 12:15:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzP5En9xPyyVGifrPSgcb9wRh3tx1xmppvVvH2MIQJe1nq4f3yPQUHiuePKTRkXE4OUECOI X-Received: by 2002:a05:6402:ca2:: with SMTP id cn2mr42164597edb.62.1624994108166; Tue, 29 Jun 2021 12:15:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624994108; cv=none; d=google.com; s=arc-20160816; b=PHA+eFum9+OU1Q7JzBQKKYvQ6SM5VGmYezWmKVbj2FgxX2j8cEFN5XJAZ4gROGD41Z ae0dgCAWKU2k5ZTKhWnWXQk46hq9IqASgdKUy83w80Hk/7J0U9FIbViSoU/fp6znqZQs xoW0bw50OuNhlFULfWBgWb+vjqlV9XYYniXptA7I+b6nqRupfl1CCsJlvcoAfJXMPieR f1fcIK+IX+zbxmdrv8b79B+SrUntXS8Dr/UMGJP9Y+eyZ3hSaJVtr+25DTU1TNXkbALh 0Klg+dgegGhh4SUW/M+VydsNmd6fAsADKm7MDiXnazVzI0XllDwrecP+noHkGyyHyMzT pI4Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=35D83NUTT/0R4cBH/K2uve1DOFCjSnsOU9DJfp2I7yI=; b=B75r+Smf1vytyvpYs2L4S43/Ldp0OTK3aL2DC7vczBZenUOW2+fRVE7MQJIDn9Xrao A8KJQnI5GyMhD2QNDgNmetRXvI60XI+SVi82rg8z4OToz5KMhWeE2X2/mVn9vUUf/Ema blnYfVYLAnosZulD4lf+bSUu6gIfW3SI+4YZLKxlUtKzXcv61wuU29TDM/Mra2ZvLxf0 wAJAaTyQi/+O8iFdo2Z/tavEJY9mNDMwF6EcZpGqHWU8jaJB0UCny9tQxOb+zBtFXFii 6a6ws82l8jsZvTDghBUAxZ/KEtfpsv5rni8nTDndD4mNMdLYNIAar+YjvJBU2hFmbphY 6vfA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id em22si21667352ejc.377.2021.06.29.12.14.43; Tue, 29 Jun 2021 12:15:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235485AbhF2TO6 (ORCPT + 99 others); Tue, 29 Jun 2021 15:14:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234228AbhF2TO6 (ORCPT ); Tue, 29 Jun 2021 15:14:58 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 898D3C061760; Tue, 29 Jun 2021 12:12:30 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id 3A2811F431AF From: Gabriel Krisman Bertazi To: amir73il@gmail.com Cc: djwong@kernel.org, tytso@mit.edu, david@fromorbit.com, jack@suse.com, dhowells@redhat.com, khazhy@google.com, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, Gabriel Krisman Bertazi , kernel@collabora.com Subject: [PATCH v3 06/15] fsnotify: Add helper to detect overflow_event Date: Tue, 29 Jun 2021 15:10:26 -0400 Message-Id: <20210629191035.681913-7-krisman@collabora.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210629191035.681913-1-krisman@collabora.com> References: <20210629191035.681913-1-krisman@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Similarly to fanotify_is_perm_event and friends, provide a helper predicate to say whether a mask is of an overflow event. Suggested-by: Amir Goldstein Reviewed-by: Amir Goldstein Signed-off-by: Gabriel Krisman Bertazi --- fs/notify/fanotify/fanotify.h | 3 ++- include/linux/fsnotify_backend.h | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/notify/fanotify/fanotify.h b/fs/notify/fanotify/fanotify.h index fd125a949187..2e005b3a75f2 100644 --- a/fs/notify/fanotify/fanotify.h +++ b/fs/notify/fanotify/fanotify.h @@ -328,7 +328,8 @@ static inline struct path *fanotify_event_path(struct fanotify_event *event) */ static inline bool fanotify_is_hashed_event(u32 mask) { - return !fanotify_is_perm_event(mask) && !(mask & FS_Q_OVERFLOW); + return !(fanotify_is_perm_event(mask) || + fsnotify_is_overflow_event(mask)); } static inline unsigned int fanotify_event_hash_bucket( diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index c4473b467c28..f9e2c6cd0f7d 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h @@ -495,6 +495,11 @@ static inline void fsnotify_queue_overflow(struct fsnotify_group *group) fsnotify_add_event(group, group->overflow_event, NULL, NULL); } +static inline bool fsnotify_is_overflow_event(u32 mask) +{ + return mask & FS_Q_OVERFLOW; +} + static inline bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group) { assert_spin_locked(&group->notification_lock); -- 2.32.0