diff options
author | Alan Cudmore <alan.cudmore@gmail.com> | 2013-12-18 12:37:47 -0500 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2013-12-19 11:07:41 +1100 |
commit | 9b48dc67ed57f31c00b2e4351a30fac947472899 (patch) | |
tree | 2a47f4a369375542e1355a68a9b7d6507d8a22e0 /cpukit/libfs/src/rfs | |
parent | e60b7b1b4f19894dda0096b116bb0a21a5c51101 (diff) |
For PR 2162 - RFS File System - statvfs reports 1 block free
This is for the RFS file system. The statvfs call reports 1 block free
when the file system is full because it does not account for the superblock
in its calculation of free blocks.
This is a simple fix that adjusts the number of blocks reported to account
for the superblock. We may want to wait for a more complete solution such
as locating the superblock in each group.
Diffstat (limited to 'cpukit/libfs/src/rfs')
-rw-r--r-- | cpukit/libfs/src/rfs/rtems-rfs-rtems.c | 2 | ||||
-rw-r--r-- | cpukit/libfs/src/rfs/rtems-rfs-shell.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/cpukit/libfs/src/rfs/rtems-rfs-rtems.c b/cpukit/libfs/src/rfs/rtems-rfs-rtems.c index e199ffec87..d95a0f53b0 100644 --- a/cpukit/libfs/src/rfs/rtems-rfs-rtems.c +++ b/cpukit/libfs/src/rfs/rtems-rfs-rtems.c @@ -753,7 +753,7 @@ rtems_rfs_rtems_statvfs ( sb->f_bsize = rtems_rfs_fs_block_size (fs); sb->f_frsize = rtems_rfs_fs_media_block_size (fs); sb->f_blocks = rtems_rfs_fs_media_blocks (fs); - sb->f_bfree = rtems_rfs_fs_blocks (fs) - blocks; + sb->f_bfree = rtems_rfs_fs_blocks (fs) - blocks - 1; /* do not count the superblock */ sb->f_bavail = sb->f_bfree; sb->f_files = rtems_rfs_fs_inodes (fs); sb->f_ffree = rtems_rfs_fs_inodes (fs) - inodes; diff --git a/cpukit/libfs/src/rfs/rtems-rfs-shell.c b/cpukit/libfs/src/rfs/rtems-rfs-shell.c index 96c0c17890..b92041a419 100644 --- a/cpukit/libfs/src/rfs/rtems-rfs-shell.c +++ b/cpukit/libfs/src/rfs/rtems-rfs-shell.c @@ -149,7 +149,7 @@ rtems_rfs_shell_data (rtems_rfs_file_system* fs, int argc, char *argv[]) rtems_rfs_shell_unlock_rfs (fs); - bpcent = (blocks * 1000) / rtems_rfs_fs_blocks (fs); + bpcent = (blocks * 1000) / (rtems_rfs_fs_blocks (fs) - 1); ipcent = (inodes * 1000) / rtems_rfs_fs_inodes (fs); printf (" blocks used: %zd (%d.%d%%)\n", |