mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 16:44:58 +02:00
fs/ntfs3: zero-fill folios beyond i_valid in ntfs_read_folio()
Handle ntfs_read_folio() early when the folio offset is beyond i_valid by zero-filling the folio and marking it uptodate. This avoids needless I/O and locking, improves read performance. Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
This commit is contained in:
parent
576248a34b
commit
356fa24816
|
|
@ -723,6 +723,19 @@ static int ntfs_read_folio(struct file *file, struct folio *folio)
|
|||
struct address_space *mapping = folio->mapping;
|
||||
struct inode *inode = mapping->host;
|
||||
struct ntfs_inode *ni = ntfs_i(inode);
|
||||
loff_t vbo = folio_pos(folio);
|
||||
|
||||
if (unlikely(is_bad_ni(ni))) {
|
||||
folio_unlock(folio);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
if (ni->i_valid <= vbo) {
|
||||
folio_zero_range(folio, 0, folio_size(folio));
|
||||
folio_mark_uptodate(folio);
|
||||
folio_unlock(folio);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (is_resident(ni)) {
|
||||
ni_lock(ni);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user