Hi!
On Wed, 2015-05-27 at 16:53 +0200, Cyril Hrubis wrote:
> Hi!
> > + local get_size=$(blockdev --getsize64 ${TST_DEVICE})
> > + # 20971520 = 20 * 1024 * 1024 = 20M
> > + if [ ${get_size} != "20971520" ]; then
> > + tst_brkm TCONF "${TST_DEVICE} size is ${get_size}, excepted 20M"
> > + fi
>
> Why can't we calculate the expected free space based on the size of
> the
> device?
Hmm, I do not think it is suitable to calculate the size. 'df' report
file system disk space usage, which means it just only report the count
of all the data block. super block, group descriptor and others will not
include.
ps:
ext2 file system:
+--------------+---------+---------+-----+---------+
| boot section | group 0 | group 1 | ... | group n |
+--------------+---------+---------+-----+---------+
group n:
+-------+------------+------------+--------+-------+-------+
| super | group | data block | inode | inode | data |
| block | descriptor | bitmap | bitmap | table | block |
+-------+------------+------------+--------+-------+-------+
> Does the space taken by the ext2 internal data structures
> vary unpredictedly?
>
If we specify the block size, inode size and super block, we could get
the size of data block. BTW, mkfs use sparse_super as default option,
that means not every group has superblock backup copies. That make it
hard to calculate the size of data block.
> > + ROD_SILENT mkfs.ext2 ${TST_DEVICE}
> > +
> > + ROD_SILENT mkdir -p mntpoint
> > +
> > + ROD_SILENT mount ${TST_DEVICE} mntpoint
> > +}
> > +
> > +cleanup()
> > +{
> > + grep -q mntpoint /proc/self/mounts
> > + if [ $? -eq 0 ]; then
> > + umount mntpoint
> > + if [ $? -ne 0 ];then
> > + tst_resm TWARN "'umount mntpoint' failed"
> > + fi
> > + else
> > + tst_resm TINFO "mntpoint is not mounted"
> > + fi
> > +
> > + tst_release_device
> > +
> > + tst_rmdir
> > +}
> > +
> > +df_test()
> > +{
> > + $1 >${TCID}.temp 2>&1
>
> You do tst_tmpdir in the setup, which creates unique directory for the
> testcase. There is no need to construct complicated names for
> temporary
> files. Simple $1 > out 2>&1 should be fine.
OK. I see.
Thank you.
Best regards,
Zeng
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list