Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp756913pxb; Fri, 15 Oct 2021 15:37:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJ1m01QaSmfw1W9Ax7uISv9N+BzLeREXnJ86RtlSN4FisaZPtFCCU8DZGIiLsw8gfaMu3K X-Received: by 2002:a50:e0cf:: with SMTP id j15mr22460457edl.23.1634337432024; Fri, 15 Oct 2021 15:37:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634337432; cv=none; d=google.com; s=arc-20160816; b=P8AeohAdDc1jTuOSiWqG0iZJEfq829tsftYC8KscTKOp/WOjOrcxgHTSTnnA6BBsT+ Yg2qBMEKKvMbo+NiBDUF19Zi1mchCUQFqhOs4Ak+A1+IbU/KiZb63PRdHk6AaD5RLnaE sQN0+BNBdWLE83Ju1xEikVHEzZTmyXmtjIX+QvV7l04ovG9a6UoIhvY7AUgilC/O74aa Ob8fSfn2VMPUh65JDQIQykxdBDATjm0QZLNHosPitje+vb2Tarlr5ye9mBd62f8FkBc0 ZMY+vkC6AC4Ge6ffeUMS+Mboch0vduDdnq+RZlNVu6THMt7zBJC9YwVch4SCJgq5cBQy Pszw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=U+m/PiqSjqM6L0ouRH5QqyV+d3D9qzy/OTI2OyQ5Vr0=; b=D1OeuCTJWkWOoD/kqsmigP0qCoIv582D7UTzVOCkFuTfNaPij5FXl2caDNGu+UCVLs 5tAzQofUp2byBlmSPHqiZC3T8FBV1fckWekrVdAy/h4Dj+351JUXsVwn98P9Mpc5COhW xZG5lGHWLzAFTRmXO0J4jdG9ZByfwJIe8gxUwzAN4avgT8MIcynFuCwJq/nQFZ8JvnLN b25jJO3jAk20aCI1SWxnKzwJzhjCbtKwet5O5CuvThagH82R+J5PamiustjgwUaRwiGR ZvnrR11VFd4LU8ehL05sbErBoZMevYGKuHC6eszAAPmfTiRmltmt9xhfrUlYpQEKOkvC kL0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=uNKQlLuk; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=3pjg1dRR; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hb10si11409229ejc.349.2021.10.15.15.36.39; Fri, 15 Oct 2021 15:37:12 -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; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=uNKQlLuk; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=3pjg1dRR; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233000AbhJOMpq (ORCPT + 99 others); Fri, 15 Oct 2021 08:45:46 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:55422 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229741AbhJOMpp (ORCPT ); Fri, 15 Oct 2021 08:45:45 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 3DF431FD39; Fri, 15 Oct 2021 12:43:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1634301818; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=U+m/PiqSjqM6L0ouRH5QqyV+d3D9qzy/OTI2OyQ5Vr0=; b=uNKQlLukDqxpvLSXBVBf+ex0/hpBW/SpLf3giVgOdlJ2T9+30VSh6MyUv+KX4XCCMe9Zum xPgcPFCWUerXL28WkUgXxQVOWfpLnAbuFwQ9tQBRKrnYElHtwgN6gCDVLxsesVjEWNk1sV r5/323uxf1Bhw8nK+wy859h6nkWTCjQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1634301818; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=U+m/PiqSjqM6L0ouRH5QqyV+d3D9qzy/OTI2OyQ5Vr0=; b=3pjg1dRR6MvZSvhYFBI5J8GulpF+um38dkY84ycKbshbLeIQTXcdRrwJTeNZ41XJjEBUFp +h/BVQVhjHcTPbBw== Received: from quack2.suse.cz (unknown [10.100.200.198]) by relay2.suse.de (Postfix) with ESMTP id 287AFA3B83; Fri, 15 Oct 2021 12:43:38 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id F39761E0A40; Fri, 15 Oct 2021 14:43:37 +0200 (CEST) Date: Fri, 15 Oct 2021 14:43:37 +0200 From: Jan Kara To: Gabriel Krisman Bertazi Cc: jack@suse.com, amir73il@gmail.com, djwong@kernel.org, tytso@mit.edu, dhowells@redhat.com, khazhy@google.com, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-api@vger.kernel.org, repnop@google.com, kernel@collabora.com Subject: Re: [PATCH v7 21/28] fanotify: Support merging of error events Message-ID: <20211015124337.GK23102@quack2.suse.cz> References: <20211014213646.1139469-1-krisman@collabora.com> <20211014213646.1139469-22-krisman@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211014213646.1139469-22-krisman@collabora.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Thu 14-10-21 18:36:39, Gabriel Krisman Bertazi wrote: > Error events (FAN_FS_ERROR) against the same file system can be merged > by simply iterating the error count. The hash is taken from the fsid, > without considering the FH. This means that only the first error object > is reported. > > Signed-off-by: Gabriel Krisman Bertazi ... > +static void fanotify_merge_error_event(struct fanotify_error_event *dest, > + struct fanotify_error_event *origin) > +{ > + dest->err_count++; > +} > + > +static void fanotify_merge_event(struct fanotify_event *dest, > + struct fanotify_event *origin) > +{ > + dest->mask |= origin->mask; > + > + if (origin->type == FANOTIFY_EVENT_TYPE_FS_ERROR) > + fanotify_merge_error_event(FANOTIFY_EE(dest), > + FANOTIFY_EE(origin)); > +} > + > /* Limit event merges to limit CPU overhead per event */ > #define FANOTIFY_MAX_MERGE_EVENTS 128 > > @@ -175,7 +204,7 @@ static int fanotify_merge(struct fsnotify_group *group, > if (++i > FANOTIFY_MAX_MERGE_EVENTS) > break; > if (fanotify_should_merge(old, new)) { > - old->mask |= new->mask; > + fanotify_merge_event(old, new); I guess no need for two functions (fanotify_merge_event(), fanotify_merge_error_event()) for three lines of code? I'd just put those three lines into fanotify_merge(). > @@ -591,6 +621,9 @@ static struct fanotify_event *fanotify_alloc_error_event( > return NULL; > > fee->fae.type = FANOTIFY_EVENT_TYPE_FS_ERROR; > + fee->err_count = 1; > + > + *hash ^= fanotify_hash_fsid(fsid); > > return &fee->fae; > } As Amir mentioned, you should set fsid here. Honza -- Jan Kara SUSE Labs, CR