https://gitlab.synchro.net/main/sbbs/-/commit/531bd654b515fc1f6b790d89
Modified Files:
src/sbbs3/chksmb.c fixsmb.c smbutil.c src/smblib/smballoc.c smblib.c Log Message:
smblib: read/write data allocation records a run at a time
smb_incdat() and smb_freemsgdat() updated the .sda allocation table one
2-byte record per 256-byte data block: seek, read, seek back, write. Each
seek discards the stdio buffer, so every block cost its own read() and
write() syscall. On a message base served over SMB/CIFS (e.g. with Samba
"sync always"), each of those writes is a synchronous round trip to the
file server: rebuilding an 820MB mail base with fixsmb took ~13 minutes
at ~3,700 writes/sec, holding the base locked the whole time.
Now the whole run of records for a data field is read with one fread(), adjusted in memory, and written back with one fwrite(). smb_freemsgdat()
still truncates completely-freed records from the end of the .sda file.
Measured on a copy of the same mail base, with byte-identical results
versus the old code:
fixsmb: 3,079,001 -> 58,663 write() calls
smbutil m: 1,673,481 -> 39,340 write() calls
This benefits every message delete/maint/pack as well as fixsmb.
Bump SMBLIB, FIXSMB, CHKSMB and SMBUTIL to v3.22 (unchanged since the
v3.21e release). The SMB format version is unchanged.
Co-Authored-By: Claude Opus 5.5 (1M context) <
noreply@anthropic.com>
---
þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net