summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES1
-rwxr-xr-xfs/ext2/genext2fs.sh25
2 files changed, 12 insertions, 14 deletions
diff --git a/CHANGES b/CHANGES
index 4fef0eb1e..a67d1d142 100644
--- a/CHANGES
+++ b/CHANGES
@@ -24,6 +24,7 @@
#1735: [PATCH] mplayer: convert to autotools infrastructure
#2371: QT MYSQL Module does not build when MySQL installed on the host
#2905: Qt: Speed up compilation, if gui-module isn't selected
+ #2929: genext2fs: couldn't allocate a block (no free space)
#2965: Broken linkage to xkbcomp (blocking X server startup)
#2983: xlib_libX11 build failed
diff --git a/fs/ext2/genext2fs.sh b/fs/ext2/genext2fs.sh
index b315ec30a..7a518aea7 100755
--- a/fs/ext2/genext2fs.sh
+++ b/fs/ext2/genext2fs.sh
@@ -10,24 +10,11 @@ while getopts x:d:D:b:i:N:m:g:e:zfqUPhVv f
do
case $f in
b) CALC_BLOCKS=0 ;;
- N) CALC_INODES=0 ;;
+ N) CALC_INODES=0; INODES=$OPTARG ;;
d) TARGET_DIR=$OPTARG ;;
esac
done
-# calculate needed blocks
-if [ $CALC_BLOCKS -eq 1 ];
-then
- BLOCKS=$(du -s -c -k $TARGET_DIR | grep total | sed -e "s/total//")
- if [ $BLOCKS -ge 20000 ];
- then
- BLOCKS=$(expr $BLOCKS + 16384)
- else
- BLOCKS=$(expr $BLOCKS + 2400)
- fi
- set -- $@ -b $BLOCKS
-fi
-
# calculate needed inodes
if [ $CALC_INODES -eq 1 ];
then
@@ -36,4 +23,14 @@ then
set -- $@ -N $INODES
fi
+# calculate needed blocks
+if [ $CALC_BLOCKS -eq 1 ];
+then
+ # size ~= superblock, block+inode bitmaps, inodes (8 per block), blocks
+ # we scale inodes / blocks with 10% to compensate for bitmaps size + slack
+ BLOCKS=$(du -s -c -k $TARGET_DIR | grep total | sed -e "s/total//")
+ BLOCKS=$(expr 500 + \( $BLOCKS + $INODES / 8 \) \* 11 / 10)
+ set -- $@ -b $BLOCKS
+fi
+
exec genext2fs $@