Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Matthew Wilcox (Oracle) and committed by
Christian Brauner
263cf578 1613e604

+4 -6
+4 -6
fs/befs/linuxvfs.c
··· 475 475 befs_data_stream *data = &befs_ino->i_data.ds; 476 476 befs_off_t len = data->size; 477 477 char *link = folio_address(folio); 478 + int err = -EIO; 478 479 479 480 if (len == 0 || len > PAGE_SIZE) { 480 481 befs_error(sb, "Long symlink with illegal length"); ··· 488 487 goto fail; 489 488 } 490 489 link[len - 1] = '\0'; 491 - folio_mark_uptodate(folio); 492 - folio_unlock(folio); 493 - return 0; 490 + err = 0; 494 491 fail: 495 - folio_set_error(folio); 496 - folio_unlock(folio); 497 - return -EIO; 492 + folio_end_read(folio, err == 0); 493 + return err; 498 494 } 499 495 500 496 /*