]> git.alsa-project.org Git - tinycompress.git/commit
compress: Block if unable to write all data in single write()
authorRichard Fitzgerald <rf@opensource.wolfsonmicro.com>
Fri, 22 Feb 2013 16:06:48 +0000 (16:06 +0000)
committerVinod Koul <vinod.koul@intel.com>
Fri, 22 Feb 2013 18:08:12 +0000 (23:38 +0530)
commitbb2650a55eb759b72c7de93f8cdcc000411d5122
treed1f977d07b36a872d0e3eddd23c7ab9c0a0b87e5
parentacc0960ea1c11039d4fbb819349a34cefb06795b
compress: Block if unable to write all data in single write()

Previously compress_write() would only block on poll() if the
available space < fragment_size. If the device has a small fragment
size this could lead to it never blocking and instead looping around
doing many small writes. This is bad for power saving.

If we were unable to write all the remaining data in a single write
we want to block until the device reaches a buffer high water mark,
to allow the CPU to sleep.

This change will always attempt to issue the first write providing
avail >= fragment_size. All subsequent loops will block on poll()
before attempting another write() unless there is enough buffer space
to write all remaining data.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
compress.c