FS#11799 - Less disk activity patch for text viewer plugin

Attached to Project: Rockbox
Opened by Alexander Meshcheryakov (Self-Perfection) - Wednesday, 08 December 2010, 20:47 GMT
Last edited by MichaelGiacomelli (saratoga) - Tuesday, 14 December 2010, 21:34 GMT
Task Type Patches
Category Plugins
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Release 3.7.1
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Current text viewer is very greedy for disk accesses. This is very annoying on HDD based players. For example, I've expirienced more 5 seconds pauses after "quit" command. This patch changes how saving preferences happens, so in most cases quiting text viewer plugin on HDD based player would be instant.

- tv_save_settings() were called twice upon exiting doubling all disk activity
- if tv_file.dat already had record for current file when preferences were saved tv_file.dat grew one record of garbage

- Much more efficient code for saving preferences. Do not dawdle with temporary tv_file.tmp if this text is opened for the first time or there were no bookmark adding/removals since text were opened.
- Saving settings on exit only if preferences or bookmarks were changed since plugin start or text were scrolled. On devices with HAVE_DISK_STORAGE defined scrolling is ignored.
This task depends upon

Closed by  MichaelGiacomelli (saratoga)
Tuesday, 14 December 2010, 21:34 GMT
Reason for closing:  Accepted
Additional comments about closing:  Committed in r28833.