Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2364214283 for ; Mon, 16 Oct 2023 06:20:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=none Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57CFA95; Sun, 15 Oct 2023 23:20:37 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id 31FF96732A; Mon, 16 Oct 2023 08:20:33 +0200 (CEST) Date: Mon, 16 Oct 2023 08:20:32 +0200 From: Christoph Hellwig To: Bart Van Assche Cc: Jens Axboe , linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, linux-fsdevel@vger.kernel.org, "Martin K . Petersen" , Christoph Hellwig , Niklas Cassel , Avri Altman , Bean Huo , Daejun Park , Jaegeuk Kim , Chao Yu , "Darrick J. Wong" , Alexander Viro , Christian Brauner Subject: Re: [PATCH v2 04/15] fs: Restore write hint support Message-ID: <20231016062032.GB26670@lst.de> References: <20231005194129.1882245-1-bvanassche@acm.org> <20231005194129.1882245-5-bvanassche@acm.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231005194129.1882245-5-bvanassche@acm.org> User-Agent: Mutt/1.5.17 (2007-11-01) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net On Thu, Oct 05, 2023 at 12:40:50PM -0700, Bart Van Assche wrote: > This patch reverts a small subset of commit c75e707fe1aa ("block: remove > the per-bio/request write hint"). The following functionality has been > restored: Please explain this in terms of what you add. The fact that it restores something isn't more than a little footnote added at the end. > --- /dev/null > +++ b/include/linux/fs-lifetime.h The name seems a bit odd for something that primarily deals with bios. bio-lifetime.h would seem like a better fit. > @@ -0,0 +1,20 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +#include > +#include > +#include > + > +static inline enum rw_hint bio_get_data_lifetime(struct bio *bio) > +{ > + /* +1 to map 0 onto WRITE_LIFE_NONE. */ > + return IOPRIO_PRIO_LIFETIME(bio->bi_ioprio) + 1; This seems a little to magic. Why not a lookup table? > +} > + > +static inline void bio_set_data_lifetime(struct bio *bio, enum rw_hint lifetime) Please avoid the overly long line. > + /* -1 to map WRITE_LIFE_NONE onto 0. */ > + if (lifetime != 0) > + lifetime--; > + WARN_ON_ONCE(lifetime & ~IOPRIO_LIFETIME_MASK); I'd return here instead of propagating the bogus value.