mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
USB: f_mtp: Avoid queuing of receive_file_work for 0 length
MTP Server can issue ioctl for receive_file_work even if xfer_length is 0. Mainly due to small files which are read from mtp_read() itself. As there is no need to queue work followed by flush_work in that case, add a check for same to avoid wasting few msecs for every small file transferred. Change-Id: I7b5395cc771c6f1ef842e787210ec02262b2b44f Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
This commit is contained in:
parent
ee4780198e
commit
16232cca08
@ -1145,14 +1145,17 @@ static long mtp_send_receive_ioctl(struct file *fp, unsigned int code,
|
||||
* in kernel context, which is necessary for vfs_read and
|
||||
* vfs_write to use our buffers in the kernel address space.
|
||||
*/
|
||||
queue_work(dev->wq, work);
|
||||
/* wait for operation to complete */
|
||||
flush_workqueue(dev->wq);
|
||||
fput(filp);
|
||||
dev->xfer_result = 0;
|
||||
if (dev->xfer_file_length) {
|
||||
queue_work(dev->wq, work);
|
||||
/* wait for operation to complete */
|
||||
flush_workqueue(dev->wq);
|
||||
|
||||
/* read the result */
|
||||
smp_rmb();
|
||||
/* read the result */
|
||||
smp_rmb();
|
||||
}
|
||||
ret = dev->xfer_result;
|
||||
fput(filp);
|
||||
|
||||
fail:
|
||||
spin_lock_irq(&dev->lock);
|
||||
|
Loading…
x
Reference in New Issue
Block a user