Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3501146pxb; Mon, 18 Oct 2021 17:02:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7+IO6BQ4riUzZXW6ufC62eo++8TqlBUbwSInMSjEVTYZQ+sz+3D/nm21tQ22rZYJgb+jm X-Received: by 2002:a17:906:5a47:: with SMTP id my7mr32635299ejc.128.1634601749378; Mon, 18 Oct 2021 17:02:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634601749; cv=none; d=google.com; s=arc-20160816; b=AsRdRYK5RIc5y4dPqp9o6AoRwp/+qG+uDL6J8u4IbMc/WDnz9ReWH9gDaWST/tK73U IMFh3v519xIrGMCKQk34kw0hDWl5fIJUyWcSQoKSv2Ev42vzQQ3DQy3sVWxNV4RGlpcf 2PohKvdx9f7GHzgAiRpoCfHHB9FsYGGyDcgyaqdT8T4ImVazAt/tM7GyPAUllZ3HKyIN x0OuxTbCrjPG+0TfTMZmLgrdaG0R/BqBKv1yr0Y5vCdusMMq37x8npHQXcMA1ll80uKq 5oFI709QhxAicd5OUWNGfazZ7eh+xmndhWJkEF3NiNMSeLNOjXloVEWE796iyKBuidTp kCvQ== 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=ToDt9S1LA/1+YRriORCXHPi9Wx3TR8nVHQ9qCy5M2mS1sqVdmSWw0dOYFK+GRPwuZu Cu9KKRn8iWRhjqjtsN+cm/RxT/k0Hma2o5avTgVUgOlWI4+vf83tTlC0VWbnQQyE6A2v MbdLhwiv8NJenUWc9xqfvEfqwhR5x8iiWQYceXNuOzsgHaHPjEP441381hN4wXxBRfTw Sy9RYb/es4nqCD7uc7vD2JElz4+7HSAzTC+Z1vqMiImTjCvea0uB9R86uG0R+Q8jp2RZ o7gMb2PbU1GBdJoz66z/un9qwP+iaP6lqcyjRkzs5n0uQE/73j29MzNTxtcmCfhWzMUK vm5g== 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 o7si23716225edc.387.2021.10.18.17.02.06; Mon, 18 Oct 2021 17:02: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 S233815AbhJSADd (ORCPT + 99 others); Mon, 18 Oct 2021 20:03:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229529AbhJSADd (ORCPT ); Mon, 18 Oct 2021 20:03:33 -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 CD5C7C06161C; Mon, 18 Oct 2021 17:01:21 -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 4A7721F41A9C; Tue, 19 Oct 2021 01:01:20 +0100 (BST) 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 v8 08/32] fsnotify: Add helper to detect overflow_event Date: Mon, 18 Oct 2021 20:59:51 -0300 Message-Id: <20211019000015.1666608-9-krisman@collabora.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211019000015.1666608-1-krisman@collabora.com> References: <20211019000015.1666608-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