Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1050050pxb; Thu, 15 Apr 2021 12:40:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzf9o4SEaMOMWtb6fCgf2kdCEF7VdGJFk9Aw9XzJT9yVmQ34KcKJcNBHaWDswdsXiohr2F2 X-Received: by 2002:aa7:c442:: with SMTP id n2mr4139275edr.63.1618515635138; Thu, 15 Apr 2021 12:40:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618515635; cv=none; d=google.com; s=arc-20160816; b=qNzSCmWyS6dHu0ETgxq8vg0nV9PU1RyRM01zUFRwyeHKLxkSXqc/T2tBZKgYYaJ7mD L3liA+lE61okWEH/pw9aByJX6JVFqwQgwSvUdmjp97BdDjrQIcmWRyrEsQGck9ZLEUWz jqQx1Rc/srVDJtJHdoRIDZhQ4FOrontd/aseDPuK5kQP5OweNyNC8BbAWEK/d1s3OGHk LlcW+apZztOmBIRDaxQ/bxTm+b6GYQhzNdOB6ac7haccgiPNePaJfIpEphKG43j/Vd16 rJWd6YskmMnLlEQS5KzdDqtAdiESRA146LWEz8+0P6jgqpMmD8xurgoqY8deAYTKZzti ScUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=hMNsCp62qb+tCQwco9ZLKdMeg+i67Cbdjk21ai7nCA4=; b=ARj98w8MJ0yU8lbzvkBijLkBHnHaRl5uPvbRvOYQrhaiyMp7KEtMvi/NKrjPeCcE+5 nskMKU0Uh+Uyh68DSOzbUToCU82hp6ugabyvgVVgppMP4e6LIOy1VOc+HE6owcknkHCP Ihn6VrneVcTHSaSK+F80x4Wj2MRVvK60z1++e9QXa7WERFG/UATO7Z22DJXcs+q9aPRN nvg2IQRTVR0d2CfgptSqJt8H6TYMQElE3R5N5oBBECVwYG9g1eb3DsyQfSI3rHJ75SG1 8pDh8L+LhHiVTg2A9kl9kkbHbfWpPObmis8+44TTbJnWuPUajsD4Pjg79w7xQb3G/hWC d8Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HxEJhT3w; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kq9si3001930ejb.12.2021.04.15.12.40.11; Thu, 15 Apr 2021 12:40:35 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HxEJhT3w; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234836AbhDOTiL (ORCPT + 99 others); Thu, 15 Apr 2021 15:38:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:55696 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234764AbhDOTiK (ORCPT ); Thu, 15 Apr 2021 15:38:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 71DFD610EA; Thu, 15 Apr 2021 19:37:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618515466; bh=iFxKoIpB8LF2vixHh4l9NHUymegm1KVCMc7hNo9LDNU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HxEJhT3wHxtPJRtPkcZLSytTBrMJwU4bz2s6RNyUpCfD4XbwG6z0KJ/hK5uLx+jvQ 2/iGwdrzwFsJTw2O/xmgNNDnX3jQZuAyUSEI0szSzpJu0rXpUGRymKDuAAer7bVp0o RtbpOoAIw8OS7G55NJ+p+9ZYNpKkOxfKsSMJnB4l2Db7DiVB2ZgmcZnSN5om3ZPQWH FJatvkXUoBAoTulYHZRjFfd6RAUJIah3xCKpaG+ies41uBodBIEHjoMuTG3o1stWNa BE+L5Vz/35Bk2UK4fb5Iy8F9vTnn6Y23qRionnwytOKH9mViPp4yyyRNeFg2ZH+5Fc ffoSL99wv7adg== Date: Thu, 15 Apr 2021 12:37:44 -0700 From: Eric Biggers To: Christoph Hellwig Cc: Satya Tangirala , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Jens Axboe Subject: Re: [PATCH v2 4/8] block: introduce bio_required_sector_alignment() Message-ID: References: <20210325212609.492188-1-satyat@google.com> <20210325212609.492188-5-satyat@google.com> <20210330180653.GB811594@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210330180653.GB811594@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 30, 2021 at 07:06:53PM +0100, Christoph Hellwig wrote: > On Thu, Mar 25, 2021 at 09:26:05PM +0000, Satya Tangirala wrote: > > +/* > > + * The required sector alignment for a bio. The number of sectors in any bio > > + * that's constructed/split must be aligned to this value. > > + */ > > +static inline unsigned int bio_required_sector_alignment(struct bio *bio) > > +{ > > + struct request_queue *q = bio->bi_bdev->bd_disk->queue; > > + > > + return max(queue_logical_block_size(q) >> SECTOR_SHIFT, > > + blk_crypto_bio_sectors_alignment(bio)); > > +} > > It might make more sense to just have a field in the request queue > for the max alignment so that the fast path just looks at one field. > Then the various setup time functions would update it to the maximum > required. I don't see how that would work here, as the required alignment is a per-bio thing which depends on whether the bio has an encryption context or not, and (if it does) also the data_unit_size the submitter of the bio selected. We could just always assume the worst-case scenario, but that seems unnecessarily pessimistic? - Eric