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

2018-05-21 Thread John Crispin



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 
---
  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@lists.openwrt.org
http://lists.infradead.org/mailman/listinfo/openwrt-devel


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

2018-05-18 Thread Pierre Lebleu
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 
---
 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)
+
 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;
-- 
1.9.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
http://lists.infradead.org/mailman/listinfo/openwrt-devel