diff mbox series

[v3,11/18] ext4: Tell the VFS that readpage was synchronous

Message ID 20201016160443.18685-12-willy@infradead.org (mailing list archive)
State New, archived
Headers show
Series Allow readpage to return a locked page | expand

Commit Message

Matthew Wilcox Oct. 16, 2020, 4:04 p.m. UTC
The ext4 inline data readpage implementation was already synchronous,
so use AOP_UPDATED_PAGE to avoid cycling the page lock.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/ext4/inline.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Theodore Ts'o Oct. 18, 2020, 2:24 p.m. UTC | #1
On Fri, Oct 16, 2020 at 05:04:36PM +0100, Matthew Wilcox (Oracle) wrote:
> The ext4 inline data readpage implementation was already synchronous,
> so use AOP_UPDATED_PAGE to avoid cycling the page lock.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Acked-by: Theodore Ts'o <tytso@mit.edu>
diff mbox series

Patch

diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index 75c97bca0815..2a489243e4de 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -490,7 +490,8 @@  static int ext4_read_inline_page(struct inode *inode, struct page *page)
 	zero_user_segment(page, len, PAGE_SIZE);
 	SetPageUptodate(page);
 	brelse(iloc.bh);
-
+	if (ret >= 0)
+		return AOP_UPDATED_PAGE;
 out:
 	return ret;
 }
@@ -514,12 +515,14 @@  int ext4_readpage_inline(struct inode *inode, struct page *page)
 	else if (!PageUptodate(page)) {
 		zero_user_segment(page, 0, PAGE_SIZE);
 		SetPageUptodate(page);
+		ret = AOP_UPDATED_PAGE;
 	}
 
 	up_read(&EXT4_I(inode)->xattr_sem);
 
-	unlock_page(page);
-	return ret >= 0 ? 0 : ret;
+	if (ret < 0)
+		unlock_page(page);
+	return ret;
 }
 
 static int ext4_convert_inline_data_to_extent(struct address_space *mapping,