Skip to contentSkip to conversation

fs/ext2: add options for extra space and extra inodes

PATCH New Yann E. MORIN 4 participants 7 messages Oct 28, 2015 – Oct 30, 2015 ext2 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/ext2: add options for extra space and extra inodes

Add two options to the ext2 filesystem, one to add extra free space, one to add extra free inodes.

Cc Gustavo Zacarias <[email protected]>
---
 fs/ext2/Config.in       | 20 ++++++++++++++++++--
 fs/ext2/ext2.mk         |  2 ++
 package/mke2img/mke2img |  8 +++++++-
 3 files changed, 27 insertions(+), 3 deletions(-)
fs/ext2/Config.in +18 -2
index 5b1cd0c..fb06cdd 100644
@@ -45,13 +45,29 @@ config BR2_TARGET_ROOTFS_EXT2_LABEL
 	string "filesystem label"
 
 config BR2_TARGET_ROOTFS_EXT2_BLOCKS
-	int "size in blocks (leave at 0 for auto calculation)"
+	int "exact size in blocks (leave at 0 for auto calculation)"
 	default 0
 
 config BR2_TARGET_ROOTFS_EXT2_INODES
-	int "inodes (leave at 0 for auto calculation)"
+	int "exact number of inodes (leave at 0 for auto calculation)"
 	default 0
 
+config BR2_TARGET_ROOTFS_EXT2_EXTRA_BLOCKS
+	int "extra size in blocks" if BR2_TARGET_ROOTFS_EXT2_BLOCKS = 0
+	default 0
+	help
+	  Enter here the nmuber of extra blocks of free space you
+	  want on your filesystem. By default, Buildroot will not
+	  leave much space free.
+
+config BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES
+	int "extra inodes" if BR2_TARGET_ROOTFS_EXT2_INODES = 0
+	default 0
+	help
+	  Enter here the nmuber of extra free inodes you want on
+	  your filesystem. By default, Buildroot will not leave
+	  many free inodes.
+
 config BR2_TARGET_ROOTFS_EXT2_RESBLKS
 	int "reserved blocks percentage"
 	default 0
fs/ext2/ext2.mk +2 -0
index cab66a5..7417f81 100644
@@ -9,10 +9,12 @@ EXT2_OPTS = -G $(BR2_TARGET_ROOTFS_EXT2_GEN) -R $(BR2_TARGET_ROOTFS_EXT2_REV)
 ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)),0)
 EXT2_OPTS += -b $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)
 endif
+EXT2_OPTS += -B $(BR2_TARGET_ROOTFS_EXT2_EXTRA_BLOCKS)
 
 ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_INODES)),0)
 EXT2_OPTS += -i $(BR2_TARGET_ROOTFS_EXT2_INODES)
 endif
+EXT2_OPTS += -I $(BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES)
 
 ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)),0)
 EXT2_OPTS += -r $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)
package/mke2img/mke2img +7 -1
index 5e2f62f..d772af5 100755
@@ -17,12 +17,16 @@ main() {
     # Default values
     gen=2
     rev=1
+    nb_extra_blocks=0
+    nb_extra_inodes=0
 
-    while getopts :hb:i:r:d:o:G:R:l:u: OPT; do
+    while getopts :hb:B:i:I:r:d:o:G:R:l:u: OPT; do
         case "${OPT}" in
         h)  help; exit 0;;
         b)  nb_blocks=${OPTARG};;
+        B)  nb_extra_blocks=${OPTARG};;
         i)  nb_inodes=${OPTARG};;
+        I)  nb_extra_inodes=${OPTARG};;
         r)  nb_res_blocks=${OPTARG};;
         d)  root_dir="${OPTARG}";;
         o)  image="${OPTARG}";;
@@ -58,6 +62,7 @@ main() {
         nb_inodes=$(find "${root_dir}" | wc -l)
         nb_inodes=$((nb_inodes+400))
     fi
+    nb_inodes=$((nb_inodes+nb_extra_inodes))
 
     # calculate needed blocks
     if [ -z "${nb_blocks}" ]; then
@@ -73,6 +78,7 @@ main() {
             nb_blocks=$((nb_blocks+1300))
         fi
     fi
+    nb_blocks=$((nb_blocks+nb_extra_blocks))
 
     # Upgrade to rev1 if needed
     if [ ${rev} -ge 1 ]; then
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 fs/ext2: add options for extra space and extra inodes

Yann,

Spotted a minor typo, see below.

Quoted 23 lines · Yann E. MORIN

Add two options to the ext2 filesystem, one to add extra free space, one to add extra free inodes.

Cc Gustavo Zacarias <[email protected]>
---
 fs/ext2/Config.in       | 20 ++++++++++++++++++--
 fs/ext2/ext2.mk         |  2 ++
 package/mke2img/mke2img |  8 +++++++-
 3 files changed, 27 insertions(+), 3 deletions(-)
fs/ext2/Config.in +1 -1
index 5b1cd0c..fb06cdd 100644
@@ -45,13 +45,29 @@ config BR2_TARGET_ROOTFS_EXT2_LABEL
        string "filesystem label"
 
 config BR2_TARGET_ROOTFS_EXT2_BLOCKS
-       int "size in blocks (leave at 0 for auto calculation)"
+       int "exact size in blocks (leave at 0 for auto calculation)"
        default 0
 

fs/ext2/Config.in config BR2_TARGET_ROOTFS_EXT2_LABEL · line 59

Quoted 10 lines
fs/ext2/Config.in +6 -1
 config BR2_TARGET_ROOTFS_EXT2_INODES
-       int "inodes (leave at 0 for auto calculation)"
+       int "exact number of inodes (leave at 0 for auto calculation)"
        default 0
 
+config BR2_TARGET_ROOTFS_EXT2_EXTRA_BLOCKS
+       int "extra size in blocks" if BR2_TARGET_ROOTFS_EXT2_BLOCKS = 0
+       default 0
+       help
+         Enter here the nmuber of extra blocks of free space you

should be number not nmuber.

fs/ext2/Config.in config BR2_TARGET_ROOTFS_EXT2_LABEL · line 67

Quoted 8 lines
fs/ext2/Config.in +8 -0
+         want on your filesystem. By default, Buildroot will not
+         leave much space free.
+
+config BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES
+       int "extra inodes" if BR2_TARGET_ROOTFS_EXT2_INODES = 0
+       default 0
+       help
+         Enter here the nmuber of extra free inodes you want on

Same again

Thanks

Martin

Quoted 68 lines
fs/ext2/Config.in +3 -0
+         your filesystem. By default, Buildroot will not leave
+         many free inodes.
+
 config BR2_TARGET_ROOTFS_EXT2_RESBLKS
        int "reserved blocks percentage"
        default 0
fs/ext2/ext2.mk +2 -0
index cab66a5..7417f81 100644
@@ -9,10 +9,12 @@ EXT2_OPTS = -G $(BR2_TARGET_ROOTFS_EXT2_GEN) -R $(BR2_TARGET_ROOTFS_EXT2_REV)
 ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)),0)
 EXT2_OPTS += -b $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)
 endif
+EXT2_OPTS += -B $(BR2_TARGET_ROOTFS_EXT2_EXTRA_BLOCKS)
 
 ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_INODES)),0)
 EXT2_OPTS += -i $(BR2_TARGET_ROOTFS_EXT2_INODES)
 endif
+EXT2_OPTS += -I $(BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES)
 
 ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)),0)
 EXT2_OPTS += -r $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)
package/mke2img/mke2img +7 -2
index 5e2f62f..d772af5 100755
@@ -17,12 +17,16 @@ main() {
     # Default values
     gen=2
     rev=1
+    nb_extra_blocks=0
+    nb_extra_inodes=0
 
-    while getopts :hb:i:r:d:o:G:R:l:u: OPT; do
+    while getopts :hb:B:i:I:r:d:o:G:R:l:u: OPT; do
         case "${OPT}" in
         h)  help; exit 0;;
         b)  nb_blocks=${OPTARG};;
+        B)  nb_extra_blocks=${OPTARG};;
         i)  nb_inodes=${OPTARG};;
+        I)  nb_extra_inodes=${OPTARG};;
         r)  nb_res_blocks=${OPTARG};;
         d)  root_dir="${OPTARG}";;
         o)  image="${OPTARG}";;
@@ -58,6 +62,7 @@ main() {
         nb_inodes=$(find "${root_dir}" | wc -l)
         nb_inodes=$((nb_inodes+400))
     fi
+    nb_inodes=$((nb_inodes+nb_extra_inodes))
 
     # calculate needed blocks
     if [ -z "${nb_blocks}" ]; then
@@ -73,6 +78,7 @@ main() {
             nb_blocks=$((nb_blocks+1300))
         fi
     fi
+    nb_blocks=$((nb_blocks+nb_extra_blocks))
 
     # Upgrade to rev1 if needed
     if [ ${rev} -ge 1 ]; then
--

1.9.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#2 lore raw

PATCH 1/1 fs/ext2: add options for extra space and extra inodes

Martin, All,

On 2015-10-29 10:45 +0000, Martin Bark spake thusly:

Quoted 29 lines · Yann E. MORIN
Quoted 28 lines

Add two options to the ext2 filesystem, one to add extra free space, one to add extra free inodes.

Cc Gustavo Zacarias <[email protected]>
---
 fs/ext2/Config.in       | 20 ++++++++++++++++++--
 fs/ext2/ext2.mk         |  2 ++
 package/mke2img/mke2img |  8 +++++++-
 3 files changed, 27 insertions(+), 3 deletions(-)
fs/ext2/Config.in +2 -2
index 5b1cd0c..fb06cdd 100644
@@ -45,13 +45,29 @@ config BR2_TARGET_ROOTFS_EXT2_LABEL
        string "filesystem label"
 
 config BR2_TARGET_ROOTFS_EXT2_BLOCKS
-       int "size in blocks (leave at 0 for auto calculation)"
+       int "exact size in blocks (leave at 0 for auto calculation)"
        default 0
 
 config BR2_TARGET_ROOTFS_EXT2_INODES
-       int "inodes (leave at 0 for auto calculation)"
+       int "exact number of inodes (leave at 0 for auto calculation)"
        default 0
 
Quoted 7 lines

fs/ext2/Config.in config BR2_TARGET_ROOTFS_EXT2_LABEL · line 59

Quoted 5 lines
fs/ext2/Config.in +5 -0
+config BR2_TARGET_ROOTFS_EXT2_EXTRA_BLOCKS
+       int "extra size in blocks" if BR2_TARGET_ROOTFS_EXT2_BLOCKS = 0
+       default 0
+       help
+         Enter here the nmuber of extra blocks of free space you

should be number not nmuber.

Damn keyboard dislexia! :-)

Quoted 10 lines

fs/ext2/Config.in config BR2_TARGET_ROOTFS_EXT2_LABEL · line 67

Quoted 8 lines
fs/ext2/Config.in +8 -0
+         want on your filesystem. By default, Buildroot will not
+         leave much space free.
+
+config BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES
+       int "extra inodes" if BR2_TARGET_ROOTFS_EXT2_INODES = 0
+       default 0
+       help
+         Enter here the nmuber of extra free inodes you want on

Same again

Thanks! :-)

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH 1/1 fs/ext2: add options for extra space and extra inodes

In reply to Yann E. MORIN
Quoted 5 lines · Yann E. MORIN

Add two options to the ext2 filesystem, one to add extra free space, one to add extra free inodes.

Cc Gustavo Zacarias <[email protected]>

Though the 'nmuber' typos should be fixed as Martin wrote. Regards.

#4 lore raw

PATCH 1/1 fs/ext2: add options for extra space and extra inodes

In reply to Yann E. MORIN
Quoted 25 lines · Yann E. MORIN

Add two options to the ext2 filesystem, one to add extra free space, one to add extra free inodes.

Cc Gustavo Zacarias <[email protected]>
---
 fs/ext2/Config.in       | 20 ++++++++++++++++++--
 fs/ext2/ext2.mk         |  2 ++
 package/mke2img/mke2img |  8 +++++++-
 3 files changed, 27 insertions(+), 3 deletions(-)
fs/ext2/Config.in +1 -2
index 5b1cd0c..fb06cdd 100644
@@ -45,13 +45,29 @@ config BR2_TARGET_ROOTFS_EXT2_LABEL
 	string "filesystem label"
 
 config BR2_TARGET_ROOTFS_EXT2_BLOCKS
-	int "size in blocks (leave at 0 for auto calculation)"
+	int "exact size in blocks (leave at 0 for auto calculation)"
 	default 0
 
 config BR2_TARGET_ROOTFS_EXT2_INODES
-	int "inodes (leave at 0 for auto calculation)"

fs/ext2/Config.in config BR2_TARGET_ROOTFS_EXT2_LABEL · line 61

Quoted 10 lines
fs/ext2/Config.in +8 -0
+	int "exact number of inodes (leave at 0 for auto calculation)"
 	default 0
 
+config BR2_TARGET_ROOTFS_EXT2_EXTRA_BLOCKS
+	int "extra size in blocks" if BR2_TARGET_ROOTFS_EXT2_BLOCKS = 0
+	default 0
+	help
+	  Enter here the nmuber of extra blocks of free space you
+	  want on your filesystem. By default, Buildroot will not
+	  leave much space free.

To be precise, buildroot will add 500 extra blocks for ext2 and 1800 extra
blocks for ext3+. So perhaps we could encode that here, and remove it from the mke2img script?

fs/ext2/Config.in config BR2_TARGET_ROOTFS_EXT2_LABEL · line 69

Quoted 8 lines
fs/ext2/Config.in +8 -0
+
+config BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES
+	int "extra inodes" if BR2_TARGET_ROOTFS_EXT2_INODES = 0
+	default 0
+	help
+	  Enter here the nmuber of extra free inodes you want on
+	  your filesystem. By default, Buildroot will not leave
+	  many free inodes.

Same here, 400 inodes are added.

fs/ext2/ext2.mk EXT2_OPTS = -G $(BR2_TARGET_ROOTFS_EXT2_GEN) -R $(BR2_TARGET_ROOTFS_EXT2_REV) · line 12

Quoted 13 lines
fs/ext2/Config.in +1 -0
+
 config BR2_TARGET_ROOTFS_EXT2_RESBLKS
 	int "reserved blocks percentage"
 	default 0
fs/ext2/ext2.mk +1 -0
index cab66a5..7417f81 100644
@@ -9,10 +9,12 @@ EXT2_OPTS = -G $(BR2_TARGET_ROOTFS_EXT2_GEN) -R $(BR2_TARGET_ROOTFS_EXT2_REV)
 ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)),0)
 EXT2_OPTS += -b $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)
 endif
+EXT2_OPTS += -B $(BR2_TARGET_ROOTFS_EXT2_EXTRA_BLOCKS)

Perhaps this could be put into the else of the ifneq? Or better yet, make it an
ifeq.

Regards,
Arnout

Quoted 47 lines
fs/ext2/ext2.mk +1 -0
 ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_INODES)),0)
 EXT2_OPTS += -i $(BR2_TARGET_ROOTFS_EXT2_INODES)
 endif
+EXT2_OPTS += -I $(BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES)
 
 ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)),0)
 EXT2_OPTS += -r $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)
package/mke2img/mke2img +7 -1
index 5e2f62f..d772af5 100755
@@ -17,12 +17,16 @@ main() {
     # Default values
     gen=2
     rev=1
+    nb_extra_blocks=0
+    nb_extra_inodes=0
 
-    while getopts :hb:i:r:d:o:G:R:l:u: OPT; do
+    while getopts :hb:B:i:I:r:d:o:G:R:l:u: OPT; do
         case "${OPT}" in
         h)  help; exit 0;;
         b)  nb_blocks=${OPTARG};;
+        B)  nb_extra_blocks=${OPTARG};;
         i)  nb_inodes=${OPTARG};;
+        I)  nb_extra_inodes=${OPTARG};;
         r)  nb_res_blocks=${OPTARG};;
         d)  root_dir="${OPTARG}";;
         o)  image="${OPTARG}";;
@@ -58,6 +62,7 @@ main() {
         nb_inodes=$(find "${root_dir}" | wc -l)
         nb_inodes=$((nb_inodes+400))
     fi
+    nb_inodes=$((nb_inodes+nb_extra_inodes))
 
     # calculate needed blocks
     if [ -z "${nb_blocks}" ]; then
@@ -73,6 +78,7 @@ main() {
             nb_blocks=$((nb_blocks+1300))
         fi
     fi
+    nb_blocks=$((nb_blocks+nb_extra_blocks))
 
     # Upgrade to rev1 if needed
     if [ ${rev} -ge 1 ]; then
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#5 lore raw

PATCH 1/1 fs/ext2: add options for extra space and extra inodes

Arnout, All,

On 2015-10-30 12:01 +0100, Arnout Vandecappelle spake thusly:

Quoted 29 lines · Yann E. MORIN
Quoted 28 lines

Add two options to the ext2 filesystem, one to add extra free space, one to add extra free inodes.

Cc Gustavo Zacarias <[email protected]>
---
 fs/ext2/Config.in       | 20 ++++++++++++++++++--
 fs/ext2/ext2.mk         |  2 ++
 package/mke2img/mke2img |  8 +++++++-
 3 files changed, 27 insertions(+), 3 deletions(-)
fs/ext2/Config.in +2 -2
index 5b1cd0c..fb06cdd 100644
@@ -45,13 +45,29 @@ config BR2_TARGET_ROOTFS_EXT2_LABEL
 	string "filesystem label"
 
 config BR2_TARGET_ROOTFS_EXT2_BLOCKS
-	int "size in blocks (leave at 0 for auto calculation)"
+	int "exact size in blocks (leave at 0 for auto calculation)"
 	default 0
 
 config BR2_TARGET_ROOTFS_EXT2_INODES
-	int "inodes (leave at 0 for auto calculation)"
+	int "exact number of inodes (leave at 0 for auto calculation)"
 	default 0
 
Quoted 11 lines

fs/ext2/Config.in config BR2_TARGET_ROOTFS_EXT2_LABEL · line 61

Quoted 7 lines
fs/ext2/Config.in +7 -0
+config BR2_TARGET_ROOTFS_EXT2_EXTRA_BLOCKS
+	int "extra size in blocks" if BR2_TARGET_ROOTFS_EXT2_BLOCKS = 0
+	default 0
+	help
+	  Enter here the nmuber of extra blocks of free space you
+	  want on your filesystem. By default, Buildroot will not
+	  leave much space free.

To be precise, buildroot will add 500 extra blocks for ext2 and 1800 extra
blocks for ext3+. So perhaps we could encode that here, and remove it from the mke2img script?

I don't want to do that, because the extra blocks and inodes that Buildroot adds are just to account for the extra space required to store the filesystem metadata.

If we were to encode those here in the kconfig option, nothing would prevent the user from setting this to a value lower than strictly required.

In Kconfig, we can provide a range, but no a lower (or upper) bound to a value. And we do not want to limit the user in the values he may want to set here (even to an insanely large value for the upper bound.

I would really prefer we hide this internal complex computation from the user, and let him specify the extra space he actually wants.

Quoted 9 lines

fs/ext2/Config.in config BR2_TARGET_ROOTFS_EXT2_LABEL · line 69

Quoted 7 lines
fs/ext2/Config.in +7 -0
+config BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES
+	int "extra inodes" if BR2_TARGET_ROOTFS_EXT2_INODES = 0
+	default 0
+	help
+	  Enter here the nmuber of extra free inodes you want on
+	  your filesystem. By default, Buildroot will not leave
+	  many free inodes.

Same here, 400 inodes are added.

Ditto.

Quoted 7 lines
Quoted 7 lines
fs/ext2/Config.in +0 -0
 config BR2_TARGET_ROOTFS_EXT2_RESBLKS
 	int "reserved blocks percentage"
 	default 0
fs/ext2/ext2.mk +0 -0
index cab66a5..7417f81 100644
Quoted 8 lines

fs/ext2/ext2.mk EXT2_OPTS = -G $(BR2_TARGET_ROOTFS_EXT2_GEN) -R $(BR2_TARGET_ROOTFS_EXT2_REV) · line 12

Quoted 5 lines
fs/ext2/ext2.mk +1 -0
@@ -9,10 +9,12 @@ EXT2_OPTS = -G $(BR2_TARGET_ROOTFS_EXT2_GEN) -R $(BR2_TARGET_ROOTFS_EXT2_REV)
 ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)),0)
 EXT2_OPTS += -b $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)
 endif
+EXT2_OPTS += -B $(BR2_TARGET_ROOTFS_EXT2_EXTRA_BLOCKS)

Perhaps this could be put into the else of the ifneq? Or better yet, make it an
ifeq.

Well, the fact that the prompt has a condition before it is displayed will ensure that BR2_TARGET_ROOTFS_EXT2_EXTRA_BLOCKS/INODES is always set to a non-empty value, so we can safely use it. If the user specified the exact size/inodes, then the extra size/indoes will be set to 0.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#6 lore raw

PATCH 1/1 fs/ext2: add options for extra space and extra inodes

Quoted 9 lines · Yann E. MORIN

Arnout, All,

On 2015-10-30 12:01 +0100, Arnout Vandecappelle spake thusly:

Quoted 6 lines · Yann E. MORIN
Quoted 5 lines

Add two options to the ext2 filesystem, one to add extra free space, one to add extra free inodes.

Cc Gustavo Zacarias <[email protected]>

[snip]

Quoted 20 lines
Quoted 11 lines

fs/ext2/Config.in config BR2_TARGET_ROOTFS_EXT2_LABEL · line 61

Quoted 7 lines
fs/ext2/Config.in +7 -0
+config BR2_TARGET_ROOTFS_EXT2_EXTRA_BLOCKS
+	int "extra size in blocks" if BR2_TARGET_ROOTFS_EXT2_BLOCKS = 0
+	default 0
+	help
+	  Enter here the nmuber of extra blocks of free space you
+	  want on your filesystem. By default, Buildroot will not
+	  leave much space free.

To be precise, buildroot will add 500 extra blocks for ext2 and 1800 extra
blocks for ext3+. So perhaps we could encode that here, and remove it from the mke2img script?

I don't want to do that, because the extra blocks and inodes that Buildroot adds are just to account for the extra space required to store the filesystem metadata.

If we were to encode those here in the kconfig option, nothing would prevent the user from setting this to a value lower than strictly required.

Quoted 6 lines

In Kconfig, we can provide a range, but no a lower (or upper) bound to a value. And we do not want to limit the user in the values he may want to set here (even to an insanely large value for the upper bound.

I would really prefer we hide this internal complex computation from the user, and let him specify the extra space he actually wants.

OK fair enough.

Quoted 28 lines
Quoted 9 lines

fs/ext2/Config.in config BR2_TARGET_ROOTFS_EXT2_LABEL · line 69

Quoted 7 lines
fs/ext2/Config.in +7 -0
+config BR2_TARGET_ROOTFS_EXT2_EXTRA_INODES
+	int "extra inodes" if BR2_TARGET_ROOTFS_EXT2_INODES = 0
+	default 0
+	help
+	  Enter here the nmuber of extra free inodes you want on
+	  your filesystem. By default, Buildroot will not leave
+	  many free inodes.

Same here, 400 inodes are added.

Ditto.

Quoted 7 lines
Quoted 7 lines

config BR2_TARGET_ROOTFS_EXT2_RESBLKS

fs/ext2/Config.in +0 -0
 	int "reserved blocks percentage"
 	default 0
fs/ext2/ext2.mk +0 -0
index cab66a5..7417f81 100644
Quoted 8 lines

fs/ext2/ext2.mk EXT2_OPTS = -G $(BR2_TARGET_ROOTFS_EXT2_GEN) -R $(BR2_TARGET_ROOTFS_EXT2_REV) · line 12

Quoted 5 lines
fs/ext2/ext2.mk +1 -0
@@ -9,10 +9,12 @@ EXT2_OPTS = -G $(BR2_TARGET_ROOTFS_EXT2_GEN) -R $(BR2_TARGET_ROOTFS_EXT2_REV)
 ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)),0)
 EXT2_OPTS += -b $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)
 endif
+EXT2_OPTS += -B $(BR2_TARGET_ROOTFS_EXT2_EXTRA_BLOCKS)

Perhaps this could be put into the else of the ifneq? Or better yet, make it an
ifeq.

Quoted 4 lines

Well, the fact that the prompt has a condition before it is displayed will ensure that BR2_TARGET_ROOTFS_EXT2_EXTRA_BLOCKS/INODES is always set to a non-empty value, so we can safely use it. If the user specified the exact size/inodes, then the extra size/indoes will be set to 0.

I meant it more as a refactoring that makes the code easier to understand, but
you may have a different opinion of what is easier, so:

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle      arnout dot vandecappelle at essensium dot com
Senior Embedded Software Architect . . . . . . +32-478-010353 (mobile)
Essensium, Mind division . . . . . . . . . . . . . . http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium . . . . . BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF