Skip to contentSkip to conversation

fs/buffer.c: use b_folio for fsverity work

PATCH Applied Eric Biggers 1 participant 2 messages Feb 24, 2023 – Mar 7, 2023

Subsystems (2)
lore
Share & tools
lore

Eric Biggers

author maintainer
#0 lore raw

PATCH 1/1 fs/buffer.c: use b_folio for fsverity work

From: Eric Biggers <[email protected]>

Use b_folio now that it exists. This removes an unnecessary call to compound_head(). No actual change in behavior.

---
 fs/buffer.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
fs/buffer.c +4 -5
index 9e1e2add541e..034bece27163 100644
@@ -308,20 +308,19 @@ static void verify_bh(struct work_struct *work)
 	struct buffer_head *bh = ctx->bh;
 	bool valid;
 
-	valid = fsverity_verify_blocks(page_folio(bh->b_page), bh->b_size,
-				       bh_offset(bh));
+	valid = fsverity_verify_blocks(bh->b_folio, bh->b_size, bh_offset(bh));
 	end_buffer_async_read(bh, valid);
 	kfree(ctx);
 }
 
 static bool need_fsverity(struct buffer_head *bh)
 {
-	struct page *page = bh->b_page;
-	struct inode *inode = page->mapping->host;
+	struct folio *folio = bh->b_folio;
+	struct inode *inode = folio->mapping->host;
 
 	return fsverity_active(inode) &&
 		/* needed by ext4 */
-		page->index < DIV_ROUND_UP(inode->i_size, PAGE_SIZE);
+		folio->index < DIV_ROUND_UP(inode->i_size, PAGE_SIZE);
 }
 
 static void decrypt_bh(struct work_struct *work)
Signature · 1 line
2.39.2
author maintainer Applied
#1 lore raw
Quoted 30 lines · Eric Biggers

From: Eric Biggers <[email protected]>

Use b_folio now that it exists. This removes an unnecessary call to compound_head(). No actual change in behavior.

---
 fs/buffer.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
fs/buffer.c +1 -4
index 9e1e2add541e..034bece27163 100644
@@ -308,20 +308,19 @@ static void verify_bh(struct work_struct *work)
 	struct buffer_head *bh = ctx->bh;
 	bool valid;
 
-	valid = fsverity_verify_blocks(page_folio(bh->b_page), bh->b_size,
-				       bh_offset(bh));
+	valid = fsverity_verify_blocks(bh->b_folio, bh->b_size, bh_offset(bh));
 	end_buffer_async_read(bh, valid);
 	kfree(ctx);
 }
 
 static bool need_fsverity(struct buffer_head *bh)
 {
-	struct page *page = bh->b_page;
-	struct inode *inode = page->mapping->host;

fs/buffer.c static void verify_bh(struct work_struct *work) · line 326

Quoted 10 lines
fs/buffer.c +3 -1
+	struct folio *folio = bh->b_folio;
+	struct inode *inode = folio->mapping->host;
 
 	return fsverity_active(inode) &&
 		/* needed by ext4 */
-		page->index < DIV_ROUND_UP(inode->i_size, PAGE_SIZE);
+		folio->index < DIV_ROUND_UP(inode->i_size, PAGE_SIZE);
 }
 
 static void decrypt_bh(struct work_struct *work)

Applied to https://git.kernel.org/pub/scm/fs/fsverity/linux.git/log/?h=for-next

- Eric