From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C95038B7D6; Fri, 27 Feb 2026 21:19:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772227189; cv=none; b=KMw8drzTMZ3vOH3ohpr8qcmKYPktLHblfZfjDmFKG/cNEQIxV/AMag9u/cFxveAL4BHDvjONNOaujfCmYD7ISU3GCsZ/qUwaeRtrjdeEBPxEg708iCyqCnM77S5RoszPJTLyMsvoOi8QnHwlUj62VjHnBMhAVjdJ/mf3oQEdBCk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772227189; c=relaxed/simple; bh=Kvs5P33YIXdgJf3Lcw25vKTvkt/GPz9KIPs0Cf5crxA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VDFU9wD7anwXVKnwMKEy4rZJXN+lFEK+AwK/KvkDEJvipt4hec5QIU3Mtg/Gjyv0mFofqNAYDck6nVhTB1uu2Ffx6/61xtiDKpAr1fFD1IvkoPZLGY/TEeY9mm6eim06L1O3ut8VV2F9c0urnSPPcukMXVWVSoz+aQKjTFJkDOc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=vJRc/doN; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="vJRc/doN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CC96C116C6; Fri, 27 Feb 2026 21:19:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772227188; bh=Kvs5P33YIXdgJf3Lcw25vKTvkt/GPz9KIPs0Cf5crxA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=vJRc/doN6phbnIWDai/y3CWyvsokFyCaqcmB304gJoKtKbEBMJTOSWloHulmUadaG fLkS9C7DmNUxzi9YYFLhkq0z+jaI0/sFQdNTuhcnTgofkE2qyp55hXJijxxSbeXZ+d AMjSM27vZXcY4LpqpMQ0s57DKM0DvWbN8yq7uuX5guuZbul8IXxV2YKatUHDWxb9YO 9HDyVHdBXDmIJKwl75bWcT+diUka8bNAA4AZSGcQsnlGlNU28Eim1vGSQADYD8toBc zg8PfPPBKREplTsXB1MHBW1rQRImel1oauXxCFiJ/RCxg2Jbej52BxvLPyo+n83Z9S u7jQdu1AZTBhQ== Date: Fri, 27 Feb 2026 13:19:46 -0800 From: Eric Biggers To: Christoph Hellwig Cc: "Theodore Y. Ts'o" , Jaegeuk Kim , Andreas Dilger , Chao Yu , Christian Brauner , "Darrick J. Wong" , linux-fscrypt@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 02/14] ext4: open code fscrypt_set_bio_crypt_ctx_bh Message-ID: <20260227211946.GB2659@quark> References: <20260226144954.142278-1-hch@lst.de> <20260226144954.142278-3-hch@lst.de> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260226144954.142278-3-hch@lst.de> On Thu, Feb 26, 2026 at 06:49:22AM -0800, Christoph Hellwig wrote: > io_submit_init_bio already has or can easily get at most information > needed to set the crypto context. Open code fscrypt_set_bio_crypt_ctx_bh > based on that. > > Signed-off-by: Christoph Hellwig > --- > fs/ext4/page-io.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c > index a3644d6cb65f..851d1267054a 100644 > --- a/fs/ext4/page-io.c > +++ b/fs/ext4/page-io.c > @@ -417,6 +417,7 @@ void ext4_io_submit_init(struct ext4_io_submit *io, > > static void io_submit_init_bio(struct ext4_io_submit *io, > struct inode *inode, > + struct folio *io_folio, > struct buffer_head *bh) > { > struct bio *bio; > @@ -426,7 +427,10 @@ static void io_submit_init_bio(struct ext4_io_submit *io, > * __GFP_DIRECT_RECLAIM is set, see comments for bio_alloc_bioset(). > */ > bio = bio_alloc(bh->b_bdev, BIO_MAX_VECS, REQ_OP_WRITE, GFP_NOIO); > - fscrypt_set_bio_crypt_ctx_bh(bio, bh, GFP_NOIO); > + fscrypt_set_bio_crypt_ctx(bio, inode, > + (folio_pos(io_folio) + bh_offset(bh)) >> > + inode->i_blkbits, > + GFP_NOIO); > bio->bi_iter.bi_sector = bh->b_blocknr * (bh->b_size >> 9); > bio->bi_end_io = ext4_end_bio; > bio->bi_private = ext4_get_io_end(io->io_end); > @@ -448,7 +452,7 @@ static void io_submit_add_bh(struct ext4_io_submit *io, > ext4_io_submit(io); > } > if (io->io_bio == NULL) > - io_submit_init_bio(io, inode, bh); > + io_submit_init_bio(io, inode, io_folio, bh); > if (!bio_add_folio(io->io_bio, io_folio, bh->b_size, bh_offset(bh))) > goto submit_and_retry; This should use 'folio', not 'io_folio'. folio_pos() works only for pagecache folios. - Eric 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 lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F3E671039895 for ; Fri, 27 Feb 2026 21:20:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type:Cc: Reply-To:From:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Subject:In-Reply-To:MIME-Version:References: Message-ID:To:Date:Sender:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=v2NB+CeCKaQ7haBdjv2oOsfWkjqbk/LXJrO6XbGr7Q8=; b=L5fi7dYtfy7ymc2Thq0Alb9Xvc RTPaHPMw0z6a0om4watONjRyET329IeIe+DDBa+DOtiJSl6e46mzowQW/7Fbv4Q3lxR1Gj3FxFE2g EX17y1SCfT6eFJhY0u/Mv/PonwQ2onzbNPxcORq4LlFKwj9nu6uqTFlrXrdmr3yTkoA0=; Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1vw5Fg-0005Cm-F0; Fri, 27 Feb 2026 21:20:01 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1vw5Ff-0005Bz-Eq for linux-f2fs-devel@lists.sourceforge.net; Fri, 27 Feb 2026 21:20:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; 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:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=MFrab5vb6a9/1fjQlnGw81bT7AUpJSZUb+9fm5X5Z88=; b=I4BgPJR2qtoacPvmd46eOKbvDL +WISE+OxB3iqOGd6rcjvd4cNmEAr3Us27C6mTDAy5KzgiKomEafdTy3mDmfIoDQPZ4gY7I4IvtwSG XaYGHYMcb6KAzp/LfoxEM+cB9/82+J6S0suQhBz06696sKO26+1rAjk8Q2xU2BjtBOdE=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; 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:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=MFrab5vb6a9/1fjQlnGw81bT7AUpJSZUb+9fm5X5Z88=; b=UFF87dEC4yKp1Rih/JBrkTr/iR MflX+PE+96xrbXUfXfD6317cEpZI1Ze88cRLZqZZ13SnEUqe28NsN4N/3JEH08m+H/7X5gNn3Gx6n 2zLDj2XSksoslx9ws6AWJObeGUlKLYWTdCqKrU/vtNjqDz7VCxtYgIO/MTgs9YMmW6iI=; Received: from tor.source.kernel.org ([172.105.4.254]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1vw5Ff-0005m7-Rs for linux-f2fs-devel@lists.sourceforge.net; Fri, 27 Feb 2026 21:20:00 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 354F760054; Fri, 27 Feb 2026 21:19:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CC96C116C6; Fri, 27 Feb 2026 21:19:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772227188; bh=Kvs5P33YIXdgJf3Lcw25vKTvkt/GPz9KIPs0Cf5crxA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=vJRc/doN6phbnIWDai/y3CWyvsokFyCaqcmB304gJoKtKbEBMJTOSWloHulmUadaG fLkS9C7DmNUxzi9YYFLhkq0z+jaI0/sFQdNTuhcnTgofkE2qyp55hXJijxxSbeXZ+d AMjSM27vZXcY4LpqpMQ0s57DKM0DvWbN8yq7uuX5guuZbul8IXxV2YKatUHDWxb9YO 9HDyVHdBXDmIJKwl75bWcT+diUka8bNAA4AZSGcQsnlGlNU28Eim1vGSQADYD8toBc zg8PfPPBKREplTsXB1MHBW1rQRImel1oauXxCFiJ/RCxg2Jbej52BxvLPyo+n83Z9S u7jQdu1AZTBhQ== Date: Fri, 27 Feb 2026 13:19:46 -0800 To: Christoph Hellwig Message-ID: <20260227211946.GB2659@quark> References: <20260226144954.142278-1-hch@lst.de> <20260226144954.142278-3-hch@lst.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20260226144954.142278-3-hch@lst.de> X-Headers-End: 1vw5Ff-0005m7-Rs Subject: Re: [f2fs-dev] [PATCH 02/14] ext4: open code fscrypt_set_bio_crypt_ctx_bh X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Eric Biggers via Linux-f2fs-devel Reply-To: Eric Biggers Cc: Christian Brauner , "Theodore Y. Ts'o" , "Darrick J. Wong" , linux-f2fs-devel@lists.sourceforge.net, linux-fscrypt@vger.kernel.org, Andreas Dilger , linux-fsdevel@vger.kernel.org, Jaegeuk Kim , linux-ext4@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On Thu, Feb 26, 2026 at 06:49:22AM -0800, Christoph Hellwig wrote: > io_submit_init_bio already has or can easily get at most information > needed to set the crypto context. Open code fscrypt_set_bio_crypt_ctx_bh > based on that. > > Signed-off-by: Christoph Hellwig > --- > fs/ext4/page-io.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c > index a3644d6cb65f..851d1267054a 100644 > --- a/fs/ext4/page-io.c > +++ b/fs/ext4/page-io.c > @@ -417,6 +417,7 @@ void ext4_io_submit_init(struct ext4_io_submit *io, > > static void io_submit_init_bio(struct ext4_io_submit *io, > struct inode *inode, > + struct folio *io_folio, > struct buffer_head *bh) > { > struct bio *bio; > @@ -426,7 +427,10 @@ static void io_submit_init_bio(struct ext4_io_submit *io, > * __GFP_DIRECT_RECLAIM is set, see comments for bio_alloc_bioset(). > */ > bio = bio_alloc(bh->b_bdev, BIO_MAX_VECS, REQ_OP_WRITE, GFP_NOIO); > - fscrypt_set_bio_crypt_ctx_bh(bio, bh, GFP_NOIO); > + fscrypt_set_bio_crypt_ctx(bio, inode, > + (folio_pos(io_folio) + bh_offset(bh)) >> > + inode->i_blkbits, > + GFP_NOIO); > bio->bi_iter.bi_sector = bh->b_blocknr * (bh->b_size >> 9); > bio->bi_end_io = ext4_end_bio; > bio->bi_private = ext4_get_io_end(io->io_end); > @@ -448,7 +452,7 @@ static void io_submit_add_bh(struct ext4_io_submit *io, > ext4_io_submit(io); > } > if (io->io_bio == NULL) > - io_submit_init_bio(io, inode, bh); > + io_submit_init_bio(io, inode, io_folio, bh); > if (!bio_add_folio(io->io_bio, io_folio, bh->b_size, bh_offset(bh))) > goto submit_and_retry; This should use 'folio', not 'io_folio'. folio_pos() works only for pagecache folios. - Eric _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel