Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2533524pxb; Mon, 18 Jan 2021 22:33:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJxPZJiUu52WUN9tw8jdrSfckEXwzrekt2vZRluWlgyeT24llZgu5RecXicmyIqbP49TQT2o X-Received: by 2002:a05:6402:2346:: with SMTP id r6mr2277540eda.8.1611038028173; Mon, 18 Jan 2021 22:33:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611038028; cv=none; d=google.com; s=arc-20160816; b=JERTWh/YyLy5h2PYpkUfnC+2W1X6cZ4ydhunmPf3GnBUNK7cMxWgedYPsE1xB+WBHc Shu9EAeIQ8c0Smf+1+CFwgUx40Nv+UMQNrLekIbadbn1uOTxhqeJEZOqCA/iOYLqreHp ++xlJtIr3p7xZPwcHXuI633LcQhkjOfSt3MIVit97S0hr4FpKNxOHhEjW7HdOL6fP7XU D5aErHnlCe6PHzgXptkl8keQCc3BXhKZ/hmRYkKSkpmdp/nXr20O/S5KiYVqFnOMEnlQ np+fwIm6c4l1+lEBs6C6NmmJ63IJHvEbijFh9Zjx5AShTlkTIc+Py0jWAsMiNeQt4QqN 5Nqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=BAViAhuejamTuAil0OJE9SfNsXfXeXTvnWQT7O9Bp6A=; b=LqsRgM9cdWvAle4PR0RA7dIfrQzsgYEATvYztXjWY0RQqR3SaJd/jN9cK94zIE6aA8 v04BCvgOol3gCoUc5hWott8ZyrLUy9DnUqG6uRreRUniKsc3oJ5VEoKYZUDfRKF1Yvot 8HP/pDjAm3fjOJT+Eq5UhtMWBw+NgOe/3h/zUagcE+EcR5tie8ZjX4zYVAp0B5nkqrqL G9/02B3mIvLDVj9G/J5X+sFZd1K+cRKqkUSHdROWKurM3yaYzMOWmuyaRH5dY4ROusp8 YjJqPnY1/RyPL+nUp1CW+JkyPsiu6eZEvBOVPPUbTwFISna4BpfuDJ/RWjncmO5sndKG AmXg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m7si8904101edq.123.2021.01.18.22.33.25; Mon, 18 Jan 2021 22:33:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730577AbhASGaz (ORCPT + 99 others); Tue, 19 Jan 2021 01:30:55 -0500 Received: from verein.lst.de ([213.95.11.211]:50786 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730092AbhASG2g (ORCPT ); Tue, 19 Jan 2021 01:28:36 -0500 Received: by verein.lst.de (Postfix, from userid 2407) id C863B6736F; Tue, 19 Jan 2021 07:27:53 +0100 (CET) Date: Tue, 19 Jan 2021 07:27:53 +0100 From: Christoph Hellwig To: Chaitanya Kulkarni Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, axboe@kernel.dk, Matthew Wilcox Subject: Re: [RFC PATCH 01/37] block: introduce bio_init_fields() helper Message-ID: <20210119062753.GA21413@lst.de> References: <20210119050631.57073-1-chaitanya.kulkarni@wdc.com> <20210119050631.57073-2-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210119050631.57073-2-chaitanya.kulkarni@wdc.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I don't think a helper just to initialize a few fields is very useful. But there is something in this area I've wanted to do for a while: > +static inline void bio_init_fields(struct bio *bio, struct block_device *bdev, > + sector_t sect, void *priv, > + bio_end_io_t *end_io, > + unsigned short prio, unsigned short whint) > +{ > + bio_set_dev(bio, bdev); > + bio->bi_iter.bi_sector = sect; > + bio->bi_private = priv; > + bio->bi_end_io = end_io; > + bio->bi_ioprio = prio; > + bio->bi_write_hint = whint; Ensuring that the device, sector and op are always initialized would really helper some of the bio mapping helpers, so I'd rather add a new struct bio *bio_new(struct block_device *bdev, sector_t sector, unsigned int op, unsigned int max_bvecs, gfp_t gfp_mask) helper, where max_bvecs is clamped to BIO_MAX_PAGES. bi_private, bi_end_io, bi_ioprio and bi_write_hint on the other hand are purely optional and can be easily set just by the users that care.