Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4152641pxj; Tue, 15 Jun 2021 16:57:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3oegkcyk/mtuGooe4ib2YQXiLWD4YEJAJnhwNheplQHnjM9tExMZPYxrYz1a1x4RWk0KG X-Received: by 2002:a17:907:207c:: with SMTP id qp28mr2032028ejb.311.1623801427689; Tue, 15 Jun 2021 16:57:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623801427; cv=none; d=google.com; s=arc-20160816; b=tcC7OFddiplsGDgO8ExMqmuuKAm7n9n5RZUnOyetefZaFbQN9RQm+GpP6aBpSjD/JF SpUI54DyF8y40j6+rWOP8Jh+QF1QTGP5gwKyoxUU6UDSje3S/hjgLkzVaj53Qo+uiLqr htVV6fznTSbk0zZTtgCd2K9F7Epqs12kmkpVAUacI51JNJ2ROUYKZ/QH2SQ36y56eY5D jrbLZfNvJxm6GPkIyrGmI86YuPCMCTE20iW72Ppx8k2kLPSRrk/1Im7xUC5m5/XrvS/Y 5mKxZKMmLaNIO0hGE6uKAEVLWA1y+me7Z0LtxNTDP/1xjLM2WwE98obl6uLO1kCQgENi wBvg== 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=+6fcAcC1DfRR58vscqjIGrKrDngFxFQmkfSXNmbM5Mc=; b=D4GgTVU+V3XmXELDTZoiCftt8qFtrDK/hfqi0sCOde8L2SCNEepq1h7gsL2RMP+uiR wOrsSXE72yLyGO0Y5jMKX99It9RRxmryPQ6yq/54M6zvasGzLpcDaaglX8omv8SywcfF /DOGNHZ/oeznSAbfqmuYOeVsxGPOIolnnqEvJUYJlv1GGUMaQmSyvUTy3yiUVtEBRYUO 3tdbVKxE7OkmQ6IcBd5ElNghD0XsH+ovbYwlq/Q41h5ZBOkFUDP/28/KFNBnIAXxHpQz 8wvnx21evk90sCTkwBfegzyLcH4UuNQzeqHPveAkAFPMYEQOZYZ4GEC1J8kAQDZ0uq/D Rd7Q== 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 z3si480484ejl.122.2021.06.15.16.56.40; Tue, 15 Jun 2021 16:57:07 -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 S231636AbhFOX6c (ORCPT + 99 others); Tue, 15 Jun 2021 19:58:32 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:39984 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231617AbhFOX6b (ORCPT ); Tue, 15 Jun 2021 19:58:31 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id 678011F4330A From: Gabriel Krisman Bertazi To: amir73il@gmail.com Cc: kernel@collabora.com, 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 Subject: [PATCH v2 06/14] fsnotify: Add helper to detect overflow_event Date: Tue, 15 Jun 2021 19:55:48 -0400 Message-Id: <20210615235556.970928-7-krisman@collabora.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210615235556.970928-1-krisman@collabora.com> References: <20210615235556.970928-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 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 aec05e21d5a9..7e00c05a979a 100644 --- a/fs/notify/fanotify/fanotify.h +++ b/fs/notify/fanotify/fanotify.h @@ -326,7 +326,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.31.0