From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E231C4332F for ; Thu, 9 Nov 2023 15:13:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231586AbjKIPNu (ORCPT ); Thu, 9 Nov 2023 10:13:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229570AbjKIPNt (ORCPT ); Thu, 9 Nov 2023 10:13:49 -0500 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A17CF18B; Thu, 9 Nov 2023 07:13:47 -0800 (PST) Received: by verein.lst.de (Postfix, from userid 2407) id 9B40967373; Thu, 9 Nov 2023 16:13:43 +0100 (CET) Date: Thu, 9 Nov 2023 16:13:43 +0100 From: Christoph Hellwig To: John Garry Cc: axboe@kernel.dk, kbusch@kernel.org, hch@lst.de, sagi@grimberg.me, jejb@linux.ibm.com, martin.petersen@oracle.com, djwong@kernel.org, viro@zeniv.linux.org.uk, brauner@kernel.org, chandan.babu@oracle.com, dchinner@redhat.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, tytso@mit.edu, jbongio@google.com, linux-api@vger.kernel.org Subject: Re: [PATCH 02/21] block: Limit atomic writes according to bio and queue limits Message-ID: <20231109151343.GB32432@lst.de> References: <20230929102726.2985188-1-john.g.garry@oracle.com> <20230929102726.2985188-3-john.g.garry@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230929102726.2985188-3-john.g.garry@oracle.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org On Fri, Sep 29, 2023 at 10:27:07AM +0000, John Garry wrote: > We rely the block layer always being able to send a bio of size > atomic_write_unit_max without being required to split it due to request > queue or other bio limits. > > A bio may contain min(BIO_MAX_VECS, limits->max_segments) vectors, > and each vector is at worst case the device logical block size from > direct IO alignment requirement. A bio can have more than BIO_MAX_VECS if you use bio_init. > +static unsigned int blk_queue_max_guaranteed_bio_size_sectors( > + struct request_queue *q) > +{ > + struct queue_limits *limits = &q->limits; > + unsigned int max_segments = min_t(unsigned int, BIO_MAX_VECS, > + limits->max_segments); > + /* Limit according to dev sector size as we only support direct-io */ Who is "we", and how tells the caller to only ever use direct I/O? And how would a type of userspace I/O even matter for low-level block code. What if I wanted to use this for file system metadata?