diff mbox series

[11/13] ubifs: Tell the VFS that readpage was synchronous

Message ID 20200917151050.5363-12-willy@infradead.org
State New
Headers show
Series Allow readpage to return a locked page | expand

Commit Message

Matthew Wilcox Sept. 17, 2020, 3:10 p.m. UTC
The ubifs 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/ubifs/file.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

Comments

Richard Weinberger Sept. 17, 2020, 8:46 p.m. UTC | #1
----- Urspr√ľngliche Mail -----
> Von: "Matthew Wilcox" <willy@infradead.org>
> An: "linux-fsdevel" <linux-fsdevel@vger.kernel.org>
> CC: "Matthew Wilcox" <willy@infradead.org>, "linux-mm" <linux-mm@kvack.org>, v9fs-developer@lists.sourceforge.net,
> "linux-kernel" <linux-kernel@vger.kernel.org>, linux-afs@lists.infradead.org, "ceph-devel"
> <ceph-devel@vger.kernel.org>, linux-cifs@vger.kernel.org, ecryptfs@vger.kernel.org, "linux-um"
> <linux-um@lists.infradead.org>, "linux-mtd" <linux-mtd@lists.infradead.org>, "richard" <richard@nod.at>
> Gesendet: Donnerstag, 17. September 2020 17:10:48
> Betreff: [PATCH 11/13] ubifs: Tell the VFS that readpage was synchronous

> The ubifs 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/ubifs/file.c | 16 ++++++++++------
> 1 file changed, 10 insertions(+), 6 deletions(-)

For ubifs, jffs2 and hostfs:

Acked-by: Richard Weinberger <richard@nod.at>

Thanks,
//richard
diff mbox series

Patch

diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index b77d1637bbbc..82633509c45e 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -772,7 +772,6 @@  static int ubifs_do_bulk_read(struct ubifs_info *c, struct bu_info *bu,
 	if (err)
 		goto out_warn;
 
-	unlock_page(page1);
 	ret = 1;
 
 	isize = i_size_read(inode);
@@ -892,11 +891,16 @@  static int ubifs_bulk_read(struct page *page)
 
 static int ubifs_readpage(struct file *file, struct page *page)
 {
-	if (ubifs_bulk_read(page))
-		return 0;
-	do_readpage(page);
-	unlock_page(page);
-	return 0;
+	int err;
+
+	err = ubifs_bulk_read(page);
+	if (err == 0)
+		err = do_readpage(page);
+	if (err < 0) {
+		unlock_page(page);
+		return err;
+	}
+	return AOP_UPDATED_PAGE;
 }
 
 static int do_writepage(struct page *page, int len)