From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 C65FF27CCE0; Sun, 5 Jul 2026 19:48:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783280884; cv=none; b=dmE9fOxGkeG+XNzTMz+FQ+QCso7Usw6Qw4OTi+tpTM2HmuVeuhVQGIMACOpaQdVA8cI3/PztBzADo7dv9Fokfk73gDHzKo4I/48eOFXmOenOgeu1RmDmgIrNHlY/gpRkd2PsgwiKriE3ugMyFBjRCxqsX2fBIbEBY/s8gbp6T/k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783280884; c=relaxed/simple; bh=9UWeoV8bJAFtFSkviChfiaJewPRoc+VT1ubChxpvI0Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JWk1s6GXU+y7/xHzMecIFMNtIFnwYw5/Qf1BFqU/Ys/i00VRqHqfbwuV/+un0+c8rWCjk+/UZ+FnEnqSGoOUzoDzFHrG1ECMVcMNG08ScrT30Fvvi70/Xw/R2kP1nx6SqzRhH83kEF3Fl2xPD/ucKWcJpCsU+mHNRUPlHoNS0gE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=i4pw4Myk; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="i4pw4Myk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 700CD1F00A3A; Sun, 5 Jul 2026 19:47:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1783280879; bh=xHn7nWJIEjtZGVKLUuKxbe6auJkmuo4ttsUoVDB6jng=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=i4pw4MykTh3baKxXF5+8MOvAdZcKs+te6RQm/uQCm95u7VIfyJ+VL8YcZVMLFlMej ws2KlkY8KUaC4z1RpUVt3nK6QiULR+t7YamE1RcrltnpU7ggzP9kRIlj8qMQ4ahyjl oqJebufz7dXPWnGf7YiEXCu6b5VtF7G7g+YrVFHhIJ1JC8XHzd/XRWmFGlHjjZaBT8 se7tX7emU8lN0cCv0LsurF2/vHEio0yQavtFLBAhfjdEQKaOvrvP3MJMakGVHlZ3MC HkZCwd1dzI4RvGbjPiQnmD43zPlU/FlaRAa6/uKUO8YXqoislIvGZVHL+flwuX7liA 5c671vEVDoScA== From: Eric Biggers To: linux-fscrypt@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, Christoph Hellwig , Theodore Ts'o , Andreas Dilger , Baokun Li , Jan Kara , Ojaswin Mujoo , Ritesh Harjani , Zhang Yi , Jaegeuk Kim , Chao Yu , Eric Biggers Subject: [PATCH v2 09/17] ext4: Further de-generalize the bio postprocessing code Date: Sun, 5 Jul 2026 12:45:46 -0700 Message-ID: <20260705194555.75030-10-ebiggers@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260705194555.75030-1-ebiggers@kernel.org> References: <20260705194555.75030-1-ebiggers@kernel.org> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Since the bio postprocessing code in fs/ext4/readpage.c is now used only for fsverity, rename things accordingly. Also: - Don't create the caches at all when !CONFIG_FS_VERITY. - Remove the unused inode argument from ext4_set_verity_work(). Signed-off-by: Eric Biggers --- fs/ext4/ext4.h | 4 +-- fs/ext4/readpage.c | 65 ++++++++++++++++++++++------------------------ fs/ext4/super.c | 6 ++--- 3 files changed, 36 insertions(+), 39 deletions(-) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 920a8ec1b948..489ed6dcee52 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -3829,8 +3829,8 @@ static inline void ext4_set_de_type(struct super_block *sb, /* readpages.c */ int ext4_read_folio(struct file *file, struct folio *folio); void ext4_readahead(struct readahead_control *rac); -extern int __init ext4_init_post_read_processing(void); -extern void ext4_exit_post_read_processing(void); +int __init ext4_init_verity_caches(void); +void ext4_exit_verity_caches(void); /* symlink.c */ extern const struct inode_operations ext4_encrypted_symlink_inode_operations; diff --git a/fs/ext4/readpage.c b/fs/ext4/readpage.c index 8af183798a33..c7b6cdb2e124 100644 --- a/fs/ext4/readpage.c +++ b/fs/ext4/readpage.c @@ -47,12 +47,12 @@ #include "ext4.h" #include -#define NUM_PREALLOC_POST_READ_CTXS 128 +#define NUM_VERITY_WORKS 128 -static struct kmem_cache *bio_post_read_ctx_cache; -static mempool_t *bio_post_read_ctx_pool; +static struct kmem_cache *ext4_verity_work_cache; +static mempool_t *ext4_verity_work_pool; -struct bio_post_read_ctx { +struct ext4_verity_work { struct bio *bio; struct fsverity_info *vi; struct work_struct work; @@ -65,22 +65,22 @@ static void __read_end_io(struct bio *bio) bio_for_each_folio_all(fi, bio) folio_end_read(fi.folio, bio->bi_status == 0); if (bio->bi_private) - mempool_free(bio->bi_private, bio_post_read_ctx_pool); + mempool_free(bio->bi_private, ext4_verity_work_pool); bio_put(bio); } static void verity_work(struct work_struct *work) { - struct bio_post_read_ctx *ctx = - container_of(work, struct bio_post_read_ctx, work); + struct ext4_verity_work *ctx = + container_of(work, struct ext4_verity_work, work); struct bio *bio = ctx->bio; struct fsverity_info *vi = ctx->vi; /* - * Free the bio_post_read_ctx right away, since it's no longer needed. + * Free the ext4_verity_work right away, since it's no longer needed. * This relieves the pressure on the mempool as much as possible. */ - mempool_free(ctx, bio_post_read_ctx_pool); + mempool_free(ctx, ext4_verity_work_pool); bio->bi_private = NULL; fsverity_verify_bio(vi, bio); @@ -88,12 +88,6 @@ static void verity_work(struct work_struct *work) __read_end_io(bio); } -static bool bio_post_read_required(struct bio *bio) -{ - return IS_ENABLED(CONFIG_FS_VERITY) && bio->bi_private && - !bio->bi_status; -} - /* * I/O completion handler for multipage BIOs. * @@ -108,8 +102,9 @@ static bool bio_post_read_required(struct bio *bio) */ static void mpage_end_io(struct bio *bio) { - if (bio_post_read_required(bio)) { - struct bio_post_read_ctx *ctx = bio->bi_private; + if (IS_ENABLED(CONFIG_FS_VERITY) && bio->bi_private && + !bio->bi_status) { + struct ext4_verity_work *ctx = bio->bi_private; INIT_WORK(&ctx->work, verity_work); fsverity_enqueue_verify_work(&ctx->work); @@ -118,14 +113,12 @@ static void mpage_end_io(struct bio *bio) __read_end_io(bio); } -static void ext4_set_bio_post_read_ctx(struct bio *bio, - const struct inode *inode, - struct fsverity_info *vi) +static void ext4_set_verity_work(struct bio *bio, struct fsverity_info *vi) { if (vi) { /* Due to the mempool, this never fails. */ - struct bio_post_read_ctx *ctx = - mempool_alloc(bio_post_read_ctx_pool, GFP_NOFS); + struct ext4_verity_work *ctx = + mempool_alloc(ext4_verity_work_pool, GFP_NOFS); ctx->bio = bio; ctx->vi = vi; @@ -289,7 +282,7 @@ static int ext4_mpage_readpages(struct inode *inode, struct fsverity_info *vi, bio = bio_alloc(bdev, bio_max_segs(nr_pages), REQ_OP_READ, GFP_KERNEL); fscrypt_set_bio_crypt_ctx(bio, inode, pos, GFP_KERNEL); - ext4_set_bio_post_read_ctx(bio, inode, vi); + ext4_set_verity_work(bio, vi); bio->bi_iter.bi_sector = first_block << (blkbits - 9); bio->bi_end_io = mpage_end_io; if (rac) @@ -363,27 +356,31 @@ void ext4_readahead(struct readahead_control *rac) ext4_mpage_readpages(inode, vi, rac, NULL); } -int __init ext4_init_post_read_processing(void) +int __init ext4_init_verity_caches(void) { - bio_post_read_ctx_cache = KMEM_CACHE(bio_post_read_ctx, SLAB_RECLAIM_ACCOUNT); + if (!IS_ENABLED(CONFIG_FS_VERITY)) + return 0; + ext4_verity_work_cache = + KMEM_CACHE(ext4_verity_work, SLAB_RECLAIM_ACCOUNT); - if (!bio_post_read_ctx_cache) + if (!ext4_verity_work_cache) goto fail; - bio_post_read_ctx_pool = - mempool_create_slab_pool(NUM_PREALLOC_POST_READ_CTXS, - bio_post_read_ctx_cache); - if (!bio_post_read_ctx_pool) + ext4_verity_work_pool = mempool_create_slab_pool( + NUM_VERITY_WORKS, ext4_verity_work_cache); + if (!ext4_verity_work_pool) goto fail_free_cache; return 0; fail_free_cache: - kmem_cache_destroy(bio_post_read_ctx_cache); + kmem_cache_destroy(ext4_verity_work_cache); fail: return -ENOMEM; } -void ext4_exit_post_read_processing(void) +void ext4_exit_verity_caches(void) { - mempool_destroy(bio_post_read_ctx_pool); - kmem_cache_destroy(bio_post_read_ctx_cache); + if (!IS_ENABLED(CONFIG_FS_VERITY)) + return; + mempool_destroy(ext4_verity_work_pool); + kmem_cache_destroy(ext4_verity_work_cache); } diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 245f67d10ded..cb9ca0dc4664 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -7531,7 +7531,7 @@ static int __init ext4_init_fs(void) if (err) goto out7; - err = ext4_init_post_read_processing(); + err = ext4_init_verity_caches(); if (err) goto out6; @@ -7580,7 +7580,7 @@ static int __init ext4_init_fs(void) out4: ext4_exit_pageio(); out5: - ext4_exit_post_read_processing(); + ext4_exit_verity_caches(); out6: ext4_exit_pending(); out7: @@ -7601,7 +7601,7 @@ static void __exit ext4_exit_fs(void) ext4_exit_sysfs(); ext4_exit_system_zone(); ext4_exit_pageio(); - ext4_exit_post_read_processing(); + ext4_exit_verity_caches(); ext4_exit_es(); ext4_exit_pending(); } -- 2.54.0 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 4A83AC43458 for ; Sun, 5 Jul 2026 19:48:14 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:To:Sender:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=LRyPY+J1TH12xcClI2/iaSoRZ8zD1oVl/88RyV/H3U4=; b=NkNBMRkzdr7H7eqFSRaxgsttJa Om1EwkBMPtr5IPXsBHPQStvvQRVAYIgg+bMBdSnv8y7rXvvCJfqs4+7KGXCkw0rs2SxQk24a2+gAx hXTmKN8oxZv/vfYDJuhAqJyXvVHKR5N4oTZI1wXlf1ZK7xGBAPsfxEPyU2A/ADhiheOA=; Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1wgSp2-0002Pl-Um; Sun, 05 Jul 2026 19:48:12 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1wgSp1-0002PK-16 for linux-f2fs-devel@lists.sourceforge.net; Sun, 05 Jul 2026 19:48:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: 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=xHn7nWJIEjtZGVKLUuKxbe6auJkmuo4ttsUoVDB6jng=; b=WG8Xu+Oz+KVkEV/fMSQnO/uU1+ 2DasPYPI7yJ3OlkrtFy/j5T1T97KRjJUfdbABz3SUZacZLUyMFSdJ5aJ+U9Sc5QrNnKlXEfOSeskF Iqsehrk51ttmiWBk5nEWRLqDm+JBLLhCovBzEqtDZmbx3N1tBoGV3n29tBzEh5IRfQs0=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: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=xHn7nWJIEjtZGVKLUuKxbe6auJkmuo4ttsUoVDB6jng=; b=iSW5ShEYFf4wlAfEHfB/1W5+u4 U8N2kNOaUbRPcZwD+nK1PIdJXt7IZnUT7fcO+xbT9noGnLR3IiaPwQh6KnGp9qHBx4DQFaIQr+Rua D4oNQQDlZQ8Xhrq2t9ogGrML+7MhevNz5pJXckvIvlvqtIs18hoXwfML2HHYrG4p7hr8=; Received: from sea.source.kernel.org ([172.234.252.31]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1wgSoz-0001FX-Qf for linux-f2fs-devel@lists.sourceforge.net; Sun, 05 Jul 2026 19:48:10 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 0F27340DCD; Sun, 5 Jul 2026 19:48:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 700CD1F00A3A; Sun, 5 Jul 2026 19:47:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1783280879; bh=xHn7nWJIEjtZGVKLUuKxbe6auJkmuo4ttsUoVDB6jng=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=i4pw4MykTh3baKxXF5+8MOvAdZcKs+te6RQm/uQCm95u7VIfyJ+VL8YcZVMLFlMej ws2KlkY8KUaC4z1RpUVt3nK6QiULR+t7YamE1RcrltnpU7ggzP9kRIlj8qMQ4ahyjl oqJebufz7dXPWnGf7YiEXCu6b5VtF7G7g+YrVFHhIJ1JC8XHzd/XRWmFGlHjjZaBT8 se7tX7emU8lN0cCv0LsurF2/vHEio0yQavtFLBAhfjdEQKaOvrvP3MJMakGVHlZ3MC HkZCwd1dzI4RvGbjPiQnmD43zPlU/FlaRAa6/uKUO8YXqoislIvGZVHL+flwuX7liA 5c671vEVDoScA== To: linux-fscrypt@vger.kernel.org Date: Sun, 5 Jul 2026 12:45:46 -0700 Message-ID: <20260705194555.75030-10-ebiggers@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260705194555.75030-1-ebiggers@kernel.org> References: <20260705194555.75030-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Headers-End: 1wgSoz-0001FX-Qf Subject: [f2fs-dev] [PATCH v2 09/17] ext4: Further de-generalize the bio postprocessing code 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: Ritesh Harjani , Theodore Ts'o , Zhang Yi , linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, Andreas Dilger , Ojaswin Mujoo , Baokun Li , Jaegeuk Kim , linux-fsdevel@vger.kernel.org, Jan Kara , linux-ext4@vger.kernel.org, Christoph Hellwig , Eric Biggers Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Since the bio postprocessing code in fs/ext4/readpage.c is now used only for fsverity, rename things accordingly. Also: - Don't create the caches at all when !CONFIG_FS_VERITY. - Remove the unused inode argument from ext4_set_verity_work(). Signed-off-by: Eric Biggers --- fs/ext4/ext4.h | 4 +-- fs/ext4/readpage.c | 65 ++++++++++++++++++++++------------------------ fs/ext4/super.c | 6 ++--- 3 files changed, 36 insertions(+), 39 deletions(-) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 920a8ec1b948..489ed6dcee52 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -3829,8 +3829,8 @@ static inline void ext4_set_de_type(struct super_block *sb, /* readpages.c */ int ext4_read_folio(struct file *file, struct folio *folio); void ext4_readahead(struct readahead_control *rac); -extern int __init ext4_init_post_read_processing(void); -extern void ext4_exit_post_read_processing(void); +int __init ext4_init_verity_caches(void); +void ext4_exit_verity_caches(void); /* symlink.c */ extern const struct inode_operations ext4_encrypted_symlink_inode_operations; diff --git a/fs/ext4/readpage.c b/fs/ext4/readpage.c index 8af183798a33..c7b6cdb2e124 100644 --- a/fs/ext4/readpage.c +++ b/fs/ext4/readpage.c @@ -47,12 +47,12 @@ #include "ext4.h" #include -#define NUM_PREALLOC_POST_READ_CTXS 128 +#define NUM_VERITY_WORKS 128 -static struct kmem_cache *bio_post_read_ctx_cache; -static mempool_t *bio_post_read_ctx_pool; +static struct kmem_cache *ext4_verity_work_cache; +static mempool_t *ext4_verity_work_pool; -struct bio_post_read_ctx { +struct ext4_verity_work { struct bio *bio; struct fsverity_info *vi; struct work_struct work; @@ -65,22 +65,22 @@ static void __read_end_io(struct bio *bio) bio_for_each_folio_all(fi, bio) folio_end_read(fi.folio, bio->bi_status == 0); if (bio->bi_private) - mempool_free(bio->bi_private, bio_post_read_ctx_pool); + mempool_free(bio->bi_private, ext4_verity_work_pool); bio_put(bio); } static void verity_work(struct work_struct *work) { - struct bio_post_read_ctx *ctx = - container_of(work, struct bio_post_read_ctx, work); + struct ext4_verity_work *ctx = + container_of(work, struct ext4_verity_work, work); struct bio *bio = ctx->bio; struct fsverity_info *vi = ctx->vi; /* - * Free the bio_post_read_ctx right away, since it's no longer needed. + * Free the ext4_verity_work right away, since it's no longer needed. * This relieves the pressure on the mempool as much as possible. */ - mempool_free(ctx, bio_post_read_ctx_pool); + mempool_free(ctx, ext4_verity_work_pool); bio->bi_private = NULL; fsverity_verify_bio(vi, bio); @@ -88,12 +88,6 @@ static void verity_work(struct work_struct *work) __read_end_io(bio); } -static bool bio_post_read_required(struct bio *bio) -{ - return IS_ENABLED(CONFIG_FS_VERITY) && bio->bi_private && - !bio->bi_status; -} - /* * I/O completion handler for multipage BIOs. * @@ -108,8 +102,9 @@ static bool bio_post_read_required(struct bio *bio) */ static void mpage_end_io(struct bio *bio) { - if (bio_post_read_required(bio)) { - struct bio_post_read_ctx *ctx = bio->bi_private; + if (IS_ENABLED(CONFIG_FS_VERITY) && bio->bi_private && + !bio->bi_status) { + struct ext4_verity_work *ctx = bio->bi_private; INIT_WORK(&ctx->work, verity_work); fsverity_enqueue_verify_work(&ctx->work); @@ -118,14 +113,12 @@ static void mpage_end_io(struct bio *bio) __read_end_io(bio); } -static void ext4_set_bio_post_read_ctx(struct bio *bio, - const struct inode *inode, - struct fsverity_info *vi) +static void ext4_set_verity_work(struct bio *bio, struct fsverity_info *vi) { if (vi) { /* Due to the mempool, this never fails. */ - struct bio_post_read_ctx *ctx = - mempool_alloc(bio_post_read_ctx_pool, GFP_NOFS); + struct ext4_verity_work *ctx = + mempool_alloc(ext4_verity_work_pool, GFP_NOFS); ctx->bio = bio; ctx->vi = vi; @@ -289,7 +282,7 @@ static int ext4_mpage_readpages(struct inode *inode, struct fsverity_info *vi, bio = bio_alloc(bdev, bio_max_segs(nr_pages), REQ_OP_READ, GFP_KERNEL); fscrypt_set_bio_crypt_ctx(bio, inode, pos, GFP_KERNEL); - ext4_set_bio_post_read_ctx(bio, inode, vi); + ext4_set_verity_work(bio, vi); bio->bi_iter.bi_sector = first_block << (blkbits - 9); bio->bi_end_io = mpage_end_io; if (rac) @@ -363,27 +356,31 @@ void ext4_readahead(struct readahead_control *rac) ext4_mpage_readpages(inode, vi, rac, NULL); } -int __init ext4_init_post_read_processing(void) +int __init ext4_init_verity_caches(void) { - bio_post_read_ctx_cache = KMEM_CACHE(bio_post_read_ctx, SLAB_RECLAIM_ACCOUNT); + if (!IS_ENABLED(CONFIG_FS_VERITY)) + return 0; + ext4_verity_work_cache = + KMEM_CACHE(ext4_verity_work, SLAB_RECLAIM_ACCOUNT); - if (!bio_post_read_ctx_cache) + if (!ext4_verity_work_cache) goto fail; - bio_post_read_ctx_pool = - mempool_create_slab_pool(NUM_PREALLOC_POST_READ_CTXS, - bio_post_read_ctx_cache); - if (!bio_post_read_ctx_pool) + ext4_verity_work_pool = mempool_create_slab_pool( + NUM_VERITY_WORKS, ext4_verity_work_cache); + if (!ext4_verity_work_pool) goto fail_free_cache; return 0; fail_free_cache: - kmem_cache_destroy(bio_post_read_ctx_cache); + kmem_cache_destroy(ext4_verity_work_cache); fail: return -ENOMEM; } -void ext4_exit_post_read_processing(void) +void ext4_exit_verity_caches(void) { - mempool_destroy(bio_post_read_ctx_pool); - kmem_cache_destroy(bio_post_read_ctx_cache); + if (!IS_ENABLED(CONFIG_FS_VERITY)) + return; + mempool_destroy(ext4_verity_work_pool); + kmem_cache_destroy(ext4_verity_work_cache); } diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 245f67d10ded..cb9ca0dc4664 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -7531,7 +7531,7 @@ static int __init ext4_init_fs(void) if (err) goto out7; - err = ext4_init_post_read_processing(); + err = ext4_init_verity_caches(); if (err) goto out6; @@ -7580,7 +7580,7 @@ static int __init ext4_init_fs(void) out4: ext4_exit_pageio(); out5: - ext4_exit_post_read_processing(); + ext4_exit_verity_caches(); out6: ext4_exit_pending(); out7: @@ -7601,7 +7601,7 @@ static void __exit ext4_exit_fs(void) ext4_exit_sysfs(); ext4_exit_system_zone(); ext4_exit_pageio(); - ext4_exit_post_read_processing(); + ext4_exit_verity_caches(); ext4_exit_es(); ext4_exit_pending(); } -- 2.54.0 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel