Skip to contentSkip to conversation

lib/tst_device: Fill a file in megabyte sized chunks

PATCH New Punit Agrawal 2 participants 2 messages May 14, 2018 – May 16, 2018 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/tst_device: Fill a file in megabyte sized chunks

A zero-filled file is used as backing store when creating a loopback device. The zero-fill operations is done in 1KB sized chunks for file-size specified in megabytes. This leads to a large number of write calls which take long time during test setup phase in certain environments.

Move to using 1MB sized chunks to reduce the number of write syscalls by a few order of magnitude.

---
 lib/tst_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/tst_device.c +1 -1
index edfacbdc7..463743443 100644
@@ -268,7 +268,7 @@ const char *tst_acquire_device__(unsigned int size)
 				ltp_dev_size, acq_dev_size);
 	}
 
-	if (tst_fill_file(DEV_FILE, 0, 1024, 1024 * acq_dev_size)) {
+	if (tst_fill_file(DEV_FILE, 0, 1024 * 1024, acq_dev_size)) {
 		tst_resm(TWARN | TERRNO, "Failed to create " DEV_FILE);
 		return NULL;
 	}
Signature · 1 line
2.17.0