Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp53386rwl; Tue, 28 Mar 2023 20:45:26 -0700 (PDT) X-Google-Smtp-Source: AKy350bu2ZC3wFurWLlkWDkB/hxeQV2YZo7rs6g9tQYsYDY0f4n9TGf2eLcZMQ0ZqyFeSJS3G+7m X-Received: by 2002:aa7:c590:0:b0:4ac:b431:4762 with SMTP id g16-20020aa7c590000000b004acb4314762mr16317218edq.23.1680061526388; Tue, 28 Mar 2023 20:45:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680061526; cv=none; d=google.com; s=arc-20160816; b=fYPE1pcLrROzcg0SzgOyGEZuCnlrQotYJlawDnGWFrPxJ63xMiyq6Qg5ZC2dZURrXI APp1wE5+kNHg1hnZoyhJio245MB616oCiEREFNpaq7znaQcpnwCZJmBEcCFHIVY9cFif WUW00IkiUvTJdYQwPHe7FIKFu63LAO6cXgwVu0/opkVS2MbLMMSb0v2QzAFf2BYtYflS MPvTNd6SH9hBGW3s9zNRmcbF74+W21/+snzicqewcEaR1N0dwjFfH1AmCz6UNW6EMgrY eTPYdHN2GCX9DNge7Tv9Tv0E1wzlYU7rhFV9kyxoSlQriRZVV94+1IUY2ChFaACdrWGu jqVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id :dkim-signature; bh=4+TATKpiI/m1aX5zcJcBfi55zhCtiMGHrjCscJ6PomI=; b=obE3JxB5qJwa3hpwtVrNG9cB+OBLW95cC4VjvMAAP9k8YpZF0Nv0v8ECWCHmcKGtmo Fgfm3otsN1/walx4EAghtg/6TxLaxCJWtisn6usT/e8sg984/jI/lDG5nyD7VJ1K1htd EPU/MNI4knxHIUXoZgQwGrTDBHzd6Mz+thoYnZ6QPorXsgt580tFt7150zD1rfFH3zHs 3lExGN+7BnRFkYqeL/UuaetGUf+r77Bwg7rBSA7OsG6s9BTJbzyX4+kCBb3xItAkBx3t cyaVtzbb9hgZjI8bHSYEfqRdGUBajQAmq5UgipOK7e9gSluGKqj++UjZ72e1fBek6HMZ n3uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=FPQnW38S; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i16-20020a50fc10000000b004acc454abe7si32071546edr.260.2023.03.28.20.45.01; Tue, 28 Mar 2023 20:45:26 -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=@bytedance.com header.s=google header.b=FPQnW38S; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229570AbjC2DeF (ORCPT + 99 others); Tue, 28 Mar 2023 23:34:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbjC2DeE (ORCPT ); Tue, 28 Mar 2023 23:34:04 -0400 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7DEC212E for ; Tue, 28 Mar 2023 20:33:37 -0700 (PDT) Received: by mail-pl1-x633.google.com with SMTP id u10so13659826plz.7 for ; Tue, 28 Mar 2023 20:33:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1680060817; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=4+TATKpiI/m1aX5zcJcBfi55zhCtiMGHrjCscJ6PomI=; b=FPQnW38S34g0z1Q8kz48ty65k3Dmp9KRwwUAJ3ICuzTupops2Y0vhQPj8dbDjn9vKi iNDOhiAeln7aJ65JQ9U+d26Sd1cDXR2jOoVIv26/o1QGpr3sPDd9mqyPHJDEwAioixC5 CwcTzAdsTGmgzcytp/Ffm4OtWMpm/5vaZ6pzLNr54NaV5gTP4WZzh53gL4DV+sAKRa/v mAIfV2Xrma2bNgN1io+rzkRF515BrMN2C/avD8RajwuVyVRePzG7JIUxJk3Q65YqAtHV 2ZT93IG49MkUilPM+5/nCt1QvDqpj13u+mmZZYF+FqNSUNyZrGr1kHBl3y4CeCS5ZCdW hUmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680060817; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=4+TATKpiI/m1aX5zcJcBfi55zhCtiMGHrjCscJ6PomI=; b=tJjysckH4HdvYSgT68rknKHFzrTAli+kdVaTT58C0+aZg/h0CH4xpeuQch3U0wDFPX DUwWTzYWew5AdzWX0aN/Zvj7MZnFsqLoFcmYD7MpLaK38WSjwcULqmBr7QP8/YUp5dQi jERxolvV5UwU/8+cbSBuxlKsZ9TmuFLDI4VrOkDIsOvmQbfJa2diwbWx3M+V9/6mO8Jt qDRFvaEZe4zopFpfvoRU98hdrCYbyQDlT8XMjNJjKavUmjGfdrkIH0F4GnxprqvBGf7t bxWtq1jnVGfDAkmiOgNhpBw3b3bmBCaICVpZePlIZKLpkQr5QkVzR8Nj9b/7trqHWGWl gRDw== X-Gm-Message-State: AAQBX9esIl5IkVYnzFRmovpjrYb7im1gPGY9Y9SMafTY+gNvkHKsxbad zAojEm3CT41flvZ75dqZ1BxAtRHolkFbQrLU+yk= X-Received: by 2002:a17:903:743:b0:1a1:cd69:d301 with SMTP id kl3-20020a170903074300b001a1cd69d301mr15834742plb.68.1680060817286; Tue, 28 Mar 2023 20:33:37 -0700 (PDT) Received: from [10.3.144.50] ([61.213.176.7]) by smtp.gmail.com with ESMTPSA id k16-20020a63f010000000b004fbd021bad6sm20505062pgh.38.2023.03.28.20.33.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 28 Mar 2023 20:33:36 -0700 (PDT) Message-ID: Date: Wed, 29 Mar 2023 11:33:32 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: Re: [PATCH V4 1/5] cachefiles: introduce object ondemand state To: David Howells Cc: linux-cachefs@redhat.com, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Xin Yin , Jingbo Xu References: <20230111052515.53941-2-zhujia.zj@bytedance.com> <20230111052515.53941-1-zhujia.zj@bytedance.com> <131869.1680011531@warthog.procyon.org.uk> From: Jia Zhu In-Reply-To: <131869.1680011531@warthog.procyon.org.uk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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 Hi David, Thanks for reviewing. 在 2023/3/28 21:52, David Howells 写道: > Jia Zhu wrote: > >> +enum cachefiles_object_state { >> + CACHEFILES_ONDEMAND_OBJSTATE_close, /* Anonymous fd closed by daemon or initial state */ >> + CACHEFILES_ONDEMAND_OBJSTATE_open, /* Anonymous fd associated with object is available */ > > That looks weird. Maybe make them all-lowercase? I'll revise it in next version. > >> @@ -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 == CACHEFILES_ONDEMAND_OBJSTATE_##_state; \ >> +} \ >> + \ >> +static inline void \ >> +cachefiles_ondemand_set_object_##_state(struct cachefiles_object *object) \ >> +{ \ >> + object->state = 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 doesn't > save you that much and it means that "make TAGS" won't generate refs for those > functions and grep won't find them. Actually there is one more state will be introduced in patch3 and 30+ loc for repeated functions will be added if we drop the macro. Shall I keep using the macro or replace it? > David