bcachefs: Buffered write path now can avoid the inode lock
authorKent Overstreet <kent.overstreet@linux.dev>
Wed, 28 Feb 2024 23:30:22 +0000 (18:30 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Thu, 14 Mar 2024 01:22:26 +0000 (21:22 -0400)
commit7e64c86cdc6cee0db36eb983c62065c5bf71508b
treeb684b41b845922c8f85dbae8de0a945ff58a6927
parent66a67c860cce3643248f7e80ee095b946829a342
bcachefs: Buffered write path now can avoid the inode lock

Non append, non extending buffered writes can now avoid taking the inode
lock.

To ensure atomicity of writes w.r.t. other writes, we lock every folio
that we'll be writing to, and if this fails we fall back to taking the
inode lock.

Extensive comments are provided as to corner cases.

Link: https://lore.kernel.org/linux-fsdevel/Zdkxfspq3urnrM6I@bombadil.infradead.org/
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/errcode.h
fs/bcachefs/fs-io-buffered.c