Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp3638465rwl; Sun, 2 Apr 2023 11:48:48 -0700 (PDT) X-Google-Smtp-Source: AKy350ZdgtF2IsdxQnlJ1B86RhPNJPFNqwF2kxfKd7GuvkdRZzAdwGAIl+oanKcXs4ZA7J60DN/F X-Received: by 2002:a50:ff15:0:b0:4c0:9bd7:54cc with SMTP id a21-20020a50ff15000000b004c09bd754ccmr30017056edu.11.1680461328215; Sun, 02 Apr 2023 11:48:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680461328; cv=none; d=google.com; s=arc-20160816; b=z607tvi3szK+8uTmuXUQjT5z2HKqa5FD5WjxoSgAdpjvHHR4VAf7RQGcvlBN9oZ4DF K9Dxu7Uzi4V143YzduWq8pvSVGikbyFt7GTKYK4zijsUzkpGY3NHyuBfvGB21Bd0/c+r 7n+/NN81FcpD1Kcr4hNOJ/C40LpcR2jRkBV13M4qEtI/G8m/oz63fhdjrUMakdqr01dk BIkCJOnZ4YLLHghJkbEMA2tAfFAQOD7dHxk0Y2fX1e/E0yp7naKkRSeRRuBgGA/E0ESP vyS7c03yw1QN6jZTV57tE1DzVzv9db7Mu4UYr5HNHYDbG5y6kT6XXY12UKidJlPCccFD EDhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=YUW9fSfZ9WSxLfrodIgM+aOE7jHgfxvaZXXJmIaxf8g=; b=r6PG4Ye87RbsBxaqaxiSkcTcIMJIKzFQSAh6qwDL9i3muLq326M761fqxxAmXXDdwi XPug5bMw7lYYVmJe3Elkff8LfO+vhwGstQWp96Ua1a4YimxLtgDlUujMDTX6OYLkjWLf ZCct2fTI0zPQGcgtUAMkXqOgoCZl+5kH7NBCnHqzpv9/+UF6UhLhqy6Eq1qNgRL2S5vi 6ucpTxqHCvUc0nSiQfnV3hxXCkvHr2cj4F9aV52mNFkn3iPEbviISulVqqgqye+lSJUt 0RPX8M6ose01vFut9Pque7k1Rei/kH4zyxARHgO0rn6DlFOOMONxkHrnPAfWGMvzY5nI cs5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ptflmDGI; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r12-20020aa7da0c000000b004fd1f9d8256si3721582eds.208.2023.04.02.11.48.23; Sun, 02 Apr 2023 11:48:48 -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=@gmail.com header.s=20210112 header.b=ptflmDGI; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230498AbjDBSoF (ORCPT + 99 others); Sun, 2 Apr 2023 14:44:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231142AbjDBSnw (ORCPT ); Sun, 2 Apr 2023 14:43:52 -0400 Received: from mail-yw1-x112e.google.com (mail-yw1-x112e.google.com [IPv6:2607:f8b0:4864:20::112e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE6C01718; Sun, 2 Apr 2023 11:43:26 -0700 (PDT) Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-54184571389so513448597b3.4; Sun, 02 Apr 2023 11:43:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680461006; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=YUW9fSfZ9WSxLfrodIgM+aOE7jHgfxvaZXXJmIaxf8g=; b=ptflmDGIVSxSjntbxtd8TUNVb0kGjb1LlCnZnl5mMNzHc44nN8aepzjh1JDNfhVZvX vTDeOKs4E9J99oGfn9AXiN/EEXH8VS5kRcJtuNBiP3CfXHfgw3cMwz6/5yD1FxcsX4Ns 5jXnLG1MKqMt65DCJ4DjkV4FRvqiScI773Q4+SSECTuvRaiELHsD3E02JuysfpYmfGJN xba9OxlWSi6Cp+t9Yy0MTxXj+yDCTTD8IH4iZUSlqwqsulkOlAGznXClcPMiQIiiz256 IX0nesjbJQ6yF0OYfuAAYUoPLWNBbuskZYhpj/JBbAU396I/CXqqaacsI0NG4jPvPozx Zerw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680461006; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YUW9fSfZ9WSxLfrodIgM+aOE7jHgfxvaZXXJmIaxf8g=; b=ENVTUBSHHmODQQU+TsV/xGXTJ6FzJ5HeHRLWBswyXxV4tfvX9fxBOLv6Wo2buB6KF5 CMLO6Q1yYLw6KO4H/FLBj90tJU97ZZJLUkeBqVSStDm3TDCkVvGKv0ITIjnBCox6wiME mg42jhpK1kS7GzFUlUUyJdy7sQ6QSAqvvs0duWv3LgjnqpTXgyPJsdKyLDPf2tL2mLHn HSp/tHxCllFTvHx0Vl2Tff9ODV4iG5Zb2RF0KhvqHEmqYiw9wJrXhO/syEU/+8lCqcCE 7jH7O0ZyBQwI7+m5Oo2LqitgS1KgpWCOq1pI9JKjoA+Pkl96dYL5RvEeML1lrUh7NO0/ 7Yrg== X-Gm-Message-State: AAQBX9cHSLhHnfQaepdx9xy+j+QV/kQYIUyCFqkEoy4Yx3r7Tf4oslck wwR4FM0w9vbWrfecxRk5WbQSCfVCmxblFaUKx12YtwUk X-Received: by 2002:a81:b617:0:b0:541:7f69:aa8b with SMTP id u23-20020a81b617000000b005417f69aa8bmr16184588ywh.5.1680461005529; Sun, 02 Apr 2023 11:43:25 -0700 (PDT) MIME-Version: 1.0 References: <3443961.DhAEVoPbTG@silver> <5898218.pUKYPoVZaQ@silver> In-Reply-To: <5898218.pUKYPoVZaQ@silver> From: Eric Van Hensbergen Date: Sun, 2 Apr 2023 13:43:14 -0500 Message-ID: Subject: Re: [PATCH] fs/9p: Add new options to Documentation To: Christian Schoenebeck Cc: v9fs-developer@lists.sourceforge.net, asmadeus@codewreck.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Jeff Layton Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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 On Sun, Apr 2, 2023 at 9:07=E2=80=AFAM Christian Schoenebeck wrote: > > +CC: Jeff for experience on this caching issue with NFS ... > > On Tuesday, March 28, 2023 5:51:51 PM CEST Eric Van Hensbergen wrote: > > As I work through the documentation rework and to some extent the > > testing matrix -- I am reconsidering some choices and wanted to open > > up the discussion here. > > > > TLDR; I'm thinking of reworking the cache options before the merge > > window to keep things simple while setting up for some of the future > > options. > > Yeah, revising the 9p cache options highly makes sense! > > So what is the plan on this now? I saw you sent a new patch with the "old= " > options today? So is this one here deferred? > Yes - I decided to just bite the bullet and try and have a new approach to things that was less confusing and try and reduce the test matrix. Unfortunately, I was also switching over to trying to use b4 to manage these things and didn't see a way to relate the patch to the original one. I figured the increase in scope justified a new thread. > > While we have a bunch of new options, in practice I expect users to > > probably consolidate around three models: no caching, tight caches, > > and expiring caches with fscache being an orthogonal add-on to the > > last two. > > Actually as of today I don't know why somebody would want to use fscache > instead of loose. Does it actually make sense to keep fscache and if yes = why? > Persistent caches make sense in certain scenarios, it basically gives a way to lazy populate a local cache of the remote server. I wouldn't use it in qemu or a VM, but I'd definitely use it in cluster scenarios. Its also potentially useful for unstable connections -- but this is more challenging to deal with in 9p although solutions have been proposed in the past. > > The ultimate goal is to simplify the options based on expected use mode= ls: > > > > - cache=3D[ none, file, all ] (none is currently default) > > dir? > That was what I was originally going to do, but 'all' makes the inclusivity of file explicit. The more I thought about it, the less I saw a use case for caching meta data and not file data. Of course, in the new patch series I have a bit for meta-data (which is a bit more accurate than just saying dir) at least in the current implementation. However, if I did a shortcut, it probably would be all and not dir (there isn't one yet in the new patch as I'm holding off until I fix consistency for meta-data -- which is in progress and I think imperfect but closer than loose). And actually once we are convinced this is working, the shortcut for all may be better represented as 'default' (hopefully). > > - write_policy =3D [ *writethrough, writeback ] (writethrough would be = default) > > - cache_validate =3D [ never, *open, x (seconds) ] (cache_validate > > would default to open) > > Jeff came up with the point that NFS uses a slicing time window for NFS. = So > the question is, would it make sense to add an option x seconds that migh= t be > dropped soon anyway? > I had thought about that, and in fact in the new patch series I haven't implemented either yet. In the bitmask version I could used one of the reserved bits to specify adaptive timeouts like Jeff said NFS does and then the high bits to specify the base timeout or 0 if you never want to validate (current loose). Loose mode itself specifies look at the base timeout for how much temporal consistency to apply. Looking ahead at implementing this there is going to be ripple effects through the code, probably changing the way we use the cache_validity field in inode. But seems straightforward enough. > > - fscache > > > > So, mapping of existing (deprecated) legacy modes: > > - none (obvious) write_policy=3Dwritethrough > > - *readahead -> cache=3Dfile cache_validate_open write_policy=3Dwriteth= rough > > - mmap -> cache=3Dfile cache_validate=3Dopen write_policy=3Dwriteback > > Mmm, why is that "file"? To me "file" sounds like any access to files is > cached, whereas cache=3Dmmap just uses the cache if mmap() was called, no= t for > any other file access. > Well, not technically true -- because if the file is mmaped and it is accessed another way other than the mmap then we need to basically treat it as cached or we'll get inconsistencies between the mmap version and the uncached read/write version. So the code ends up using open-to-close file caching for everything. In any case, mmap was there for compatibility reasons before we had a non-loose caching option. With tight caches, its better to just incorporate mmap with it (given the above concerns on behavior). Otherwise we'd have to enforce a non-posix semantic of the only way to access an mmaped file is with mmap and force invalidations of others that might already have a file open when someonebody else mmaps it...would be messy. > > - loose -> cache=3Dall cache_validate=3Dnever write_policy=3Dwriteback > > - fscache -> cache=3Dall cache_validate=3Dnever write_policy=3Dwritebac= k & > > fscache enabled > > > > Some things I'm less certain of: cache_validation is probably an > > imperfect term as is using 'open' as one of the options, in this case > > I'm envisioning 'open' to mean open-to-close coherency for file > > caching (cache is only validated on open) and validation on lookup for > > dir-cache coherency (using qid.version). Specifying a number here > > expires existing caches and requires validation after a certain number > > of seconds (is that the right granularity)? > > Personally I would then really call it open-to-close or opentoclose and w= aste > some more characters in favour of clarity. > I had open2close in the new version and then reverted it to the inverse of loose because it made checking the bit pattern much easier. But the plan is for loose to cover no-consistency (when cache-timeout=3D=3D0, and temporal consistency when cache-timeout > 0, and then augment that with Jeff's suggestion of an adaptive bit). Perhaps the new loose shortcut will cover NFS-like semantics with a base-timeout of 5s and adaptivity bit set. -eric