mbox series

[0/2,v2] Break down the MTP write operation

Message ID 20190111082043.31412-1-bsd@redhat.com
Headers show
Series Break down the MTP write operation | expand

Message

Bandan Das Jan. 11, 2019, 8:20 a.m. UTC
v2:
  Rebased on top of master and retested

For larger files, not only do we keep reallocating to increase the mtp buffer
size, the write also happens in one go. This does two things:

Write to file upto a certain data size we have received so far and second,
reuse the buffer again instead of reallocating to a larger buffer size.

Tested with different file sizes on a Linux guest.

Bandan Das (2):
  usb-mtp: Reallocate buffer in multiples of MTP_WRITE_BUF_SZ
  usb-mtp: breakup MTP write into smaller chunks

 hw/usb/dev-mtp.c | 154 ++++++++++++++++++++++++++++++-----------------
 1 file changed, 100 insertions(+), 54 deletions(-)

Comments

Gerd Hoffmann Jan. 11, 2019, 10:44 a.m. UTC | #1
On Fri, Jan 11, 2019 at 03:20:41AM -0500, Bandan Das wrote:
> v2:
>   Rebased on top of master and retested

Thanks.  Added to usb queue.

cheers,
  Gerd
Philippe Mathieu-Daudé Jan. 14, 2019, 10:47 a.m. UTC | #2
On 1/11/19 11:44 AM, Gerd Hoffmann wrote:
> On Fri, Jan 11, 2019 at 03:20:41AM -0500, Bandan Das wrote:
>> v2:
>>   Rebased on top of master and retested
> 
> Thanks.  Added to usb queue.

Hi Gerd, did you update MTP_WRITE_BUF_SZ as suggested by Eric?

+#include "qemu/units.h"

...

-#define MTP_WRITE_BUF_SZ  512000
+#define MTP_WRITE_BUF_SZ  (512 * KiB)