From: Andrew Morton <akpm@osdl.org>
To: Christoph Hellwig <hch@lst.de>
Cc: viro@ftp.linux.org.uk, linux-fsdevel@vger.kernel.org,
linux-mm@kvack.org, William Lee Irwin III <wli@holomorphy.com>
Subject: Re: [PATCH 1/4] hugetlbfs: move free_inodes accounting
Date: Wed, 21 Sep 2005 12:10:36 -0700 [thread overview]
Message-ID: <20050921121036.416bdbfb.akpm@osdl.org> (raw)
In-Reply-To: <20050921092156.GA22544@lst.de>
Christoph Hellwig <hch@lst.de> wrote:
>
> +static inline int hugetlbfs_inc_free_inodes(struct hugetlbfs_sb_info *sbinfo)
> +{
> + if (sbinfo->free_inodes >= 0) {
> + spin_lock(&sbinfo->stat_lock);
> + if (unlikely(!sbinfo->free_inodes)) {
> + spin_unlock(&sbinfo->stat_lock);
> + return 0;
> + }
> + sbinfo->free_inodes--;
> + spin_unlock(&sbinfo->stat_lock);
> + }
> +
> + return 1;
> +}
> +
> +static void hugetlbfs_dec_free_inodes(struct hugetlbfs_sb_info *sbinfo)
> +{
> + if (sbinfo->free_inodes >= 0) {
> + spin_lock(&sbinfo->stat_lock);
> + sbinfo->free_inodes++;
> + spin_unlock(&sbinfo->stat_lock);
> + }
> +}
> +
These functions seem to be called from the right places, but the naming is
most confusing.
The test for the current value of sbinfo->free_inodes in
hugetlbfs_dec_free_inodes() looks racy and the logic simply escapes me.
Does anyone remember why we have special-case handling in there for
(sbinfo->free_inodes < 0)?
next prev parent reply other threads:[~2005-09-21 19:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-21 9:21 [PATCH 1/4] hugetlbfs: move free_inodes accounting Christoph Hellwig
2005-09-21 19:10 ` Andrew Morton [this message]
2005-09-21 19:34 ` Dave Hansen
-- strict thread matches above, loose matches on Subject: below --
2005-09-22 6:37 Chen, Kenneth W
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=20050921121036.416bdbfb.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=hch@lst.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=viro@ftp.linux.org.uk \
--cc=wli@holomorphy.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).