[meta-freescale] [meta-fsl-arm][PATCH] classes: use dd's option fsync instead of sync

Stefan Christ s.christ at phytec.de
Tue May 5 01:40:08 PDT 2015


The shell command sync flushes all filesystem buffers in the system.  On
a bigger multiuser system there are multiple gigs of data sometimes in
the buffer which then are written out to disk at once.  It's better to
only flush the specific file with dd's option 'fsync'.

Signed-off-by: Stefan Christ <s.christ at phytec.de>
---
Hi,

I'm curious why the bbclass image_types_fsl.bbclass uses a double 'sync' to
burn the sdcard image. Is there a specific reason, why a single sync is not
sufficient to write the data to disk?

Furthermore calling sync will flush all filesystem buffers on the system. It
maybe a performance bottleneck because this may fill up the disk controller
capacity quickly.

Kind regards,
Stefan
---
 classes/image_types_fsl.bbclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/classes/image_types_fsl.bbclass b/classes/image_types_fsl.bbclass
index 75eca59..1ebcb06 100644
--- a/classes/image_types_fsl.bbclass
+++ b/classes/image_types_fsl.bbclass
@@ -178,8 +178,8 @@ generate_imx_sdcard () {
 	fi
 
 	# Burn Partition
-	dd if=${WORKDIR}/boot.img of=${SDCARD} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
-	dd if=${SDCARD_ROOTFS} of=${SDCARD} conv=notrunc seek=1 bs=$(expr ${BOOT_SPACE_ALIGNED} \* 1024 + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
+	dd if=${WORKDIR}/boot.img of=${SDCARD} conv=notrunc,fsync seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024)
+	dd if=${SDCARD_ROOTFS} of=${SDCARD} conv=notrunc,fsync seek=1 bs=$(expr ${BOOT_SPACE_ALIGNED} \* 1024 + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024)
 }
 
 #
@@ -293,7 +293,7 @@ generate_mxs_sdcard () {
 
 	parted ${SDCARD} print
 
-	dd if=${SDCARD_ROOTFS} of=${SDCARD} conv=notrunc seek=1 bs=$(expr ${BOOT_SPACE_ALIGNED} \* 1024 + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
+	dd if=${SDCARD_ROOTFS} of=${SDCARD} conv=notrunc,fsync seek=1 bs=$(expr ${BOOT_SPACE_ALIGNED} \* 1024 + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024)
 }
 
 IMAGE_CMD_sdcard () {
-- 
1.9.1



More information about the meta-freescale mailing list