diff options
author | Boaz Harrosh <bharrosh@panasas.com> | 2009-11-02 11:19:24 -0500 |
---|---|---|
committer | Boaz Harrosh <bharrosh@panasas.com> | 2009-12-10 02:59:21 -0500 |
commit | cae012d8532879544326fff5fa2ae22a6dfe8e23 (patch) | |
tree | 7958c2c11cee1b0c342f7902cd538dcec679989e /fs/exofs/super.c | |
parent | 19fe294f2eaee33574ac1fdcf3cc26880de820ea (diff) |
exofs: statfs blocks is sectors not FS blocks
Even though exofs has a 4k block size, statfs blocks
is in sectors (512 bytes).
Also if target returns 0 for capacity then make it
ULLONG_MAX. df does not like zero-size filesystems
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Diffstat (limited to 'fs/exofs/super.c')
-rw-r--r-- | fs/exofs/super.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/exofs/super.c b/fs/exofs/super.c index 920f0165edf3..28add3eac0a4 100644 --- a/fs/exofs/super.c +++ b/fs/exofs/super.c | |||
@@ -473,9 +473,11 @@ static int exofs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
473 | goto out; | 473 | goto out; |
474 | 474 | ||
475 | ret = extract_attr_from_req(or, &attrs[0]); | 475 | ret = extract_attr_from_req(or, &attrs[0]); |
476 | if (likely(!ret)) | 476 | if (likely(!ret)) { |
477 | capacity = get_unaligned_be64(attrs[0].val_ptr); | 477 | capacity = get_unaligned_be64(attrs[0].val_ptr); |
478 | else | 478 | if (unlikely(!capacity)) |
479 | capacity = ULLONG_MAX; | ||
480 | } else | ||
479 | EXOFS_DBGMSG("exofs_statfs: get capacity failed.\n"); | 481 | EXOFS_DBGMSG("exofs_statfs: get capacity failed.\n"); |
480 | 482 | ||
481 | ret = extract_attr_from_req(or, &attrs[1]); | 483 | ret = extract_attr_from_req(or, &attrs[1]); |
@@ -487,8 +489,8 @@ static int exofs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
487 | /* fill in the stats buffer */ | 489 | /* fill in the stats buffer */ |
488 | buf->f_type = EXOFS_SUPER_MAGIC; | 490 | buf->f_type = EXOFS_SUPER_MAGIC; |
489 | buf->f_bsize = EXOFS_BLKSIZE; | 491 | buf->f_bsize = EXOFS_BLKSIZE; |
490 | buf->f_blocks = (capacity >> EXOFS_BLKSHIFT); | 492 | buf->f_blocks = capacity >> 9; |
491 | buf->f_bfree = ((capacity - used) >> EXOFS_BLKSHIFT); | 493 | buf->f_bfree = (capacity - used) >> 9; |
492 | buf->f_bavail = buf->f_bfree; | 494 | buf->f_bavail = buf->f_bfree; |
493 | buf->f_files = sbi->s_numfiles; | 495 | buf->f_files = sbi->s_numfiles; |
494 | buf->f_ffree = EXOFS_MAX_ID - sbi->s_numfiles; | 496 | buf->f_ffree = EXOFS_MAX_ID - sbi->s_numfiles; |