[PATCH] fixup! usb: gadget: fastboot: call discard_range for sparse files as well

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I've not tested it with ubi formatted partitions and if we want it
there, it's more effecient to do it once in the ubi_format probably.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 drivers/usb/gadget/f_fastboot.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 99c6a5c0cb83..96aecacc27e5 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -941,8 +941,6 @@ static int fastboot_handle_sparse(struct f_fastboot *f_fb,
 				goto out;
 		}
 
-		discard_range(fd, retlen, pos);
-
 		if (fentry->flags & FILE_LIST_FLAG_UBI) {
 			if (!IS_ENABLED(CONFIG_UBIFORMAT)) {
 				ret = -ENOSYS;
@@ -959,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;
-- 
2.25.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux