Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4681064pxv; Tue, 20 Jul 2021 09:12:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2VvsCy4cr0ZFu7U+5/fdJGuXw/fa1d5ygxbIMJ2vyKy5HVM8nVhlb6caynXjJZ1Fntq8L X-Received: by 2002:a05:6638:144f:: with SMTP id l15mr27246430jad.67.1626797543265; Tue, 20 Jul 2021 09:12:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626797543; cv=none; d=google.com; s=arc-20160816; b=j8SwOAjltuFZdZ1HpBkf5Y3kYMfRnfNAXdQ/H84UsJ7NnDlH4O6sGsCVkED90ZRGyz 1NZKPETN/ce9eqFqHkFt8FaKFN+MJH1Zimn04ZDdA15Zj54XLzGfzOEh+Z4GHlp/vGYj g5GNcTGY5R7pD+zs1YAVeXR9HfFdjLh0HXlgphne5oYcD1wts1MNCk+AZ16ss+3mLPTF Krk5D+xnzOhNMHg9T52+wG6Q0TOanY6IGJPFQMsLud5PUocJin1x3ba+foKO7KbGlfKr qNfQTos7UMLKFv6jJu2ECcxOoYvMpaw1hmUkkzGjVzM/zrVKOq7SjFDmRRnda272Qu5I U2JA== 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=HhWe29coVRtX9qi5avnzMllxMtY+v2hGRTP0X/02zCUAXKH+V+rrSRydXAXBMA/uTU H2JPeNI7jlz6s3+ryZlF0qI30NxYaX7BpphwVh/0F2Bfo7jr/8SnpML7nuBq4OpOe/AR TY4MT72kCaGMdCXGInVDsmvV9hyCa2K6lnq0kJHdYRCoQZ+NjZxT6PXEVCC8OthH2c+T PBKaidIJUuXXUNupaq69G+QndCTbI+5nDc4Ay0CtdIrVzGfxxbZRH0GonGv9Eh/0vBrn IB/0gekgeK+vyMqVnl95LOq7siD/3dI2k2T9R2yQKuUyCrUGI97LFW5RBolKPmMbloS3 3xmw== 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 n26si13018426jam.80.2021.07.20.09.12.10; Tue, 20 Jul 2021 09:12:23 -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 S236510AbhGTPbG (ORCPT + 99 others); Tue, 20 Jul 2021 11:31:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240510AbhGTPUm (ORCPT ); Tue, 20 Jul 2021 11:20:42 -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 9EA60C06178A; Tue, 20 Jul 2021 09:00:21 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id 473981F4312B 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, Gabriel Krisman Bertazi , kernel@collabora.com, Jan Kara Subject: [PATCH v4 07/16] fsnotify: Add helper to detect overflow_event Date: Tue, 20 Jul 2021 11:59:35 -0400 Message-Id: <20210720155944.1447086-8-krisman@collabora.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210720155944.1447086-1-krisman@collabora.com> References: <20210720155944.1447086-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