diff mbox series

[v2,5/5] hugetlbfs: fix inaccurate comment in hugetlbfs_statfs()

Message ID 20220726142918.51693-6-linmiaohe@huawei.com (mailing list archive)
State New
Headers show
Series A few cleanup and fixup patches for hugetlbfs | expand

Commit Message

Miaohe Lin July 26, 2022, 2:29 p.m. UTC
In some cases, e.g. when size option is not specified, f_blocks, f_bavail
and f_bfree will be set to -1 instead of 0. Likewise, when nr_inodes isn't
specified, f_files and f_ffree will be set to -1 too. Update the comment
to make this clear.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 fs/hugetlbfs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mike Kravetz July 26, 2022, 9:20 p.m. UTC | #1
On 07/26/22 22:29, Miaohe Lin wrote:
> In some cases, e.g. when size option is not specified, f_blocks, f_bavail
> and f_bfree will be set to -1 instead of 0. Likewise, when nr_inodes isn't
> specified, f_files and f_ffree will be set to -1 too. Update the comment
> to make this clear.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
>  fs/hugetlbfs/inode.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Thanks,

Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Muchun Song July 27, 2022, 6:46 a.m. UTC | #2
On Tue, Jul 26, 2022 at 10:29:18PM +0800, Miaohe Lin wrote:
> In some cases, e.g. when size option is not specified, f_blocks, f_bavail
> and f_bfree will be set to -1 instead of 0. Likewise, when nr_inodes isn't
> specified, f_files and f_ffree will be set to -1 too. Update the comment
> to make this clear.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>

Reviewed-by: Muchun Song <songmuchun@bytedance.com>

Thanks.
diff mbox series

Patch

diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 96c60aa3ab47..fe0e374b02a3 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -1079,7 +1079,7 @@  static int hugetlbfs_statfs(struct dentry *dentry, struct kstatfs *buf)
 	buf->f_bsize = huge_page_size(h);
 	if (sbinfo) {
 		spin_lock(&sbinfo->stat_lock);
-		/* If no limits set, just report 0 for max/free/used
+		/* If no limits set, just report 0 or -1 for max/free/used
 		 * blocks, like simple_statfs() */
 		if (sbinfo->spool) {
 			long free_pages;