diff options
| author | Qu Wenruo <[email protected]> | 2025-04-03 23:40:51 +0000 |
|---|---|---|
| committer | David Sterba <[email protected]> | 2025-05-15 12:30:43 +0000 |
| commit | 2b14b74b992187933069cb3316c691dbd5707f47 (patch) | |
| tree | 32d72d4296468a000ba94dd77efab9d057a95042 /fs/btrfs/dev-replace.c | |
| parent | btrfs: remove unnecessary early exits in delalloc folio lock and unlock (diff) | |
| download | kernel-2b14b74b992187933069cb3316c691dbd5707f47.tar.gz kernel-2b14b74b992187933069cb3316c691dbd5707f47.zip | |
btrfs: use folio_contains() for EOF detection
Currently we use the following pattern to detect if the folio contains
the end of a file:
if (folio->index == end_index)
folio_zero_range();
But that only works if the folio is page sized.
For the following case, it will not work and leave the range beyond EOF
uninitialized:
The page size is 4K, and the fs block size is also 4K.
16K 20K 24K
| | | |
|
EOF at 22K
And we have a large folio sized 8K at file offset 16K.
In that case, the old "folio->index == end_index" will not work, thus
the range [22K, 24K) will not be zeroed out.
Fix the following call sites which use the above pattern:
- add_ra_bio_pages()
- extent_writepage()
Reviewed-by: Filipe Manana <[email protected]>
Signed-off-by: Qu Wenruo <[email protected]>
Reviewed-by: David Sterba <[email protected]>
Signed-off-by: David Sterba <[email protected]>
Diffstat (limited to 'fs/btrfs/dev-replace.c')
0 files changed, 0 insertions, 0 deletions
