[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/2 v2] usb-mtp: Reallocate buffer in multiples
From: |
Bandan Das |
Subject: |
Re: [Qemu-devel] [PATCH 1/2 v2] usb-mtp: Reallocate buffer in multiples of MTP_WRITE_BUF_SZ |
Date: |
Sun, 13 Jan 2019 00:37:40 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Eric Blake <address@hidden> writes:
> On 1/11/19 2:20 AM, Bandan Das wrote:
>> This is a "pre-patch" to breaking up the write buffer for
>> MTP writes. Instead of allocating a mtp buffer equal to size
>> sent by the initiator, we start with a small size and reallocate
>> multiples (of that small size) as needed.
>>
>> Signed-off-by: Bandan Das <address@hidden>
>> ---
>> hw/usb/dev-mtp.c | 26 ++++++++++++--------------
>> 1 file changed, 12 insertions(+), 14 deletions(-)
>>
>> diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
>> index b19b576278..a0d98c93ee 100644
>> --- a/hw/usb/dev-mtp.c
>> +++ b/hw/usb/dev-mtp.c
>> @@ -152,7 +152,6 @@ struct MTPData {
>> bool first;
>> /* Used for >4G file sizes */
>> bool pending;
>> - uint64_t cached_length;
>> int fd;
>> };
>>
>> @@ -244,6 +243,7 @@ typedef struct {
>>
>> #define MTP_MANUFACTURER "QEMU"
>> #define MTP_PRODUCT "QEMU filesharing"
>> +#define MTP_WRITE_BUF_SZ 512000
>
> Why not a power of two? Perhaps use units.h and spell it (512 * KiB) ?
Sure, I will change it in a later patch.
Bandan