]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm: return an ERR_PTR from __filemap_get_folio
authorChristoph Hellwig <hch@lst.de>
Tue, 7 Mar 2023 14:34:10 +0000 (15:34 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 5 Apr 2023 23:02:16 +0000 (16:02 -0700)
commitd3513814b1db722751ad8c11c5b01025ad5e9b08
treeb8817c8c8fe138bac8c0770298c50c7b3a3830e9
parentfb3030b6ef6255216e2b31c606e05ff100b522e9
mm: return an ERR_PTR from __filemap_get_folio

Instead of returning NULL for all errors, distinguish between:

 - no entry found and not asked to allocated (-ENOENT)
 - failed to allocate memory (-ENOMEM)
 - would block (-EAGAIN)

so that callers don't have to guess the error based on the passed in
flags.

Also pass through the error through the direct callers: filemap_get_folio,
filemap_lock_folio filemap_grab_folio and filemap_get_incore_folio.

Link: https://lkml.kernel.org/r/20230307143410.28031-8-hch@lst.de
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Ryusuke Konishi <konishi.ryusuke@gmail.com> [nilfs2]
Cc: Andreas Gruenbacher <agruenba@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Naoya Horiguchi <naoya.horiguchi@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
21 files changed:
fs/afs/dir.c
fs/afs/dir_edit.c
fs/afs/write.c
fs/ext4/inode.c
fs/ext4/move_extent.c
fs/hugetlbfs/inode.c
fs/iomap/buffered-io.c
fs/netfs/buffered_read.c
fs/nfs/file.c
fs/nilfs2/page.c
include/linux/pagemap.h
mm/filemap.c
mm/folio-compat.c
mm/huge_memory.c
mm/hugetlb.c
mm/memcontrol.c
mm/mincore.c
mm/shmem.c
mm/swap_state.c
mm/swapfile.c
mm/truncate.c