BA_CLRBUF specifies that existing context of the block will be completely overwritten by caller, so there is no reason to spend io fetching existing data. We do the same for indirect blocks.
Reported by: tmunro
Differential D27353
ffs: do not read full direct blocks if they are going to be overwritten. kib on Nov 24 2020, 5:28 PM. Authored by Tags None Referenced Files
Details BA_CLRBUF specifies that existing context of the block will be completely overwritten by caller, so there is no reason to spend io fetching existing data. We do the same for indirect blocks. Reported by: tmunro Not tested.
Diff Detail
Event TimelineComment Actions Hmm. My filesystem has 32kb blocks, and this generates reads, according to dwatch -X io: openat(AT_FDCWD,"file",O_RDWR|O_FSYNC|O_DIRECT,00) = 3 (0x3) pwrite(3,"................................"...,32768,0x0) = 32768 (0x8000) pwrite(3,"................................"...,32768,0x0) = 32768 (0x8000) pwrite(3,"................................"...,32768,0x0) = 32768 (0x8000) ... while smaller write sizes don't. Isn't that backwards? Comment Actions The sentiment is correct, but logic fixes noted are needed.
|