From nobody Sat Sep 24 19:20:13 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MZf3z5V2yz4dL6M; Sat, 24 Sep 2022 19:20:15 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-oa1-x2c.google.com (mail-oa1-x2c.google.com [IPv6:2001:4860:4864:20::2c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MZf3z51X1z3Yr9; Sat, 24 Sep 2022 19:20:15 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-11e9a7135easo4468892fac.6; Sat, 24 Sep 2022 12:20:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date; bh=Ryu80VD4NFM5pPBSyJYii9BV2SpGSijzsh+Ig63mjaU=; b=m0UZtZ2+VDPQ184V5rYG5LHY2kXLQzWaPCgyTkAIDrDN1siUQrbzrld4zbKJzxn9xb QgVjfw/+O6Tgi0LVTZqJRk2P7VSL3DNJYQ8DEwpt1Vo0CX41j3Y14B6y7D4CKKEFGOAY cA26ZOwuQeRQPIBsKnuJBB0A/X+T9CVlcogpXLfKgGIGrFbEXgWh2Bi9z5aueIGOk3+/ jNzNUpb4QNAmoL9xJ1+FOhKT2LaW8qtamoxWYMHfa7kLo7zZoCKvm8i+nfunvq2MJ5WD 5nhs3ZYx7NsnfHU87PYPGyWehqLXcvuYCbT9SUkkDrXilIjPtjb9CTGPS0d+AxOq/jHY QJ4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=Ryu80VD4NFM5pPBSyJYii9BV2SpGSijzsh+Ig63mjaU=; b=dikp9NYLTdBkcA9vaHjULlsOghvWHXBLfgqjjbGhn77vsMJh6tNeDdUymFPFVjtHs0 gv9LJzioNqK852lfEjmrAspMKDt9yPtnd+WBBWa5gc84q/UetbcBARLiCn76CYqDr7/4 75T3jUv0gI7PvDZcFJdbbnWL2EK5U3apbHrNnuqa6ExWhWlt7HlWhX8c2Wa0Q2WwPBcm zcU1kq+VahKtYtKhJy+zIhuLe619DdD+1aF0wfx1/HgH0PrTjJCwwapnExtL1/QKX9y+ PeoyGNXn4g34OHHwg4xjLavjXMNzWh65ijHAYbaKfJS+8Tem7YbpiIiTBT2gT2xrr1U+ Y2Qw== X-Gm-Message-State: ACrzQf0NWp81lE413NkZ6bcj94+auCpaNpCSqW5DSHIuQfwpBRVouWHd ZmpCq/o5pxFikL8O5RcJUmJH+PgLr6v7s/Cj8haa++6A X-Google-Smtp-Source: AMsMyM7mcv25UsBpbrhfEEPISpV83MdNBC5qH687w/RLAGPfT1S3IasHMZBHdQSZOBTVCZAzAV6JG4f5B/ZABhj4By4= X-Received: by 2002:a05:6870:f289:b0:12c:22bf:1535 with SMTP id u9-20020a056870f28900b0012c22bf1535mr8653902oap.228.1664047214735; Sat, 24 Sep 2022 12:20:14 -0700 (PDT) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Received: by 2002:a8a:352:0:b0:474:267f:5338 with HTTP; Sat, 24 Sep 2022 12:20:13 -0700 (PDT) In-Reply-To: References: <202209192009.28JK924f075123@gitrepo.freebsd.org> From: Mateusz Guzik Date: Sat, 24 Sep 2022 21:20:13 +0200 Message-ID: Subject: Re: git: 2c2ef670a79b - main - pseudofs: use the vget_prep/vget_finish idiom To: Benjamin Kaduk Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Rspamd-Queue-Id: 4MZf3z51X1z3Yr9 X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On 9/24/22, Benjamin Kaduk wrote: > On Thu, Sep 22, 2022 at 3:11 AM Mateusz Guzik wrote: > >> On 9/19/22, Benjamin Kaduk wrote: >> > On Mon, Sep 19, 2022 at 1:09 PM Mateusz Guzik wrote: >> > >> >> The branch main has been updated by mjg: >> >> >> >> URL: >> >> >> https://cgit.FreeBSD.org/src/commit/?id=2c2ef670a79b7f8fa84796a04885a3f76c914762 >> >> >> >> commit 2c2ef670a79b7f8fa84796a04885a3f76c914762 >> >> Author: Mateusz Guzik >> >> AuthorDate: 2022-09-19 20:07:10 +0000 >> >> Commit: Mateusz Guzik >> >> CommitDate: 2022-09-19 20:08:40 +0000 >> >> >> >> pseudofs: use the vget_prep/vget_finish idiom >> >> >> >> >> > >> > Picking an arbitrary commit to reply to: could you please add a bit >> > more >> > detail about the "why" to commit messages in the future? >> > Having looked a little bit, it seems that this would be "as part of the >> > broader effort to remove the vnode interlock [from a specific class of >> > operations?]". A pointer to a bigger-picture doc would be great as >> > well. >> >> The idiom at hand is over 3 years old now and employing it at this >> point should not require a justification. >> >> One can easily see not taking the interlock is faster both single- and >> multi-threaded, which makes the change worthwhile regardless of >> support for the flag in locking primitives going away or not. >> >> > Maybe you can easily see so, and maybe I can easily see so as well. > But it is not guaranteed to be the case for everyone looking at the commit > history. > The "what" of the commit is contained in the commit itself, but the "why" > can easily > be lost to the depths of time; that is why I see it as more important to > record in the commit > message. > The what is to employ an in idiom, it being an idiom should require no justification in the commit message. > Indeed, when I was left here to guess at the "why", I got it wrong! So is > it so hard to add > another sentence or even a clause like "an easy microoptimization" to the > commit message? > Having some hint at the "why" greatly improves the quality of the record > that is the commit. > What did you think it is? VI_LOCK + vhold disappear in favor of vget_prep, quick look inside shows there is no interlock taken whatsoever and that's how one finds out it gets avoided. Performance implications should be obvious from that point. The way I see it extra content in this case decreases the quality significantly. Anyone familiar with the idiom can comfortably skip this commit while browsing the history because the one liner indicates there is nothing more to it. Should extra sentences be present it would suggest something non-standard is going on and attention is required, when it is not. It's equivalent to adding comments like "/* free the buffer */" just prior to "free(buf);". Anyone not familiar with the idiom can quickly find out what it is. Explaining something like this every single time a change of the sort is made makes no sense to me whatsoever. > > > >> So happens I'm going to keep the flag support in vget itself for the time >> being. >> >> > I co-maintain an out-of-tree filesystem and commit messages like this >> make >> > it really hard for me to get a handle on whether I need to do anything >> and, >> > if so, where to start looking to find out what to do. An overall >> > project >> > page would be a great reference, or even comment around the >> implementations >> > that points to a key differential revision that implemented the core >> > behavior. One of the things that's been really nice about developing >> > for >> > the FreeBSD VFS in the past is how easy it is to determine what a >> > filesystem implementation needs to provide, and I'd love to see us >> continue >> > that tradition. >> > >> >> I'm definitely confused by this comment. VFS has rampant layering >> violations, including wtfs like filesystems sneaking in their own >> changes to cn_flags by literally or-ing into it mid-lookup (recently >> fixed, see 5b5b7e2ca2fa9a2418dd51749f4ef6f881ae7179) or leaking their >> internals out and consequently imposing completely unnecessary >> restrictions on the layer (see a comment above vput_final for an >> example). >> >> > > I did not say that the VFS itself was great to develop, but rather that my > experience as a filesystem author has been good ("develop for" vs "develop" > is > an unfortunately subtle distinction in English). I consider my point above > about > including "why" in the commit message to be far more important than this > part, > which was just an attempt to add some motivation as to why I personally > care. > Other people have other good reasons to want to include the "why" in the > commit > message, that I surely did not cover fully here. > I did understood you as claiming vfs is easy to develop for, but apparently my response did not come across as intended, so let me try again. I know for a fact a lot of non-ufs filesystem code was written by copy pasting from ufs and I would be surprised if afs was fundamentally different here. The VFS interfaces are poor quality and documentation is for the most part stale, misleading, straight up wrong or missing. To give you an example here a comment concerning recently retired SAVENAME flag: * SAVENAME may be set by either the callers of namei or by VOP_LOOKUP. True. * If the caller of namei sets the flag (for example execve wants to * know the name of the program that is being executed), then it must * free the buffer. If VOP_LOOKUP sets the flag, then the buffer must * be freed by either the commit routine or the VOP_ABORT routine. 1. VOP_ABORT does not exist 2. What's 'commit routine'? Is that something in the fs? I presume it's not the caller, since otherwise it would be referred to as such 3. all freeing was performed in callers, so the above is wrong about cases where the filesystem sneaks in the flag So no, I don't think there was enough info to write a working filesystem from scratch just by reading vfs docs/comments even prior to any of my VFS changes. What was needed was reading an existing implementation, like ufs. -- Mateusz Guzik