bcachefs: key cache: Don't hold btree locks while using GFP_RECLAIM
authorKent Overstreet <kent.overstreet@linux.dev>
Sat, 7 Jan 2023 10:46:52 +0000 (05:46 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:49 +0000 (17:09 -0400)
commit6c36318cc702f05d302fb98a99636e320392bdf1
tree9f1d6f567f31162215aa9d2f6f66e48d06b94e64
parent7af365eb3694b7ef7ce2b90b6de4b830a49cdda4
bcachefs: key cache: Don't hold btree locks while using GFP_RECLAIM

This is something we need to do more widely: instead of bothering with
GFP_NOIO/GFP_NOFS, if we need to allocate memory while holding locks:

 - first attempt the allocation with GFP_NOWAIT
 - if that fails, drop btree locks with bch2_trans_unlock(), then
   retry with GFP_KERNEL.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_iter.c
fs/bcachefs/btree_key_cache.c