diff options
author | Qu Wenruo <wqu@suse.com> | 2021-01-28 14:25:08 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2021-02-09 00:59:04 +0300 |
commit | 2c4d8cb737b805ca8d890e50c23f2b5eca270733 (patch) | |
tree | ec578377a20be06c7341cff4ca120b5bc57e56e2 /fs/btrfs/ctree.c | |
parent | 0bb3eb3ee8674d5d20ad3c0c0767e18787bbd761 (diff) | |
download | linux-2c4d8cb737b805ca8d890e50c23f2b5eca270733.tar.xz |
btrfs: explain page locking and readahead in read_extent_buffer_pages()
In read_extent_buffer_pages(), if we failed to lock the page atomically,
we just exit with return value 0.
This is counter-intuitive, as normally if we can't lock what we need, we
would return something like EAGAIN.
But that return hides under (wait == WAIT_NONE) branch, which only gets
triggered for readahead.
And for readahead, if we failed to lock the page, it means the extent
buffer is either being read by other thread, or has been read and is
under modification. Either way the eb will or has been cached, thus
readahead has no need to wait for it.
Add comment on this counter-intuitive behavior.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/ctree.c')
0 files changed, 0 insertions, 0 deletions