Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp5060781pxb; Thu, 14 Oct 2021 18:18:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQfn3nXoXvUMXlnKoGITCd/9GDvYe1JtA5BjmTXyYOXVDxNRr0PFs6F932zZ3+TQeRHp9Y X-Received: by 2002:a17:90a:db14:: with SMTP id g20mr24267268pjv.43.1634260719917; Thu, 14 Oct 2021 18:18:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634260719; cv=none; d=google.com; s=arc-20160816; b=dtfQQk7QwPLoclpWAFmKagM3ZFLTgT8Ad4YurY8cyDS3HthGqdRPgJgDnh1mCpplos MmOfEWgCHg1/1eSNYwAlhAyULTf5Etmcs/wvnl35kMBX0LTOrol28+1lvsvhfl3fiNVJ Md4IcAm7AL1hhye0LwuyTvqZzjhqUlUVrrYhdPhIuy1pK69h56/URSv2hhx8pa5jyngn VPOw7qzkiMNIf0V6/7bxDt1qLhFlucugRCEepbpe1tm198UupQQtVhyvyY5ml6LOD1MC Tnu9584Vc/t5MyGSPWo9z3XP2NtLcbDKFx42t6COAZhOHn38YKeWifJdnC2WcWP5QFL4 kTVw== 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=H/KERTKr/vbC9/8fjjkULR9adwaOwCvjKqHlfqp39Ls=; b=hjkbOK9KwCw+QbZ2Jp6Ki7zK3HDZf10uO/csf5OABbRtArlL2Rw+q0V3YpiBhf63mO t1dES/qGEGu331bKjGlnc3OZ+qPEuCB4gM1TP0XuBCCHDbJ/TmSJCLXh/yevRTzSs7yL vdaZ7WCG/oHpcgi+SQ41gOjZWstl6QfW/R6yy3v9WZG2DDQr+TMFESrcgzS7H87NmrQU I+sXS2BBWGdiRL/uVqhzKoTG5GLK2Z1zYM/hbeoMhdB2D8ZjJMlESIy5xdbSPIVIEvLo evARvHiQwgyxINuNckEkBtr9TeX7LprLWxQ1Ldq43MtDTI0Lw7rvNdZbsgbS5h6qahf2 EO6w== 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 nt13si13347823pjb.97.2021.10.14.18.18.27; Thu, 14 Oct 2021 18:18:39 -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 S233397AbhJNVkE (ORCPT + 99 others); Thu, 14 Oct 2021 17:40:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232180AbhJNVkD (ORCPT ); Thu, 14 Oct 2021 17:40:03 -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 A4CC7C061570; Thu, 14 Oct 2021 14:37:58 -0700 (PDT) Received: from localhost (unknown [IPv6:2804:14c:124:8a08::1007]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: krisman) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 1D8121F44F7E; Thu, 14 Oct 2021 22:37:56 +0100 (BST) From: Gabriel Krisman Bertazi To: jack@suse.com, amir73il@gmail.com Cc: djwong@kernel.org, tytso@mit.edu, dhowells@redhat.com, khazhy@google.com, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-api@vger.kernel.org, repnop@google.com, Gabriel Krisman Bertazi , kernel@collabora.com, Jan Kara Subject: [PATCH v7 08/28] fsnotify: Add helper to detect overflow_event Date: Thu, 14 Oct 2021 18:36:26 -0300 Message-Id: <20211014213646.1139469-9-krisman@collabora.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211014213646.1139469-1-krisman@collabora.com> References: <20211014213646.1139469-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 Reviewed-by: Jan Kara 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 4a5e555dc3d2..c42cf8fd7d79 100644 --- a/fs/notify/fanotify/fanotify.h +++ b/fs/notify/fanotify/fanotify.h @@ -315,7 +315,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 a2db821e8a8f..749bc85e1d1c 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h @@ -510,6 +510,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.33.0