summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2020-02-27 17:58:24 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2020-03-03 08:31:24 +0100
commit0e8d4c71ab877e1498ab1f0f63be54430e24945a (patch)
tree88ca65b030a91c76fe5d2b12581a2db26cce8c0b /drivers
parent9552f5150bb2654a0e52aad8c12973896f24f2ee (diff)
downloadbarebox-0e8d4c71ab877e1498ab1f0f63be54430e24945a.tar.gz
usb: gadget: fastboot: call discard_range for sparse files as well
We can save some time by explicitly telling the block layer that a range is unused before overwriting it. This brought time my sample write from 445s to 376s. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/gadget/f_fastboot.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 35c4b8c..96aecac 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -957,6 +957,8 @@ static int fastboot_handle_sparse(struct f_fastboot *f_fb,
if (ret)
goto out;
} else {
+ discard_range(fd, retlen, pos);
+
pos = lseek(fd, pos, SEEK_SET);
if (pos == -1) {
ret = -errno;