Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4414107rwl; Tue, 28 Mar 2023 06:54:08 -0700 (PDT) X-Google-Smtp-Source: AKy350bgtBtH0toCny/QxHbC99+viHZPJ8MS81b5McRiXUXkQvGlh/UEvkurnAG5fzpanckYKec/ X-Received: by 2002:a17:907:3fa3:b0:93d:425a:b935 with SMTP id hr35-20020a1709073fa300b0093d425ab935mr19540886ejc.25.1680011648060; Tue, 28 Mar 2023 06:54:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680011648; cv=none; d=google.com; s=arc-20160816; b=DmVxVsoAxGGATkuby6TOtSq5hJ6IQHT8pxtigrer5b5G21VODVTDzJgsgqvzCYHuzC tFG2ynUGHjKHiJwJsGw9+3OdQqF7hTx1QyJI3kXZTapt6YXuRPtDPWIM+YQ/F+qKqyuV zRrZHFzED7hlqFSB0YpfBBuYQrcUW6nIzzKdQC2LKsxaC45Pjq+Mxzf9sp9YQD5eFFhz emN2IJszWyNhK4kVZqoRqUfeE4x0G5e8VVN0rl3lj2MQoJm2vdZgXhAYnCYSDgzpREMb kOTRtqjpSUs6EhN7UOASXufLuvAwgAi/0nXPvFX+EppCu0Gio9S9g+ieVDCOdG9JEYfv 1EeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:content-transfer-encoding :content-id:mime-version:subject:cc:to:references:in-reply-to:from :organization:dkim-signature; bh=0Bjk4mx3lBKFeadPQXueJB7h/c8lDuCBaVc1H5uzUP4=; b=HV6v7ziy61BzasnOqFV+1qNl3IquF2WyhVRPEb3DBKdjkg9tFT9UrrWaUowl3mWiMo vla1MhnJHcaeQGK4zErQAJYVOzVqOwV46E8652RXLCMpTJbjyKUz7Aq2UPn3gHtHPWfs BiaRVbkwnfq4jkRaGfW/7gZI0y7+XocXeSvqdWCl2zx4n/X8kLzdvxUAl8UvuXsIKFEy wYXXor9wOXwYFnK8le+ktKWVRR2paETTAzydXlYWy1Wx/SjlDO7Bn+b7ZqVzC4Rfra9o nFQGqlBi64DNK9/+fGOsVp1JGz3x3eR4r2miblk0xwvSLp++JrALVizI0RjMI0eB33OK EE7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Qmwpldc5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p10-20020a170906228a00b00924b50d1f25si32796567eja.353.2023.03.28.06.53.42; Tue, 28 Mar 2023 06:54:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Qmwpldc5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232134AbjC1NxB (ORCPT + 99 others); Tue, 28 Mar 2023 09:53:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232120AbjC1NxA (ORCPT ); Tue, 28 Mar 2023 09:53:00 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A15A4696 for ; Tue, 28 Mar 2023 06:52:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680011537; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0Bjk4mx3lBKFeadPQXueJB7h/c8lDuCBaVc1H5uzUP4=; b=Qmwpldc5BctCzG4vqNEeknc9px02/nZO9pamd4tajaeokuCO1+S14DLl4PJdnzBZ33p5z2 4Uf3AJkUUvzC77ejTSxRUZVwQfRP72IeH7zDXhKRnSkG7BlVagXMkEfpIMOnzK2JGm9eVL I5ZttBplkt4CS02xBY+N+eDZi+Kgm4s= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-587-gnJ2ogLqNoKHz6FfAC4XsA-1; Tue, 28 Mar 2023 09:52:14 -0400 X-MC-Unique: gnJ2ogLqNoKHz6FfAC4XsA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7A9C1855315; Tue, 28 Mar 2023 13:52:13 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E09614171BB; Tue, 28 Mar 2023 13:52:12 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20230111052515.53941-2-zhujia.zj@bytedance.com> References: <20230111052515.53941-2-zhujia.zj@bytedance.com> <20230111052515.53941-1-zhujia.zj@bytedance.com> To: Jia Zhu Cc: dhowells@redhat.com, linux-cachefs@redhat.com, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Xin Yin , Jingbo Xu Subject: Re: [PATCH V4 1/5] cachefiles: introduce object ondemand state MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <131868.1680011531.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Tue, 28 Mar 2023 14:52:11 +0100 Message-ID: <131869.1680011531@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jia Zhu wrote: > +enum cachefiles_object_state { > + CACHEFILES_ONDEMAND_OBJSTATE_close, /* Anonymous fd closed by daemon o= r initial state */ > + CACHEFILES_ONDEMAND_OBJSTATE_open, /* Anonymous fd associated with obj= ect is available */ That looks weird. Maybe make them all-lowercase? > @@ -296,6 +302,21 @@ extern void cachefiles_ondemand_clean_object(struct= cachefiles_object *object); > extern int cachefiles_ondemand_read(struct cachefiles_object *object, > loff_t pos, size_t len); > = > +#define CACHEFILES_OBJECT_STATE_FUNCS(_state) \ > +static inline bool \ > +cachefiles_ondemand_object_is_##_state(const struct cachefiles_object *= object) \ > +{ \ > + return object->state =3D=3D CACHEFILES_ONDEMAND_OBJSTATE_##_state; \ > +} \ > + \ > +static inline void \ > +cachefiles_ondemand_set_object_##_state(struct cachefiles_object *objec= t) \ > +{ \ > + object->state =3D CACHEFILES_ONDEMAND_OBJSTATE_##_state; \ > +} > + > +CACHEFILES_OBJECT_STATE_FUNCS(open); > +CACHEFILES_OBJECT_STATE_FUNCS(close); Or just get rid of the macroisation? If there are only two states, it doe= sn't save you that much and it means that "make TAGS" won't generate refs for t= hose functions and grep won't find them. David