mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 19:28:53 +03:00
Fix long POSIX_FADV_DONTNEED for single block files
dbuf_whichblock() is not made to handle offsets beyond the block end for single-block objects. Handle it in dmu_evict_range(), similar to dmu_prefetch_by_dnode(). Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Reviewed-by: Tony Hutter <hutter2@llnl.gov> Signed-off-by: Alexander Motin <alexander.motin@TrueNAS.com> Closes #18399 Closes #18489
This commit is contained in:
committed by
Tony Hutter
parent
4bb7592745
commit
38501e1821
+8
-2
@@ -918,8 +918,14 @@ dmu_evict_range(objset_t *os, uint64_t object, uint64_t offset, uint64_t len)
|
||||
* access patterns are rare.
|
||||
*/
|
||||
rw_enter(&dn->dn_struct_rwlock, RW_READER);
|
||||
uint64_t start = dbuf_whichblock(dn, 0, offset);
|
||||
uint64_t end = dbuf_whichblock(dn, 0, offset + len);
|
||||
uint64_t start, end;
|
||||
if (dn->dn_datablkshift != 0) {
|
||||
start = dbuf_whichblock(dn, 0, offset);
|
||||
end = dbuf_whichblock(dn, 0, offset + len);
|
||||
} else {
|
||||
start = (offset >= dn->dn_datablksz);
|
||||
end = (offset + len >= dn->dn_datablksz);
|
||||
}
|
||||
if (end > start)
|
||||
dbuf_evict_range(dn, start, end - 1);
|
||||
rw_exit(&dn->dn_struct_rwlock);
|
||||
|
||||
Reference in New Issue
Block a user