Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1964548pxv; Sat, 24 Jul 2021 00:41:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeGfgUZErm6gu7GC270JsS+Mc6+JeEdYheG1as3ErOWAOUapXnuAwQ81WvqBlhm2Nbq6Zg X-Received: by 2002:a05:6402:2919:: with SMTP id ee25mr10169174edb.222.1627112489702; Sat, 24 Jul 2021 00:41:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627112489; cv=none; d=google.com; s=arc-20160816; b=W/0W1rrcwRIeLiiuqZIdhq6bcHb0z/U4sBcqeqjytRy78AEw6+j4SPcTNrPyXd6aAD gRh3NyIttwrwi64azFqgIDJya0QdnSa+gV/4JYp9WF22CKYtjrLwVqS/oHUVfSpwPuZ2 CYxBeTtPmPG7K5rZNayMepmo14wjxyqzV+9Xtwp8GhQefEwnCfyfCU8QN3WHoA0agEJR +0iuxWCtwEO/0Q+GjmzJvEO+S2uwHKrOC1F3zh5JF8vak8GVEZ39VswAY/DFNOpsMi4k CjwS7CK/IBXBqluZkZPuq+V7mjclT6EaMs3M7mgBsG74TecON87WQxPJDtMSUVXGrqYc i0DA== 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=FqhIgv8Rf1Zf62r3AOuw/s00sKaxHUe15ND2GKynq64=; b=lrFqk2yeNaZekwAEQXjX96vOpvMKwvaLJ60vpv6chPJ+W0luoJlMmcm2tdA5aQDfxv iafFfrCB+JKqIC5vj7iTUUjTtMQaq/nLwbK492aRep8bGaj8uUdt1/jeawDrgCrWdDSN k9B0cSzKoStAN05WcprTAyMUlZk8ZMsL7CRfMm6HIqRl4qY/+ZWuV9FkSefJcOQKnJ+i vOfiMObiVsDaVxwFt+RwiPhrAYmgPw8+T7Da2CwSBX7hEuHZbn9DBXxm/UcFcq2wqzez gSGmj4t+8k4tg1lWZJ/waA1bbGg677SSS1pYD7vC+g8vKg0KQW5MxXgYgGzGACasJWfY 6JkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=vNajFkx6; 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 hp8si36241596ejc.333.2021.07.24.00.40.58; Sat, 24 Jul 2021 00:41:29 -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=@infradead.org header.s=casper.20170209 header.b=vNajFkx6; 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 S234561AbhGXG4g (ORCPT + 99 others); Sat, 24 Jul 2021 02:56:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234524AbhGXG4g (ORCPT ); Sat, 24 Jul 2021 02:56:36 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E914C061575; Sat, 24 Jul 2021 00:37:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=FqhIgv8Rf1Zf62r3AOuw/s00sKaxHUe15ND2GKynq64=; b=vNajFkx6Jv5X4wPfPRaWpwo+np 1PcC/dhBP5n1scFWTkeTN3sxEekyaebs4tqMrK2kQK/+5IcXCc2TlRBQgrOFR7fnzhRN5bTpbRPll HCGIuyuj6fUPJJtWhc+aTKW69C+kWKnIn7oDy//pzoNjZ9va7NREzp12daD5c2LJYDkJwzJnqsrls ygMyZGIqlvsaQYNcMyk5Y/xeER+0iRHj3aQqXCyvKkTyIyxvAHDxmshOYjbl/uKB48Q/1ptJ3pRg0 YuRs6cgJ8+7b75UKnXL5FXp9e4Tj+s2Fhg0RLg7/HJSD7GzoEV9YAssT31rsdXaHo29BIyEzpOgbd AjLw7i/A==; Received: from hch by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m7CDM-00C5kP-Oi; Sat, 24 Jul 2021 07:36:57 +0000 Date: Sat, 24 Jul 2021 08:36:52 +0100 From: Christoph Hellwig To: Satya Tangirala Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Jens Axboe , Eric Biggers Subject: Re: [PATCH v4 0/9] ensure bios aren't split in middle of crypto data unit Message-ID: References: <20210707052943.3960-1-satyaprateek2357@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210707052943.3960-1-satyaprateek2357@gmail.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 06, 2021 at 10:29:34PM -0700, Satya Tangirala wrote: > When a bio has an encryption context, its size must be aligned to its > crypto data unit size. A bio must not be split in the middle of a data > unit. Currently, bios are split at logical block boundaries, but a crypto > data unit size might be larger than the logical block size - e.g. a machine > could be using fscrypt (which uses 4K crypto data units) with an eMMC block > device with inline encryption hardware that has a logical block size of 512 > bytes. > > Right now, the only user of blk-crypto is fscrypt (on ext4 and f2fs), which > (currently) only submits bios where the size of each segment is a multiple > of data_unit_size. That happens to avoid most of the cases where bios > could be split in the middle of a data unit. However, when support for > direct I/O on encrypted files is added, or when support for filesystem > metadata encryption is added, it will be possible for bios to have segment > lengths that are multiples of the logical block size, but not multiples of > the crypto data unit size. So the block layer needs to start handling this > case appropriately. I'm still not sold on this case yet. sector size aligned I/O is an optional feature, and I don't think it is worth this overhead. And while file systems metadata can be smaller than the file system block size in a few cases (e.g. XFS log writes), that is usually an extra performance optimization and can be trivially disabled in mkfs.