[OpenWrt-Devel] [PATCH 2/2] fstools: allow to customize the mount flags for the overlay

John Crispin john at phrozen.org
Tue May 22 01:02:28 EDT 2018



On 18/05/18 16:07, Pierre Lebleu wrote:
> In order to customize the mount flags, a new CMake option
> (eg: CMAKE_OVL_MOUNT_FLAGS) has been added.
>
> Example: cmake -DCMAKE_OVL_MOUNT_FLAGS="MS_RELATIME"
>
> Signed-off-by: Pierre Lebleu <pme.lebleu at gmail.com>
> ---
>   CMakeLists.txt       | 6 ++++++
>   libfstools/overlay.c | 2 +-
>   2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index 484d716..4e8b502 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -58,6 +58,12 @@ ELSE(DEFINED CMAKE_OVL_MOUNT_OPTION)
>   	ADD_DEFINITIONS(-DOVL_MOUNT_OPTION=NULL)
>   ENDIF(DEFINED CMAKE_OVL_MOUNT_OPTION)
>   
> +IF(DEFINED CMAKE_OVL_MOUNT_FLAGS)
> +	ADD_DEFINITIONS(-DOVL_MOUNT_FLAGS=${CMAKE_OVL_MOUNT_FLAGS})
> +ELSE(DEFINED CMAKE_OVL_MOUNT_FLAGS)
> +	ADD_DEFINITIONS(-DOVL_MOUNT_FLAGS=MS_NOATIME)
> +ENDIF(DEFINED CMAKE_OVL_MOUNT_FLAGS)
> +
Hi Pierre,
we use NOATIME by default to reduce flash writes. RELATIME would even 
increase them. admitedly this is not an issue on some types of storage. 
rather then using this approach add an option "full access time 
accounting" or similar, enabling these options.
     John
>   ADD_EXECUTABLE(mount_root mount_root.c)
>   TARGET_LINK_LIBRARIES(mount_root fstools)
>   INSTALL(TARGETS mount_root RUNTIME DESTINATION sbin)
> diff --git a/libfstools/overlay.c b/libfstools/overlay.c
> index 5d5a985..b201679 100644
> --- a/libfstools/overlay.c
> +++ b/libfstools/overlay.c
> @@ -341,7 +341,7 @@ static int overlay_mount_fs(struct volume *v)
>   		return -1;
>   	}
>   
> -	if (mount(v->blk, "/tmp/overlay", fstype, MS_NOATIME, OVL_MOUNT_OPTION)) {
> +	if (mount(v->blk, "/tmp/overlay", fstype, OVL_MOUNT_FLAGS, OVL_MOUNT_OPTION)) {
>   		ULOG_ERR("failed to mount -t %s %s /tmp/overlay: %m\n",
>   		         fstype, v->blk);
>   		return -1;


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
http://lists.infradead.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list