linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: "Pali Rohár" <pali.rohar@gmail.com>
Cc: Jan Kara <jack@suse.cz>, linux-fsdevel@vger.kernel.org
Subject: Re: udf: Suspicious values in udf_statfs()
Date: Fri, 17 Jan 2020 12:38:33 +0100	[thread overview]
Message-ID: <20200117113833.GG17141@quack2.suse.cz> (raw)
In-Reply-To: <20200116153019.5awize7ufnxtjagf@pali>

On Thu 16-01-20 16:30:19, Pali Rohár wrote:
> On Monday 13 January 2020 13:08:51 Jan Kara wrote:
> > > Second one:
> > > 
> > > 	buf->f_files = (lvidiu != NULL ? (le32_to_cpu(lvidiu->numFiles) +
> > > 					  le32_to_cpu(lvidiu->numDirs)) : 0)
> > > 			+ buf->f_bfree;
> > > 
> > > What f_files entry should report? Because result of sum of free blocks
> > > and number of files+directories does not make sense for me.
> > 
> > This is related to the fact that we return 'f_bfree' as the number of 'free
> > file nodes' in 'f_ffree'. And tools generally display f_files-f_ffree as
> > number of used inodes. In other words we treat every free block also as a
> > free 'inode' and report it in total amount of 'inodes'. I know this is not
> > very obvious but IMHO it causes the least confusion to users reading df(1)
> > output.
> 
> So current code which returns sum of free blocks and number of
> files+directories is correct. Could be this information about statvfs
> f_files somewhere documented? Because this is not really obvious nor for
> userspace applications which use statvfs() nor for kernel filesystem
> drivers.

Well, I can certainly add a comment to udf_statfs(). Documenting in some
manpage might be worth it but I'm not 100% sure where - maybe directly in
the statfs(2) to the NOTES section? Also note that this behavior is not
unique to UDF - e.g. XFS also does the same.

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

  reply	other threads:[~2020-01-17 11:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-12 16:23 udf: Suspicious values in udf_statfs() Pali Rohár
2020-01-13 12:08 ` Jan Kara
2020-01-16 15:30   ` Pali Rohár
2020-01-17 11:38     ` Jan Kara [this message]
2020-01-17 22:35       ` Pali Rohár
2020-01-17 12:05   ` Jan Kara
2020-01-18  0:11     ` Pali Rohár
2020-01-20 13:02       ` Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200117113833.GG17141@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=pali.rohar@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).