summaryrefslogtreecommitdiff
path: root/fs/befs
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2024-05-30 21:20:53 +0100
committerChristian Brauner <brauner@kernel.org>2024-05-31 12:31:39 +0200
commit263cf578049708a115b3ca58e46b7e5d20763866 (patch)
treea343aa16e58194728663cbb9e2b4ba9f5642b678 /fs/befs
parent1613e604df0cd359cf2a7fbd9be7a0bcfacfabd0 (diff)
befs: Convert befs_symlink_read_folio() to use folio_end_read()
This is slightly more efficient than separate calls to folio_mark_uptodate() and folio_unlock(), and it's easier to read. Get rid of the call to folio_set_error() as nobody will check this flag. Cc: Luis de Bethencourt <luisbg@kernel.org> Cc: Salah Triki <salah.triki@gmail.com> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Link: https://lore.kernel.org/r/20240530202110.2653630-2-willy@infradead.org Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/befs')
-rw-r--r--fs/befs/linuxvfs.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index d76f406d3b2e..f92f108840f5 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -475,6 +475,7 @@ static int befs_symlink_read_folio(struct file *unused, struct folio *folio)
befs_data_stream *data = &befs_ino->i_data.ds;
befs_off_t len = data->size;
char *link = folio_address(folio);
+ int err = -EIO;
if (len == 0 || len > PAGE_SIZE) {
befs_error(sb, "Long symlink with illegal length");
@@ -487,13 +488,10 @@ static int befs_symlink_read_folio(struct file *unused, struct folio *folio)
goto fail;
}
link[len - 1] = '\0';
- folio_mark_uptodate(folio);
- folio_unlock(folio);
- return 0;
+ err = 0;
fail:
- folio_set_error(folio);
- folio_unlock(folio);
- return -EIO;
+ folio_end_read(folio, err == 0);
+ return err;
}
/*