Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp208456pxt; Wed, 4 Aug 2021 09:08:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYL9/NTFbZNosHQlW19qSyv1AiEgl4NNKFmB0FK+GqhLPI1NfSHAe2A2hRZOlUgP7aBpBB X-Received: by 2002:a02:a797:: with SMTP id e23mr189716jaj.121.1628093327469; Wed, 04 Aug 2021 09:08:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628093327; cv=none; d=google.com; s=arc-20160816; b=I3libLlE3PvgPuul9jzoFJl87MDpz75+OhDhg45REYLJu7X3vaNVFZ7hJ51EdIUW5B ZzdOEPiyktKURwYOIoJ5J2g8ogRne62Jy4dO7oUwDhZsrfqkagnofHSsWgFG66M5D2+f yW8K3CNcs/aEnzFv0q1hmXDBkGsVtif63deD5W+eY+8QBCLhAi6NVSrDO8bHRh53l6vF Z0ltmxGiDBI/t636h2OvGuCsZqmAAAsiv7KesT1uur4RMKRywEkLXKF1bGVrwPkMatkT KohL67auQgH8gs3AQynVFjKWbrZCSZI1jwaMtobFnQxPvzXBKp1E4mrlSywWuo9BHaA1 qa9A== 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=w3AHJZS6koaakqC39qj9FLH6Q7SEcGvmQESSNAlwvMo=; b=mDc/WVoViXYxRzAKTt+Mc7QVspyevprxT6jbmnZ7aosCCSFoc5xeS1qVjtd7vHHLKD peJx0IiaqsNU8PLrtg7Wi1aZdwZnmqJSn+lgDwFatdoQ1QKRS+lioY41aq/dHjIbD9K4 3uafqCKF9z+Ds36UajkGCFxvoKSD7ERb7fpNTg9gyQv3WTjtOAOf9CU23DsUlBEV/PMu QlQWBzZvvWH+od0HCrjIyPtDQ97kuTWc+oMdJWQ/W9y3j9NIUPxUv5OCd21mgITqbf7z kq2MKqKxJW90GozuS9FBeJ6d0G8av5DEj6tDwpAUbBZJBn1r3BFhZzMrC37KMViX8xqI syNQ== 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 u16si2590397jat.19.2021.08.04.09.07.57; Wed, 04 Aug 2021 09:08:47 -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 S232305AbhHDQHc (ORCPT + 99 others); Wed, 4 Aug 2021 12:07:32 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:42018 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232614AbhHDQH3 (ORCPT ); Wed, 4 Aug 2021 12:07:29 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id 15DF81F4366A 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 Subject: [PATCH v5 12/23] fanotify: Expose helper to estimate file handle encoding length Date: Wed, 4 Aug 2021 12:06:01 -0400 Message-Id: <20210804160612.3575505-13-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 Superblock marks needs this when pre-allocating error events. Signed-off-by: Gabriel Krisman Bertazi --- fs/notify/fanotify/fanotify.c | 18 ------------------ fs/notify/fanotify/fanotify.h | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c index 538d114f439f..a015822e29d8 100644 --- a/fs/notify/fanotify/fanotify.c +++ b/fs/notify/fanotify/fanotify.c @@ -334,24 +334,6 @@ static u32 fanotify_group_event_mask(struct fsnotify_group *group, return test_mask & user_mask; } -/* - * Check size needed to encode fanotify_fh. - * - * Return size of encoded fh without fanotify_fh header. - * Return 0 on failure to encode. - */ -static int fanotify_encode_fh_len(struct inode *inode) -{ - int dwords = 0; - - if (!inode) - return 0; - - exportfs_encode_inode_fh(inode, NULL, &dwords, NULL); - - return dwords << 2; -} - /* * Encode fanotify_fh. * diff --git a/fs/notify/fanotify/fanotify.h b/fs/notify/fanotify/fanotify.h index d4a562c2619f..8061040f0348 100644 --- a/fs/notify/fanotify/fanotify.h +++ b/fs/notify/fanotify/fanotify.h @@ -348,3 +348,21 @@ static inline unsigned int fanotify_event_hash_bucket( { return event->hash & FANOTIFY_HTABLE_MASK; } + +/* + * Check size needed to encode fanotify_fh. + * + * Return size of encoded fh without fanotify_fh header. + * Return 0 on failure to encode. + */ +static inline int fanotify_encode_fh_len(struct inode *inode) +{ + int dwords = 0; + + if (!inode) + return 0; + + exportfs_encode_inode_fh(inode, NULL, &dwords, NULL); + + return dwords << 2; +} -- 2.32.0