bcachefs
bcachefs copied to clipboard
bcachefs: fix initial page state after falloc
On a new page reservation check if the backing extent was already allocated before adding to the number of sectors we will allocate. It is possible to write to a page that is beyond the inode i_size that is also backed by an allocated extent. This can happen when fallocate is used with FALLOC_FL_KEEP_SIZE.
Signed-off-by: Dan Robertson [email protected]
Updated and seems to pass xfstests.
Updated to only run the btree check if the page is not uptodate. I kept the check in the page state creation to ensure this check isn't run often.
I think i have an idea for a better implementation of this. We don't seem to call write_begin for a buffered write. I think if we add that, i might be able to work something out there so that we essentially run the extra code added to __bch2_page_state_create that checks the btree for reserved sectors in write_begin when needed.