All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-fsl-arm][PATCH] classes: use dd's option fsync instead of sync
@ 2015-05-05  8:40 Stefan Christ
  2015-05-05 10:22 ` Nikolay Dimitrov
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Christ @ 2015-05-05  8:40 UTC (permalink / raw)
  To: meta-freescale

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@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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [meta-fsl-arm][PATCH] classes: use dd's option fsync instead of sync
  2015-05-05  8:40 [meta-fsl-arm][PATCH] classes: use dd's option fsync instead of sync Stefan Christ
@ 2015-05-05 10:22 ` Nikolay Dimitrov
  0 siblings, 0 replies; 2+ messages in thread
From: Nikolay Dimitrov @ 2015-05-05 10:22 UTC (permalink / raw)
  To: Stefan Christ, meta-freescale

On 05/05/2015 11:40 AM, Stefan Christ wrote:
> 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@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 () {
>

Tested-by: Nikolay Dimitrov <picmaster@mail.bg>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-05 10:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-05  8:40 [meta-fsl-arm][PATCH] classes: use dd's option fsync instead of sync Stefan Christ
2015-05-05 10:22 ` Nikolay Dimitrov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.