Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp260620pxb; Thu, 12 Aug 2021 15:59:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAGMCeop6yxNo/BkLlrXGDJHUiBHQuzTJAFtytwXxkGFPimyaVCjcEJCtAglVUOgsRPerg X-Received: by 2002:a05:6638:f0e:: with SMTP id h14mr5794553jas.124.1628809169384; Thu, 12 Aug 2021 15:59:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628809169; cv=none; d=google.com; s=arc-20160816; b=XgT/CVOtUSWNmu7LDd2qshHy9sLc9bk9q3QPFwExMtlIXGIiMkRKZOaAKewreiF2j3 wrMx85XcloOTp56LmjgrELNv/ibyCR2FO9fKKaqkXNNZA2XCvifEKj5sp0KYQkhERIuM O5lqwUgHkz8QKZpVgcmMbj9ZdTgM8bYPCHuNNEwalJLqF2zj/5+zUHeE8pVeFN0BXw56 CPP7SJ/8fOO73fvKAaJsAwISiBS4BIAbbUhnHFSuAprlldq/336Bvqavn3EgZ18VU3c5 3mgq03d/SGJAvCNhC9/grm7jRFEzCKQbvOky059Gzd5dUvV3oFfR+gBQsCRKun3rS/bA fdhg== 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=S+QQKCTayOxXKP2V5qHsCwPKmRxC6cIyDiRrkQ1PkEo=; b=UCytPbPdkxGTQ2puGwihiH/9TjQjn+f2G95XOTgsRQWHJsKCIu2qabXrLkY+zMKT5W TIzyr+pwfe0v2rGwKize6gFYPcbYyp/iTyTGeOY3dEmIaSAcZ/U3461c28+xFWXLjgd3 s5pq7GaDfGYYyLEsyElBVJ+cU1g6/x/QyvQKZIwMkU3ISN7dLfDshEocl2lJkMws+d+Y GT5j05nkJ2LVIID/DLa9CwbXhELZ85h9+gwYkLjfT91PICLk2I4e6fIsiMZaEDjOsVCS 9QofQMXIoTiTxbA20H2gwMdx2OY9UVbkBHmHdP7ECdwjRpJrDRPbNBQZ7OCwDbDrrYpP voSg== 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 f16si4340595ile.51.2021.08.12.15.59.17; Thu, 12 Aug 2021 15:59:29 -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 S237270AbhHLVlV (ORCPT + 99 others); Thu, 12 Aug 2021 17:41:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237705AbhHLVlV (ORCPT ); Thu, 12 Aug 2021 17:41:21 -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 B01FFC061756; Thu, 12 Aug 2021 14:40:55 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id 5E80B1F44207 From: Gabriel Krisman Bertazi To: amir73il@gmail.com, jack@suse.com Cc: linux-api@vger.kernel.org, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, khazhy@google.com, dhowells@redhat.com, david@fromorbit.com, tytso@mit.edu, djwong@kernel.org, repnop@google.com, Gabriel Krisman Bertazi , kernel@collabora.com, Jan Kara Subject: [PATCH v6 07/21] fsnotify: Add helper to detect overflow_event Date: Thu, 12 Aug 2021 17:39:56 -0400 Message-Id: <20210812214010.3197279-8-krisman@collabora.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210812214010.3197279-1-krisman@collabora.com> References: <20210812214010.3197279-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 3b11dd03df59..b3ab620822c2 100644 --- a/fs/notify/fanotify/fanotify.h +++ b/fs/notify/fanotify/fanotify.h @@ -335,7 +335,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 ae1bd9f06808..cb75fb6d130a 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h @@ -506,6 +506,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