diff mbox series

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

Message ID 1526652463-27784-2-git-send-email-pme.lebleu@gmail.com
State Changes Requested
Delegated to: John Crispin
Headers show
Series [OpenWrt-Devel,1/2] fstools: allow to customize the mount option for the overlay | expand

Commit Message

Pierre Lebleu May 18, 2018, 2:07 p.m. UTC
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@gmail.com>
---
 CMakeLists.txt       | 6 ++++++
 libfstools/overlay.c | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

Comments

John Crispin May 22, 2018, 5:02 a.m. UTC | #1
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@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;
diff mbox series

Patch

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)
+
 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;