Christoph Hellwig 66dabbb65d 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.

[hch@lst.de: fix null-pointer deref]
  Link: https://lkml.kernel.org/r/20230310070023.GA13563@lst.de
  Link: https://lkml.kernel.org/r/20230310043137.GA1624890@u2004
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>
2023-04-05 19:42:42 -07:00
..
2023-02-22 14:21:40 -08:00
2022-05-09 23:12:33 -04:00
2023-02-20 11:53:11 -08:00
2023-02-22 14:47:20 -08:00
2021-04-05 09:04:20 -04:00
2023-03-10 09:38:47 -05:00
2022-10-20 10:13:27 +02:00
2023-02-22 14:47:20 -08:00
2022-12-13 08:44:41 -08:00
2022-12-06 12:29:35 -05:00
2023-02-22 14:47:20 -08:00
2022-05-09 16:36:48 -04:00
2022-12-16 03:54:54 -08:00
2022-11-27 22:10:00 -05:00