Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp785622pxv; Thu, 22 Jul 2021 12:05:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1gNy98+eyLYU4buWWYKLrLpP0zBCCjG3MFCfd8Mf+XGKiWHGLjB0PKmA2qcyhR2Fvy/lI X-Received: by 2002:a02:380b:: with SMTP id b11mr882566jaa.83.1626980740988; Thu, 22 Jul 2021 12:05:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626980740; cv=none; d=google.com; s=arc-20160816; b=gHpB0T8umSDE6Yn5K+y53ho+fLYu0heYtvP1Kp5LiQVmRXrk8x6jbaXOSRx8FChZRw nnNg0Fwsw815EMKYLViWm839uYZ0IsttePKcomvDh6Qak8YdNzEUgzzmwQyJKTrG6Snc EH2I1RQuFyJX118cLrLmiRv4rpVYo8dGvh63CPLb7GZSWbBlG6MfOozUmaiFPW25Hl1t 08OA2WJVqB+BwE0LWcdzPlLf5xQI5apvKRqKE1ZMU3jXiB6zGiWZTmv7FhQFVT64Z52c urzhUzh4Dzlv2QndOzdesJLGaZuoCBoAvdFUmvE5d2Xl34LOyid3o4H9TV3S4q7O7I9F JsTg== 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=QH69JZ0ro/6mMHp3t6fa0UGYS8OLDRprIsAx0T8NAgY=; b=p7tsqFMQTXlLloTt6rFh472cWP9VTv/3E5231Pene2AL46tI+UEjF4CXSnLiYQ/KKx fMdZoGw8a8KRnTDN9kkjPqkyikveuLJeJQXKe9eTHx8Jfh3WL3M8p5Ppedk9R4EpBs88 fs9M0PJxUMFj3JMLtlFFGwLGiB6pXYZOiguhrYQM00o7kfnH6AzXhoD3RLkkwH+E0l66 dvl8lC3/wltMZdHOovQ66/nq00WlTe6PRNplxe8eukdNcrbCgzVDDOgbUu0eNeBkFfTn TP9fAaMSZqkT3Cfie2CvuxKLEljmm+0aEZvbS5dZ05tyVqnAxoYTXlI7jL9Qumyc7EC4 Pc+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QilYXNDA; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-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 r8si8267634jar.122.2021.07.22.12.05.24; Thu, 22 Jul 2021 12:05:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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=QilYXNDA; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-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 S229967AbhGVSYP (ORCPT + 99 others); Thu, 22 Jul 2021 14:24:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:50118 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbhGVSYP (ORCPT ); Thu, 22 Jul 2021 14:24:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9748D60EB9; Thu, 22 Jul 2021 19:04:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626980689; bh=oWDsz2mqAq9NcEEh1BJyznZQCPm+facoTqPnYlRRhJQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QilYXNDAdzMfF+frM57wtEsK8q1xBhGM/Fw6ySzsoC5LukRf2pi9r343XIPOGGjhw inNMRBNKyr2+WCSrrUv7uZJuoNSJm64GbfIJc7Nquu2D6EMLTWmWw7Xcm69xxwN3em MyoZQsSMilN6DlmympazHrgl3V3HkOqFgjlkpozftLq0ixlYnwg7iEVqAdfLcbBwTk ZW76MEHP/kBQ047J1PXSwSXqVmaV5PZ0ohUOezoWPe17OJPGuQKeNSN8UQV9MkpcKg zqijpJkmcGOjHCLVgEUIRAlnaOnsquR9/cTWbypuBNqFkKdQ78gVo4VnpOSwqM3DnS zmr2Bt9gIvk1A== Date: Thu, 22 Jul 2021 12:04:49 -0700 From: "Darrick J. Wong" To: Satya Tangirala Cc: "Theodore Y . Ts'o" , Jaegeuk Kim , Eric Biggers , Chao Yu , Jens Axboe , "Darrick J . Wong" , linux-kernel@vger.kernel.org, linux-fscrypt@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, linux-block@vger.kernel.org, linux-ext4@vger.kernel.org, Eric Biggers Subject: Re: [PATCH v9 6/9] iomap: support direct I/O with fscrypt using blk-crypto Message-ID: <20210722190449.GH559212@magnolia> References: <20210604210908.2105870-1-satyat@google.com> <20210604210908.2105870-7-satyat@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210604210908.2105870-7-satyat@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Fri, Jun 04, 2021 at 09:09:05PM +0000, Satya Tangirala wrote: > From: Eric Biggers > > Set bio crypt contexts on bios by calling into fscrypt when required. > No DUN contiguity checks are done - callers are expected to set up the > iomap correctly to ensure that each bio submitted by iomap will not have > blocks with incontiguous DUNs by calling fscrypt_limit_io_blocks() > appropriately. > > Signed-off-by: Eric Biggers > Co-developed-by: Satya Tangirala > Signed-off-by: Satya Tangirala Looks like a straightforward conversion... Acked-by: Darrick J. Wong --D > --- > fs/iomap/direct-io.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c > index 9398b8c31323..1c825deb36a9 100644 > --- a/fs/iomap/direct-io.c > +++ b/fs/iomap/direct-io.c > @@ -6,6 +6,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -185,11 +186,14 @@ static void > iomap_dio_zero(struct iomap_dio *dio, struct iomap *iomap, loff_t pos, > unsigned len) > { > + struct inode *inode = file_inode(dio->iocb->ki_filp); > struct page *page = ZERO_PAGE(0); > int flags = REQ_SYNC | REQ_IDLE; > struct bio *bio; > > bio = bio_alloc(GFP_KERNEL, 1); > + fscrypt_set_bio_crypt_ctx(bio, inode, pos >> inode->i_blkbits, > + GFP_KERNEL); > bio_set_dev(bio, iomap->bdev); > bio->bi_iter.bi_sector = iomap_sector(iomap, pos); > bio->bi_private = dio; > @@ -306,6 +310,8 @@ iomap_dio_bio_actor(struct inode *inode, loff_t pos, loff_t length, > } > > bio = bio_alloc(GFP_KERNEL, nr_pages); > + fscrypt_set_bio_crypt_ctx(bio, inode, pos >> inode->i_blkbits, > + GFP_KERNEL); > bio_set_dev(bio, iomap->bdev); > bio->bi_iter.bi_sector = iomap_sector(iomap, pos); > bio->bi_write_hint = dio->iocb->ki_hint; > -- > 2.32.0.rc1.229.g3e70b5a671-goog >