Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp207794pxt; Wed, 4 Aug 2021 09:08:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzyyRoaQCAEleGGOa4Sn9kDC7QJXLwjcS7CO8/abzc9PNHD5fECBPt/rRr+a4i0WQTUlngx X-Received: by 2002:a05:6402:524b:: with SMTP id t11mr601969edd.330.1628093281048; Wed, 04 Aug 2021 09:08:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628093281; cv=none; d=google.com; s=arc-20160816; b=0jqEqpa01XKik/+nqzfILws+9cSPAd75P7domQF3PFTPgxTNMg3/vd2tfGNkBltUDC ezOpz5O5NZLAr/kQKdX0f0FBYgUXsTpVuP54priznhCX9h/TbfPXv8vt4kv9dRjtJlnR rSeHAh3nawwnOQzsfZUyRwkoTk9vKvwJIq4nVh5Q8xbUC7JiooSS9VIXsFQekVFEG1Pq aaegC0w965oZ8soIYOTOTO+GMxOgb/rLbOoJUWUf3AolZzGCKWNHDvUpvBFNohejbbGL yd8AYnDGeUHtAfLoSLDiMEwzpWjySdIUc2CvNjXb6aFj8JnrEAK/CdET+So1mz5fzjw9 qIXg== 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=LxgKPqf9SOxiUfxP5xXwZWvC0Ic0TgDa76oTAxiAwR4=; b=E2QgSw9Ho5pyKU6Fq3pEqM2mLIa2bG18XP+xoFNGsnFiEPczYsc5DU2d9Er175mqsW eKqyUi2rZAKqKi6kIU4Rtew9RVWYEOqqQBoEdQauulQdIWa1P33b7bfIe+CBuaz0v4DU 1ReG1pwX1XW1qLeCTmkHDtjAbsDeFk2k45/ctYppKF+khEv4Qko30p+y2Q9kS8AshPid qjF0hQJnEgskOdhafKq+24fFoifTVvJezS4epBakv1wHq/LY25zyLVhYJUtKpUSvierv Vy1ZdUvKKrY3d+igydcnM6hfaE8gCBaXX7wbsK5E7PfnfMqb2ObJftgOiieXJbdqzpi8 X1Eg== 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 z61si2841291ede.185.2021.08.04.09.07.36; Wed, 04 Aug 2021 09:08:01 -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 S231656AbhHDQHJ (ORCPT + 99 others); Wed, 4 Aug 2021 12:07:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231894AbhHDQHI (ORCPT ); Wed, 4 Aug 2021 12:07:08 -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 66EEEC0613D5; Wed, 4 Aug 2021 09:06:55 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id 0BC061F4080F From: Gabriel Krisman Bertazi To: jack@suse.com, amir73il@gmail.com Cc: djwong@kernel.org, tytso@mit.edu, david@fromorbit.com, dhowells@redhat.com, khazhy@google.com, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-api@vger.kernel.org, Gabriel Krisman Bertazi , kernel@collabora.com, Jan Kara Subject: [PATCH v5 07/23] fsnotify: Add helper to detect overflow_event Date: Wed, 4 Aug 2021 12:05:56 -0400 Message-Id: <20210804160612.3575505-8-krisman@collabora.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210804160612.3575505-1-krisman@collabora.com> References: <20210804160612.3575505-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 c548b96472dd..d4a562c2619f 100644 --- a/fs/notify/fanotify/fanotify.h +++ b/fs/notify/fanotify/fanotify.h @@ -338,7 +338,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 9d5586445c65..2b5fb9327a77 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h @@ -507,6 +507,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