linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Bernd Schubert <bernd.schubert@itwm.fraunhofer.de>
Cc: "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	Wu Fengguang <fengguang.wu@intel.com>
Subject: Re: should bdi_init() initialize congested_fn?
Date: Fri, 14 Oct 2011 10:12:46 +1100	[thread overview]
Message-ID: <20111013231246.GQ3159@dastard> (raw)
In-Reply-To: <4E96FFDD.5030905@itwm.fraunhofer.de>

On Thu, Oct 13, 2011 at 05:12:29PM +0200, Bernd Schubert wrote:
> Hello,
> 
> while testing FhGFS I got a stack trace that seems to point out that
> bdi_congested() tries to call an uninitialized bdi->congested_fn().

Right. bdi_init() assumes you've zero'd the structure before
calling - it doesn't initialise any fields have a zero value.

> So I checked where ->congested_fn() is initialized - with exception
> of btrfs I do not find a file system that does that at all.

the bdi congestion function is filled out by the underlying block
device when the block device is initialised. Most filesystems get
their bdi from the underlying device when they are mounted. See
mount_bdev/set_bdev_super.

btrfs is a special case. You'd do best to ignore the games btrfs
plays while trying to understand how the generic infrastructure
works. ;)

> But then
> bdi_init(), which is called by most file systems for initialization
> also does *not* initialize it. So either I'm missing something, or
> almost all bdi users have a bug?

bdi_init() is only used by filesystems that done not operate
directly on a block device with that a bdi can be taken from. e.g.
filesystems without a backing store (ramfs, /proc, /sys, etc)Da, or
have special needs (e.g. ubifs). They are all ensuring that the
unused fields of the bdi are zero before calling bdi_init().

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

      reply	other threads:[~2011-10-13 23:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-13 15:12 should bdi_init() initialize congested_fn? Bernd Schubert
2011-10-13 23:12 ` Dave Chinner [this message]

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=20111013231246.GQ3159@dastard \
    --to=david@fromorbit.com \
    --cc=bernd.schubert@itwm.fraunhofer.de \
    --cc=fengguang.wu@intel.com \
    --cc=linux-fsdevel@vger.kernel.org \
    /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).